X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/91447636331957f3d9b5ca5b508f07c526b0074d..89b3af67bb32e691275bf6fa803d1834b2284115:/bsd/sys/proc_internal.h diff --git a/bsd/sys/proc_internal.h b/bsd/sys/proc_internal.h index 6d7c06111..d3806e04c 100644 --- a/bsd/sys/proc_internal.h +++ b/bsd/sys/proc_internal.h @@ -1,23 +1,29 @@ /* * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. * - * @APPLE_LICENSE_HEADER_END@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* Copyright (c) 1995, 1997 Apple Computer, Inc. All Rights Reserved */ /*- @@ -93,7 +99,7 @@ struct pgrp { struct proc; -#define PROC_NULL (struct proc *)0; +#define PROC_NULL (struct proc *)0 #define p_session p_pgrp->pg_session #define p_pgid p_pgrp->pg_id @@ -182,6 +188,7 @@ struct proc { u_char p_usrpri; /* User-priority based on p_cpu and p_nice. */ char p_nice; /* Process "nice" value. */ char p_comm[MAXCOMLEN+1]; + char p_name[(2*MAXCOMLEN)+1]; struct pgrp *p_pgrp; /* Pointer to process group. */ @@ -222,7 +229,9 @@ struct proc { unsigned int p_fdlock_pc[4]; unsigned int p_fdunlock_pc[4]; int p_fpdrainwait; - int p_lflag; /* local flags */ + unsigned int p_lflag; /* local flags */ + unsigned int p_ladvflag; /* local adv flags*/ + unsigned int p_internalref; /* temp refcount field */ #if DIAGNOSTIC #if SIGNAL_DEBUG unsigned int lockpc[8]; @@ -232,11 +241,20 @@ struct proc { }; +/* local flags */ #define P_LDELAYTERM 0x1 /* */ #define P_LNOZOMB 0x2 /* */ #define P_LLOW_PRI_IO 0x4 #define P_LPEXIT 0x8 #define P_LBACKGROUND_IO 0x10 +#define P_LWAITING 0x20 +#define P_LREFDRAIN 0x40 +#define P_LREFDRAINWAIT 0x80 +#define P_LREFDEAD 0x100 +#define P_LTHSIGSTACK 0x200 + +/* advisory flags in the proc */ +#define P_LADVLOCK 0x01 // LP64todo - should this move? /* LP64 version of extern_proc. all pointers @@ -248,10 +266,6 @@ struct proc { #ifdef KERNEL #include /* user_timeval, user_itimerval */ -#if __DARWIN_ALIGN_NATURAL -#pragma options align=natural -#endif - struct user_extern_proc { union { struct { @@ -268,7 +282,7 @@ struct user_extern_proc { pid_t p_oppid; /* Save parent pid during ptrace. XXX */ int p_dupfd; /* Sideways return value from fdopen. XXX */ /* Mach related */ - user_addr_t user_stack; /* where user stack was allocated */ + user_addr_t user_stack __attribute((aligned(8))); /* where user stack was allocated */ user_addr_t exit_thread; /* XXX Which thread is exiting? */ int p_debugger; /* allow to debug */ boolean_t sigwait; /* indication to suspend */ @@ -276,7 +290,7 @@ struct user_extern_proc { u_int p_estcpu; /* Time averaged value of p_cpticks. */ int p_cpticks; /* Ticks of cpu time. */ fixpt_t p_pctcpu; /* %cpu for this process during p_swtime */ - user_addr_t p_wchan; /* Sleep address. */ + user_addr_t p_wchan __attribute((aligned(8))); /* Sleep address. */ user_addr_t p_wmesg; /* Reason for sleep. */ u_int p_swtime; /* Time swapped in or out. */ u_int p_slptime; /* Time since last blocked. */ @@ -286,9 +300,9 @@ struct user_extern_proc { u_quad_t p_sticks; /* Statclock hits in system mode. */ u_quad_t p_iticks; /* Statclock hits processing intr. */ int p_traceflag; /* Kernel trace points. */ - user_addr_t p_tracep; /* Trace to vnode. */ + user_addr_t p_tracep __attribute((aligned(8))); /* Trace to vnode. */ int p_siglist; /* DEPRECATED */ - user_addr_t p_textvp; /* Vnode of executable. */ + user_addr_t p_textvp __attribute((aligned(8))); /* Vnode of executable. */ int p_holdcnt; /* If non-zero, don't swap. */ sigset_t p_sigmask; /* DEPRECATED. */ sigset_t p_sigignore; /* Signals being ignored. */ @@ -297,16 +311,12 @@ struct user_extern_proc { u_char p_usrpri; /* User-priority based on p_cpu and p_nice. */ char p_nice; /* Process "nice" value. */ char p_comm[MAXCOMLEN+1]; - user_addr_t p_pgrp; /* Pointer to process group. */ + user_addr_t p_pgrp __attribute((aligned(8))); /* Pointer to process group. */ user_addr_t p_addr; /* Kernel virtual addr of u-area (PROC ONLY). */ u_short p_xstat; /* Exit status for wait; also stop signal. */ u_short p_acflag; /* Accounting flags. */ - user_addr_t p_ru; /* Exit information. XXX */ + user_addr_t p_ru __attribute((aligned(8))); /* Exit information. XXX */ }; - -#if __DARWIN_ALIGN_NATURAL -#pragma options align=reset -#endif #endif /* KERNEL */ /* @@ -314,6 +324,7 @@ struct user_extern_proc { * as it is used to represent "no process group". */ extern int nprocs, maxproc; /* Current and max number of procs. */ +extern int maxprocperuid; /* Current number of procs per uid */ __private_extern__ int hard_maxproc; /* hard limit */ #define PID_MAX 30000 @@ -364,6 +375,9 @@ extern int tsleep0(void *chan, int pri, const char *wmesg, int timo, int (*conti extern int tsleep1(void *chan, int pri, const char *wmesg, u_int64_t abstime, int (*continuation)(int)); extern int msleep0(void *chan, lck_mtx_t *mtx, int pri, const char *wmesg, int timo, int (*continuation)(int)); extern void vfork_return(thread_t th_act, struct proc *p, struct proc *p2, register_t *retval); - +extern struct proc * proc_findref(pid_t pid); +extern void proc_dropref(struct proc * p); +extern struct proc * proc_refinternal(proc_t p, int funneled); +extern void proc_dropinternal(struct proc * p, int funneled); #endif /* !_SYS_PROC_INTERNAL_H_ */