]> git.saurik.com Git - apple/xnu.git/blob - bsd/dev/ppc/chud/chud_process.c
xnu-792.6.76.tar.gz
[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 * 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
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 #include <sys/systm.h>
24 #include <sys/proc_internal.h>
25 #include <sys/vnode_internal.h> // vn_getpath()
26
27 __private_extern__
28 int 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 }
40
41 __private_extern__
42 task_t chudxnu_task_for_pid(int pid)
43 {
44 struct proc *p = pfind(pid);
45 if(p) {
46 return p->task;
47 }
48 return TASK_NULL;
49 }
50
51 __private_extern__
52 int chudxnu_current_pid(void)
53 {
54 return current_proc()->p_pid;
55 }