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