-#define NQS 32 /* 32 run queues */
-struct prochd {
- struct proc *ph_link; /* linked list of running processes */
- struct proc *ph_rlink;
-} qs[NQS];
-int whichqs; /* bit mask summarizing non-empty qs's */
-#endif
-
-/* stat codes */
-#define SSLEEP 1 /* awaiting an event */
-#define SWAIT 2 /* (abandoned state) */
-#define SRUN 3 /* running */
-#define SIDL 4 /* intermediate state in process creation */
-#define SZOMB 5 /* intermediate state in process termination */
-#define SSTOP 6 /* process being traced */
-
-/* flag codes */
-#define SLOAD 0x000001 /* in core */
-#define SSYS 0x000002 /* swapper or pager process */
-#define SLOCK 0x000004 /* process being swapped out */
-#define SSWAP 0x000008 /* save area flag */
-#define STRC 0x000010 /* process is being traced */
-#define SWTED 0x000020 /* another tracing flag */
-#define SULOCK 0x000040 /* user settable lock in core */
-#define SPAGE 0x000080 /* process in page wait state */
-#define SKEEP 0x000100 /* another flag to prevent swap out */
-#define SDLYU 0x000200 /* delayed unlock of pages */
-#define SWEXIT 0x000400 /* working on exiting */
-#define SPHYSIO 0x000800 /* doing physical i/o (bio.c) */
-#define SVFORK 0x001000 /* process resulted from vfork() */
-#define SVFDONE 0x002000 /* another vfork flag */
-#define SNOVM 0x004000 /* no vm, parent in a vfork() */
-#define SPAGI 0x008000 /* init data space on demand, from inode */
-#define SSEQL 0x010000 /* user warned of sequential vm behavior */
-#define SUANOM 0x020000 /* user warned of random vm behavior */
-#define STIMO 0x040000 /* timing out during sleep */
-#define SDETACH 0x080000 /* detached inherited by init */
-#define SNUSIG 0x100000 /* using new signal mechanism */
-#define SOWEUPC 0x200000 /* owe process an addupc() call at next ast */
+ int p_flag; /* P_* flags. */
+ char p_stat; /* S* process status. */
+ char p_pad1[3];
+
+ pid_t p_pid; /* Process identifier. */
+ LIST_ENTRY(proc) p_pglist; /* List of processes in pgrp. */
+ struct proc *p_pptr; /* Pointer to parent process. */
+ LIST_ENTRY(proc) p_sibling; /* List of sibling processes. */
+ LIST_HEAD(, proc) p_children; /* Pointer to list of children. */
+
+/* The following fields are all zeroed upon creation in fork. */
+#define p_startzero p_oppid
+
+ pid_t p_oppid; /* Save parent pid during ptrace. XXX */
+ int p_dupfd; /* Sideways return value from fdopen. XXX */
+
+ /* scheduling */
+ 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 */
+ void *p_wchan; /* Sleep address. */
+ char *p_wmesg; /* Reason for sleep. */
+ u_int p_swtime; /* Time swapped in or out. */
+ u_int p_slptime; /* Time since last blocked. */
+
+ struct itimerval p_realtimer; /* Alarm timer. */
+ struct timeval p_rtime; /* Real time. */
+ u_quad_t p_uticks; /* Statclock hits in user mode. */
+ 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. */
+ struct vnode *p_tracep; /* Trace to vnode. */
+
+ int p_siglist; /* Signals arrived but not delivered. */
+
+ struct vnode *p_textvp; /* Vnode of executable. */
+
+ short p_locks; /* DEBUG: lockmgr count of held locks */
+ short p_simple_locks; /* DEBUG: count of held simple locks */
+ long p_spare[2]; /* pad to 256, avoid shifting eproc. */
+
+/* End area that is zeroed on creation. */
+#define p_endzero p_hash.le_next
+
+ /*
+ * Not copied, not zero'ed.
+ * Belongs after p_pid, but here to avoid shifting proc elements.
+ */
+ LIST_ENTRY(proc) p_hash; /* Hash chain. */
+
+/* The following fields are all copied upon creation in fork. */
+#define p_startcopy p_sigmask
+
+ sigset_t p_sigmask; /* Current signal mask. */
+ sigset_t p_sigignore; /* Signals being ignored. */
+ sigset_t p_sigcatch; /* Signals being caught by user. */
+
+ u_char p_priority; /* Process priority. */
+ u_char p_usrpri; /* User-priority based on p_cpu and p_nice. */
+ char p_nice; /* Process "nice" value. */
+ char p_comm[MAXCOMLEN+1];
+
+ struct pgrp *p_pgrp; /* Pointer to process group. */
+
+/* End area that is copied on creation. */
+#define p_endcopy p_thread
+
+ void *p_thread; /* Id for this "thread"; Mach glue. XXX */
+ struct user *p_addr; /* Kernel virtual addr of u-area (PROC ONLY). */
+ struct mdproc p_md; /* Any machine-dependent fields. */
+
+ u_short p_xstat; /* Exit status for wait; also stop signal. */
+ u_short p_acflag; /* Accounting flags. */
+ struct rusage *p_ru; /* Exit information. XXX */
+};
+
+#define p_session p_pgrp->pg_session
+#define p_pgid p_pgrp->pg_id
+
+/* Status values. */
+#define SIDL 1 /* Process being created by fork. */
+#define SRUN 2 /* Currently runnable. */
+#define SSLEEP 3 /* Sleeping on an address. */
+#define SSTOP 4 /* Process debugging or suspension. */
+#define SZOMB 5 /* Awaiting collection by parent. */
+
+/* These flags are kept in p_flags. */
+#define P_ADVLOCK 0x00001 /* Process may hold a POSIX advisory lock. */
+#define P_CONTROLT 0x00002 /* Has a controlling terminal. */
+#define P_INMEM 0x00004 /* Loaded into memory. */
+#define P_NOCLDSTOP 0x00008 /* No SIGCHLD when children stop. */
+#define P_PPWAIT 0x00010 /* Parent is waiting for child to exec/exit. */
+#define P_PROFIL 0x00020 /* Has started profiling. */
+#define P_SELECT 0x00040 /* Selecting; wakeup/waiting danger. */
+#define P_SINTR 0x00080 /* Sleep is interruptible. */
+#define P_SUGID 0x00100 /* Had set id privileges since last exec. */
+#define P_SYSTEM 0x00200 /* System proc: no sigs, stats or swapping. */
+#define P_TIMEOUT 0x00400 /* Timing out during sleep. */
+#define P_TRACED 0x00800 /* Debugged process being traced. */
+#define P_WAITED 0x01000 /* Debugging process has waited for child. */
+#define P_WEXIT 0x02000 /* Working on exiting. */
+#define P_EXEC 0x04000 /* Process called exec. */
+
+/* Should probably be changed into a hold count. */
+#define P_NOSWAP 0x08000 /* Another flag to prevent swap out. */
+#define P_PHYSIO 0x10000 /* Doing physical I/O. */
+
+/* Should be moved to machine-dependent areas. */
+#define P_OWEUPC 0x20000 /* Owe process an addupc() call at next ast. */