-/*
- * One structure allocated per session.
- */
-struct session {
- int s_count; /* Ref cnt; pgrps in session. */
- struct proc *s_leader; /* Session leader. */
- struct vnode *s_ttyvp; /* Vnode of controlling terminal. */
- struct tty *s_ttyp; /* Controlling terminal. */
- char s_login[MAXLOGNAME]; /* Setlogin() name. */
-};
-
-/*
- * One structure allocated per process group.
- */
-struct pgrp {
- LIST_ENTRY(pgrp) pg_hash; /* Hash chain. */
- LIST_HEAD(, proc) pg_members; /* Pointer to pgrp members. */
- struct session *pg_session; /* Pointer to session. */
- pid_t pg_id; /* Pgrp id. */
- int pg_jobc; /* # procs qualifying pgrp for job control */
-};
-
-/*
- * Description of a process.
- *
- * This structure contains the information needed to manage a thread of
- * control, known in UN*X as a process; it has references to substructures
- * containing descriptions of things that the process uses, but may share
- * with related processes. The process structure and the substructures
- * are always addressible except for those marked "(PROC ONLY)" below,
- * which might be addressible only on a processor on which the process
- * is running.
- */
-struct proc {
- 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 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. */
-
- sigset_t p_siglist; /* Signals arrived but not delivered. */
-
- struct vnode *p_textvp; /* Vnode of executable. */
-
-/* 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. */
- TAILQ_HEAD( ,eventqelt) p_evlist;