]> git.saurik.com Git - apple/xnu.git/blob - bsd/dev/ppc/chud/chud_process.c
xnu-517.7.21.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.h>
25
26 __private_extern__
27 int chudxnu_pid_for_task(task_t task)
28 {
29 struct proc *p;
30
31 if(task!=TASK_NULL) {
32 p = (struct proc *)(get_bsdtask_info(task));
33 if(p) {
34 return (p->p_pid);
35 }
36 }
37 return -1;
38 }
39
40 __private_extern__
41 task_t chudxnu_task_for_pid(int pid)
42 {
43 struct proc *p = pfind(pid);
44 if(p) {
45 return p->task;
46 }
47 return TASK_NULL;
48 }
49
50 __private_extern__
51 int chudxnu_current_pid(void)
52 {
53 return current_proc()->p_pid;
54 }