]> git.saurik.com Git - apple/xnu.git/blame - bsd/dev/ppc/chud/chud_process.c
xnu-792.6.61.tar.gz
[apple/xnu.git] / bsd / dev / ppc / chud / chud_process.c
CommitLineData
1c79356b 1/*
55e303ae 2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
1c79356b
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
37839358
A
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
37839358
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
1c79356b
A
20 * @APPLE_LICENSE_HEADER_END@
21 */
1c79356b 22
55e303ae 23#include <sys/systm.h>
91447636
A
24#include <sys/proc_internal.h>
25#include <sys/vnode_internal.h> // vn_getpath()
1c79356b 26
55e303ae
A
27__private_extern__
28int chudxnu_pid_for_task(task_t task)
29{
30 struct proc *p;
31
32 if(task!=TASK_NULL) {
33 p = (struct proc *)(get_bsdtask_info(task));
34 if(p) {
35 return (p->p_pid);
36 }
37 }
38 return -1;
39}
1c79356b 40
55e303ae
A
41__private_extern__
42task_t chudxnu_task_for_pid(int pid)
1c79356b 43{
55e303ae
A
44 struct proc *p = pfind(pid);
45 if(p) {
46 return p->task;
47 }
48 return TASK_NULL;
1c79356b
A
49}
50
55e303ae
A
51__private_extern__
52int chudxnu_current_pid(void)
53{
54 return current_proc()->p_pid;
55}