]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
55e303ae | 2 | * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved. |
1c79356b A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
43866e37 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
43866e37 A |
8 | * This file contains Original Code and/or Modifications of Original Code |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
43866e37 A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ | |
26 | /*- | |
27 | * Copyright (c) 1986, 1989, 1991, 1993 | |
28 | * The Regents of the University of California. All rights reserved. | |
29 | * (c) UNIX System Laboratories, Inc. | |
30 | * All or some portions of this file are derived from material licensed | |
31 | * to the University of California by American Telephone and Telegraph | |
32 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
33 | * the permission of UNIX System Laboratories, Inc. | |
34 | * | |
35 | * Redistribution and use in source and binary forms, with or without | |
36 | * modification, are permitted provided that the following conditions | |
37 | * are met: | |
38 | * 1. Redistributions of source code must retain the above copyright | |
39 | * notice, this list of conditions and the following disclaimer. | |
40 | * 2. Redistributions in binary form must reproduce the above copyright | |
41 | * notice, this list of conditions and the following disclaimer in the | |
42 | * documentation and/or other materials provided with the distribution. | |
43 | * 3. All advertising materials mentioning features or use of this software | |
44 | * must display the following acknowledgement: | |
45 | * This product includes software developed by the University of | |
46 | * California, Berkeley and its contributors. | |
47 | * 4. Neither the name of the University nor the names of its contributors | |
48 | * may be used to endorse or promote products derived from this software | |
49 | * without specific prior written permission. | |
50 | * | |
51 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
52 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
53 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
54 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
55 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
56 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
57 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
58 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
59 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
60 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
61 | * SUCH DAMAGE. | |
62 | * | |
63 | * @(#)proc.h 8.15 (Berkeley) 5/19/95 | |
64 | */ | |
65 | ||
66 | #ifndef _SYS_PROC_H_ | |
67 | #define _SYS_PROC_H_ | |
68 | ||
9bccf70c | 69 | #include <sys/appleapiopts.h> |
1c79356b | 70 | #include <sys/cdefs.h> |
1c79356b A |
71 | #include <sys/select.h> /* For struct selinfo. */ |
72 | #include <sys/queue.h> | |
73 | #include <sys/lock.h> | |
74 | #include <sys/param.h> | |
55e303ae A |
75 | #include <sys/event.h> |
76 | #include <sys/audit.h> | |
1c79356b | 77 | |
9bccf70c A |
78 | #ifdef __APPLE_API_PRIVATE |
79 | ||
1c79356b A |
80 | /* |
81 | * One structure allocated per session. | |
82 | */ | |
83 | struct session { | |
84 | int s_count; /* Ref cnt; pgrps in session. */ | |
85 | struct proc *s_leader; /* Session leader. */ | |
86 | struct vnode *s_ttyvp; /* Vnode of controlling terminal. */ | |
87 | struct tty *s_ttyp; /* Controlling terminal. */ | |
9bccf70c | 88 | pid_t s_sid; /* Session ID */ |
1c79356b A |
89 | char s_login[MAXLOGNAME]; /* Setlogin() name. */ |
90 | }; | |
91 | ||
92 | /* | |
93 | * One structure allocated per process group. | |
94 | */ | |
95 | struct pgrp { | |
96 | LIST_ENTRY(pgrp) pg_hash; /* Hash chain. */ | |
97 | LIST_HEAD(, proc) pg_members; /* Pointer to pgrp members. */ | |
98 | struct session *pg_session; /* Pointer to session. */ | |
99 | pid_t pg_id; /* Pgrp id. */ | |
100 | int pg_jobc; /* # procs qualifying pgrp for job control */ | |
101 | }; | |
102 | ||
103 | /* | |
104 | * Description of a process. | |
105 | * | |
106 | * This structure contains the information needed to manage a thread of | |
107 | * control, known in UN*X as a process; it has references to substructures | |
108 | * containing descriptions of things that the process uses, but may share | |
109 | * with related processes. The process structure and the substructures | |
110 | * are always addressible except for those marked "(PROC ONLY)" below, | |
111 | * which might be addressible only on a processor on which the process | |
112 | * is running. | |
113 | */ | |
114 | struct proc { | |
115 | LIST_ENTRY(proc) p_list; /* List of all processes. */ | |
116 | ||
117 | /* substructures: */ | |
118 | struct pcred *p_cred; /* Process owner's identity. */ | |
119 | struct filedesc *p_fd; /* Ptr to open files structure. */ | |
120 | struct pstats *p_stats; /* Accounting/statistics (PROC ONLY). */ | |
121 | struct plimit *p_limit; /* Process limits. */ | |
122 | struct sigacts *p_sigacts; /* Signal actions, state (PROC ONLY). */ | |
123 | ||
124 | #define p_ucred p_cred->pc_ucred | |
125 | #define p_rlimit p_limit->pl_rlimit | |
126 | ||
127 | int p_flag; /* P_* flags. */ | |
128 | char p_stat; /* S* process status. */ | |
129 | char p_pad1[3]; | |
130 | ||
131 | pid_t p_pid; /* Process identifier. */ | |
132 | LIST_ENTRY(proc) p_pglist; /* List of processes in pgrp. */ | |
133 | struct proc *p_pptr; /* Pointer to parent process. */ | |
134 | LIST_ENTRY(proc) p_sibling; /* List of sibling processes. */ | |
135 | LIST_HEAD(, proc) p_children; /* Pointer to list of children. */ | |
136 | ||
137 | /* The following fields are all zeroed upon creation in fork. */ | |
138 | #define p_startzero p_oppid | |
139 | ||
140 | pid_t p_oppid; /* Save parent pid during ptrace. XXX */ | |
141 | int p_dupfd; /* Sideways return value from fdopen. XXX */ | |
142 | ||
143 | /* scheduling */ | |
144 | u_int p_estcpu; /* Time averaged value of p_cpticks. */ | |
145 | int p_cpticks; /* Ticks of cpu time. */ | |
146 | fixpt_t p_pctcpu; /* %cpu for this process during p_swtime */ | |
147 | void *p_wchan; /* Sleep address. */ | |
148 | char *p_wmesg; /* Reason for sleep. */ | |
55e303ae A |
149 | u_int p_swtime; /* DEPRECATED (Time swapped in or out.) */ |
150 | #define p_argslen p_swtime /* Length of process arguments. */ | |
1c79356b A |
151 | u_int p_slptime; /* Time since last blocked. */ |
152 | ||
153 | struct itimerval p_realtimer; /* Alarm timer. */ | |
154 | struct timeval p_rtime; /* Real time. */ | |
155 | u_quad_t p_uticks; /* Statclock hits in user mode. */ | |
156 | u_quad_t p_sticks; /* Statclock hits in system mode. */ | |
157 | u_quad_t p_iticks; /* Statclock hits processing intr. */ | |
158 | ||
159 | int p_traceflag; /* Kernel trace points. */ | |
160 | struct vnode *p_tracep; /* Trace to vnode. */ | |
161 | ||
9bccf70c | 162 | sigset_t p_siglist; /* DEPRECATED. */ |
1c79356b A |
163 | |
164 | struct vnode *p_textvp; /* Vnode of executable. */ | |
165 | ||
166 | /* End area that is zeroed on creation. */ | |
167 | #define p_endzero p_hash.le_next | |
168 | ||
169 | /* | |
170 | * Not copied, not zero'ed. | |
171 | * Belongs after p_pid, but here to avoid shifting proc elements. | |
172 | */ | |
173 | LIST_ENTRY(proc) p_hash; /* Hash chain. */ | |
55e303ae | 174 | TAILQ_HEAD( ,eventqelt) p_evlist; |
1c79356b A |
175 | |
176 | /* The following fields are all copied upon creation in fork. */ | |
177 | #define p_startcopy p_sigmask | |
178 | ||
9bccf70c | 179 | sigset_t p_sigmask; /* DEPRECATED */ |
1c79356b A |
180 | sigset_t p_sigignore; /* Signals being ignored. */ |
181 | sigset_t p_sigcatch; /* Signals being caught by user. */ | |
182 | ||
183 | u_char p_priority; /* Process priority. */ | |
184 | u_char p_usrpri; /* User-priority based on p_cpu and p_nice. */ | |
185 | char p_nice; /* Process "nice" value. */ | |
186 | char p_comm[MAXCOMLEN+1]; | |
187 | ||
188 | struct pgrp *p_pgrp; /* Pointer to process group. */ | |
189 | ||
190 | /* End area that is copied on creation. */ | |
191 | #define p_endcopy p_xstat | |
192 | ||
193 | u_short p_xstat; /* Exit status for wait; also stop signal. */ | |
194 | u_short p_acflag; /* Accounting flags. */ | |
195 | struct rusage *p_ru; /* Exit information. XXX */ | |
196 | ||
197 | int p_debugger; /* 1: can exec set-bit programs if suser */ | |
198 | ||
199 | void *task; /* corresponding task */ | |
200 | void *sigwait_thread; /* 'thread' holding sigwait */ | |
201 | struct lock__bsd__ signal_lock; /* multilple thread prot for signals*/ | |
202 | boolean_t sigwait; /* indication to suspend */ | |
203 | void *exit_thread; /* Which thread is exiting? */ | |
204 | caddr_t user_stack; /* where user stack was allocated */ | |
205 | void * exitarg; /* exit arg for proc terminate */ | |
206 | void * vm_shm; /* for sysV shared memory */ | |
55e303ae | 207 | int p_argc; /* saved argc for sysctl_procargs() */ |
0b4e3aa0 A |
208 | int p_vforkcnt; /* number of outstanding vforks */ |
209 | void * p_vforkact; /* activation running this vfork proc */ | |
9bccf70c A |
210 | TAILQ_HEAD( , uthread) p_uthlist; /* List of uthreads */ |
211 | /* Following fields are info from SIGCHLD */ | |
212 | pid_t si_pid; | |
213 | u_short si_status; | |
214 | u_short si_code; | |
215 | uid_t si_uid; | |
55e303ae A |
216 | TAILQ_HEAD( , aio_workq_entry ) aio_activeq; /* active async IO requests */ |
217 | int aio_active_count; /* entries on aio_activeq */ | |
218 | TAILQ_HEAD( , aio_workq_entry ) aio_doneq; /* completed async IO requests */ | |
219 | int aio_done_count; /* entries on aio_doneq */ | |
220 | ||
221 | struct klist p_klist; /* knote list */ | |
222 | struct auditinfo *p_au; /* User auditing data */ | |
1c79356b A |
223 | #if DIAGNOSTIC |
224 | #if SIGNAL_DEBUG | |
225 | unsigned int lockpc[8]; | |
226 | unsigned int unlockpc[8]; | |
227 | #endif /* SIGNAL_DEBUG */ | |
228 | #endif /* DIAGNOSTIC */ | |
229 | }; | |
230 | ||
55e303ae | 231 | #else /* !__APPLE_API_PRIVATE */ |
9bccf70c A |
232 | struct session; |
233 | struct pgrp; | |
234 | struct proc; | |
55e303ae | 235 | #endif /* !__APPLE_API_PRIVATE */ |
9bccf70c A |
236 | |
237 | #ifdef __APPLE_API_UNSTABLE | |
1c79356b A |
238 | /* Exported fields for kern sysctls */ |
239 | struct extern_proc { | |
9bccf70c A |
240 | union { |
241 | struct { | |
242 | struct proc *__p_forw; /* Doubly-linked run/sleep queue. */ | |
243 | struct proc *__p_back; | |
244 | } p_st1; | |
245 | struct timeval __p_starttime; /* process start time */ | |
246 | } p_un; | |
247 | #define p_forw p_un.p_st1.__p_forw | |
248 | #define p_back p_un.p_st1.__p_back | |
249 | #define p_starttime p_un.__p_starttime | |
1c79356b A |
250 | struct vmspace *p_vmspace; /* Address space. */ |
251 | struct sigacts *p_sigacts; /* Signal actions, state (PROC ONLY). */ | |
252 | int p_flag; /* P_* flags. */ | |
253 | char p_stat; /* S* process status. */ | |
254 | pid_t p_pid; /* Process identifier. */ | |
255 | pid_t p_oppid; /* Save parent pid during ptrace. XXX */ | |
256 | int p_dupfd; /* Sideways return value from fdopen. XXX */ | |
257 | /* Mach related */ | |
258 | caddr_t user_stack; /* where user stack was allocated */ | |
259 | void *exit_thread; /* XXX Which thread is exiting? */ | |
260 | int p_debugger; /* allow to debug */ | |
261 | boolean_t sigwait; /* indication to suspend */ | |
262 | /* scheduling */ | |
263 | u_int p_estcpu; /* Time averaged value of p_cpticks. */ | |
264 | int p_cpticks; /* Ticks of cpu time. */ | |
265 | fixpt_t p_pctcpu; /* %cpu for this process during p_swtime */ | |
266 | void *p_wchan; /* Sleep address. */ | |
267 | char *p_wmesg; /* Reason for sleep. */ | |
268 | u_int p_swtime; /* Time swapped in or out. */ | |
269 | u_int p_slptime; /* Time since last blocked. */ | |
270 | struct itimerval p_realtimer; /* Alarm timer. */ | |
271 | struct timeval p_rtime; /* Real time. */ | |
272 | u_quad_t p_uticks; /* Statclock hits in user mode. */ | |
273 | u_quad_t p_sticks; /* Statclock hits in system mode. */ | |
274 | u_quad_t p_iticks; /* Statclock hits processing intr. */ | |
275 | int p_traceflag; /* Kernel trace points. */ | |
276 | struct vnode *p_tracep; /* Trace to vnode. */ | |
9bccf70c | 277 | int p_siglist; /* DEPRECATED */ |
1c79356b A |
278 | struct vnode *p_textvp; /* Vnode of executable. */ |
279 | int p_holdcnt; /* If non-zero, don't swap. */ | |
9bccf70c | 280 | sigset_t p_sigmask; /* DEPRECATED. */ |
1c79356b A |
281 | sigset_t p_sigignore; /* Signals being ignored. */ |
282 | sigset_t p_sigcatch; /* Signals being caught by user. */ | |
283 | u_char p_priority; /* Process priority. */ | |
284 | u_char p_usrpri; /* User-priority based on p_cpu and p_nice. */ | |
285 | char p_nice; /* Process "nice" value. */ | |
286 | char p_comm[MAXCOMLEN+1]; | |
287 | struct pgrp *p_pgrp; /* Pointer to process group. */ | |
288 | struct user *p_addr; /* Kernel virtual addr of u-area (PROC ONLY). */ | |
289 | u_short p_xstat; /* Exit status for wait; also stop signal. */ | |
290 | u_short p_acflag; /* Accounting flags. */ | |
291 | struct rusage *p_ru; /* Exit information. XXX */ | |
292 | }; | |
293 | ||
294 | #define p_session p_pgrp->pg_session | |
295 | #define p_pgid p_pgrp->pg_id | |
296 | ||
297 | /* Status values. */ | |
298 | #define SIDL 1 /* Process being created by fork. */ | |
299 | #define SRUN 2 /* Currently runnable. */ | |
300 | #define SSLEEP 3 /* Sleeping on an address. */ | |
301 | #define SSTOP 4 /* Process debugging or suspension. */ | |
302 | #define SZOMB 5 /* Awaiting collection by parent. */ | |
303 | ||
304 | /* These flags are kept in p_flags. */ | |
305 | #define P_ADVLOCK 0x00001 /* Process may hold a POSIX advisory lock. */ | |
306 | #define P_CONTROLT 0x00002 /* Has a controlling terminal. */ | |
307 | #define P_INMEM 0x00004 /* Loaded into memory. */ | |
308 | #define P_NOCLDSTOP 0x00008 /* No SIGCHLD when children stop. */ | |
309 | #define P_PPWAIT 0x00010 /* Parent is waiting for child to exec/exit. */ | |
310 | #define P_PROFIL 0x00020 /* Has started profiling. */ | |
311 | #define P_SELECT 0x00040 /* Selecting; wakeup/waiting danger. */ | |
312 | #define P_SINTR 0x00080 /* Sleep is interruptible. */ | |
313 | #define P_SUGID 0x00100 /* Had set id privileges since last exec. */ | |
314 | #define P_SYSTEM 0x00200 /* System proc: no sigs, stats or swapping. */ | |
315 | #define P_TIMEOUT 0x00400 /* Timing out during sleep. */ | |
316 | #define P_TRACED 0x00800 /* Debugged process being traced. */ | |
317 | #define P_WAITED 0x01000 /* Debugging process has waited for child. */ | |
318 | #define P_WEXIT 0x02000 /* Working on exiting. */ | |
319 | #define P_EXEC 0x04000 /* Process called exec. */ | |
320 | ||
1c79356b A |
321 | /* Should be moved to machine-dependent areas. */ |
322 | #define P_OWEUPC 0x08000 /* Owe process an addupc() call at next ast. */ | |
323 | ||
55e303ae A |
324 | #define P_AFFINITY 0x0010000 /* xxx */ |
325 | #define P_CLASSIC 0x0020000 /* xxx */ | |
326 | /* | |
327 | #define P_FSTRACE 0x10000 / * tracing via file system (elsewhere?) * / | |
328 | #define P_SSTEP 0x20000 / * process needs single-step fixup ??? * / | |
329 | */ | |
1c79356b A |
330 | |
331 | #define P_WAITING 0x0040000 /* process has a wait() in progress */ | |
332 | #define P_KDEBUG 0x0080000 /* kdebug tracing is on for this process */ | |
333 | #define P_TTYSLEEP 0x0100000 /* blocked due to SIGTTOU or SIGTTIN */ | |
334 | #define P_REBOOT 0x0200000 /* Process called reboot() */ | |
335 | #define P_TBE 0x0400000 /* Process is TBE */ | |
9bccf70c | 336 | #define P_SIGEXC 0x0800000 /* signal exceptions */ |
0b4e3aa0 A |
337 | #define P_BTRACE 0x1000000 /* process is being branch traced */ |
338 | #define P_VFORK 0x2000000 /* process has vfork children */ | |
9bccf70c | 339 | #define P_NOATTACH 0x4000000 |
0b4e3aa0 | 340 | #define P_INVFORK 0x8000000 /* proc in vfork */ |
9bccf70c A |
341 | #define P_NOSHLIB 0x10000000 /* no shared libs are in use for proc */ |
342 | /* flag set on exec */ | |
343 | #define P_FORCEQUOTA 0x20000000 /* Force quota for root */ | |
344 | #define P_NOCLDWAIT 0x40000000 /* No zombies when chil procs exit */ | |
55e303ae | 345 | #define P_NOREMOTEHANG 0x80000000 /* Don't hang on remote FS ops */ |
0b4e3aa0 | 346 | |
9bccf70c | 347 | #define P_NOSWAP 0 /* Obsolete: retained so that nothing breaks */ |
55e303ae A |
348 | #define P_PHYSIO 0 /* Obsolete: retained so that nothing breaks */ |
349 | #define P_FSTRACE 0 /* Obsolete: retained so that nothing breaks */ | |
350 | #define P_SSTEP 0 /* Obsolete: retained so that nothing breaks */ | |
1c79356b A |
351 | |
352 | /* | |
353 | * Shareable process credentials (always resident). This includes a reference | |
354 | * to the current user credentials as well as real and saved ids that may be | |
355 | * used to change ids. | |
356 | */ | |
357 | struct pcred { | |
358 | struct lock__bsd__ pc_lock; | |
359 | struct ucred *pc_ucred; /* Current credentials. */ | |
360 | uid_t p_ruid; /* Real user id. */ | |
361 | uid_t p_svuid; /* Saved effective user id. */ | |
362 | gid_t p_rgid; /* Real group id. */ | |
363 | gid_t p_svgid; /* Saved effective group id. */ | |
364 | int p_refcnt; /* Number of references. */ | |
365 | }; | |
366 | ||
367 | #define pcred_readlock(p) lockmgr(&(p)->p_cred->pc_lock, \ | |
368 | LK_SHARED, 0, (p)) | |
369 | #define pcred_writelock(p) lockmgr(&(p)->p_cred->pc_lock, \ | |
370 | LK_EXCLUSIVE, 0, (p)) | |
371 | #define pcred_unlock(p) lockmgr(&(p)->p_cred->pc_lock, \ | |
372 | LK_RELEASE, 0, (p)) | |
9bccf70c | 373 | #endif /* __APPLE_API_UNSTABLE */ |
1c79356b A |
374 | |
375 | #ifdef KERNEL | |
376 | ||
377 | __BEGIN_DECLS | |
9bccf70c | 378 | #ifdef __APPLE_API_PRIVATE |
1c79356b A |
379 | /* |
380 | * We use process IDs <= PID_MAX; PID_MAX + 1 must also fit in a pid_t, | |
381 | * as it is used to represent "no process group". | |
382 | */ | |
9bccf70c | 383 | extern int nprocs, maxproc; /* Current and max number of procs. */ |
55e303ae | 384 | __private_extern__ int hard_maxproc; /* hard limit */ |
9bccf70c | 385 | |
1c79356b A |
386 | #define PID_MAX 30000 |
387 | #define NO_PID 30001 | |
388 | ||
389 | #define SESS_LEADER(p) ((p)->p_session->s_leader == (p)) | |
390 | #define SESSHOLD(s) ((s)->s_count++) | |
391 | #define SESSRELE(s) sessrele(s) | |
392 | ||
393 | #define PIDHASH(pid) (&pidhashtbl[(pid) & pidhash]) | |
394 | extern LIST_HEAD(pidhashhead, proc) *pidhashtbl; | |
395 | extern u_long pidhash; | |
396 | ||
397 | #define PGRPHASH(pgid) (&pgrphashtbl[(pgid) & pgrphash]) | |
398 | extern LIST_HEAD(pgrphashhead, pgrp) *pgrphashtbl; | |
399 | extern u_long pgrphash; | |
400 | ||
1c79356b A |
401 | LIST_HEAD(proclist, proc); |
402 | extern struct proclist allproc; /* List of all processes. */ | |
403 | extern struct proclist zombproc; /* List of zombie processes. */ | |
404 | extern struct proc *initproc, *kernproc; | |
9bccf70c A |
405 | extern void pgdelete __P((struct pgrp *pgrp)); |
406 | extern void sessrele __P((struct session *sess)); | |
407 | extern void procinit __P((void)); | |
408 | #endif /* __APPLE_API_PRIVATE */ | |
409 | ||
410 | #ifdef __APPLE_API_UNSTABLE | |
1c79356b A |
411 | |
412 | extern struct proc *pfind __P((pid_t)); /* Find process by id. */ | |
55e303ae | 413 | __private_extern__ struct proc *pzfind(pid_t); /* Find zombie by id. */ |
1c79356b A |
414 | extern struct pgrp *pgfind __P((pid_t)); /* Find process group by id. */ |
415 | ||
416 | extern int chgproccnt __P((uid_t uid, int diff)); | |
417 | extern int enterpgrp __P((struct proc *p, pid_t pgid, int mksess)); | |
418 | extern void fixjobc __P((struct proc *p, struct pgrp *pgrp, int entering)); | |
419 | extern int inferior __P((struct proc *p)); | |
420 | extern int leavepgrp __P((struct proc *p)); | |
9bccf70c | 421 | #ifdef __APPLE_API_OBSOLETE |
1c79356b | 422 | extern void mi_switch __P((void)); |
9bccf70c | 423 | #endif /* __APPLE_API_OBSOLETE */ |
1c79356b A |
424 | extern void resetpriority __P((struct proc *)); |
425 | extern void setrunnable __P((struct proc *)); | |
426 | extern void setrunqueue __P((struct proc *)); | |
427 | extern int sleep __P((void *chan, int pri)); | |
428 | extern int tsleep __P((void *chan, int pri, char *wmesg, int timo)); | |
9bccf70c A |
429 | extern int tsleep0 __P((void *chan, int pri, char *wmesg, int timo, int (*continuation)(int))); |
430 | extern int tsleep1 __P((void *chan, int pri, char *wmesg, u_int64_t abstime, int (*continuation)(int))); | |
1c79356b A |
431 | extern void unsleep __P((struct proc *)); |
432 | extern void wakeup __P((void *chan)); | |
9bccf70c A |
433 | #endif /* __APPLE_API_UNSTABLE */ |
434 | ||
1c79356b A |
435 | __END_DECLS |
436 | ||
9bccf70c A |
437 | #ifdef __APPLE_API_OBSOLETE |
438 | /* FreeBSD source compatibility macro */ | |
439 | #define PRISON_CHECK(p1, p2) (1) | |
440 | #endif /* __APPLE_API_OBSOLETE */ | |
441 | ||
1c79356b A |
442 | #endif /* KERNEL */ |
443 | ||
444 | #endif /* !_SYS_PROC_H_ */ |