- struct proc *p_link; /* linked list of running processes */
- struct proc *p_rlink;
- struct proc *p_nxt; /* linked list of allocated proc slots */
- struct proc **p_prev; /* also zombies, and free proc's */
- struct pte *p_addr; /* u-area kernel map address */
- char p_usrpri; /* user-priority based on p_cpu and p_nice */
- char p_pri; /* priority, negative is high */
- char p_cpu; /* cpu usage for scheduling */
- char p_stat;
- char p_time; /* resident time for scheduling */
- char p_nice; /* nice for cpu usage */
- char p_slptime; /* time since last block */
- char p_cursig;
- int p_sig; /* signals pending to this process */
- int p_sigmask; /* current signal mask */
- int p_sigignore; /* signals being ignored */
- int p_sigcatch; /* signals being caught by user */
- int p_flag;
- uid_t p_uid; /* user id, used to direct tty signals */
- short p_pgrp; /* name of process group leader */
- short p_pid; /* unique process id */
- short p_ppid; /* process id of parent */
- u_short p_xstat; /* Exit status for wait */
- struct rusage *p_ru; /* mbuf holding exit information */
- short p_poip; /* page outs in progress */
- short p_szpt; /* copy of page table size */
- size_t p_tsize; /* size of text (clicks) */
- size_t p_dsize; /* size of data space (clicks) */
- size_t p_ssize; /* copy of stack size (clicks) */
- size_t p_rssize; /* current resident set size in clicks */
- size_t p_maxrss; /* copy of u.u_limit[MAXRSS] */
- size_t p_swrss; /* resident set size before last swap */
- swblk_t p_swaddr; /* disk address of u area when swapped */
- caddr_t p_wchan; /* event process is awaiting */
- struct text *p_textp; /* pointer to text structure */
- struct pte *p_p0br; /* page table base P0BR */
- struct proc *p_xlink; /* linked list of procs sharing same text */
- short p_cpticks; /* ticks of cpu time */
- float p_pctcpu; /* %cpu for this process during p_time */
- short p_ndx; /* proc index for memall (because of vfork) */
- short p_idhash; /* hashed based on p_pid for kill+exit+... */
- struct proc *p_pptr; /* pointer to process structure of parent */
- struct proc *p_cptr; /* pointer to youngest living child */
- struct proc *p_osptr; /* pointer to older sibling processes */
- struct proc *p_ysptr; /* pointer to younger siblings */
- struct itimerval p_realtimer;
- struct quota *p_quota; /* quotas for this process */
-#if defined(tahoe)
- int p_ckey; /* code cache key */
- int p_dkey; /* data cache key */
-#endif
+ struct proc *p_forw; /* Doubly-linked run/sleep queue. */
+ struct proc *p_back;
+ LIST_ENTRY(proc) p_list; /* List of all processes. */
+
+ /* substructures: */
+ struct pcred *p_cred; /* Process owner's identity. */
+ struct filedesc *p_fd; /* Ptr to open files structure. */
+ struct pstats *p_stats; /* Accounting/statistics (PROC ONLY). */
+ struct plimit *p_limit; /* Process limits. */
+ struct vmspace *p_vmspace; /* Address space. */
+ struct sigacts *p_sigacts; /* Signal actions, state (PROC ONLY). */
+
+#define p_ucred p_cred->pc_ucred
+#define p_rlimit p_limit->pl_rlimit
+
+ 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 */