-#include <sys/audit.h>
-
-#ifdef __APPLE_API_PRIVATE
-
-/*
- * 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. */
- pid_t s_sid; /* Session ID */
- 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_shutdownstate;
- char p_pad1[2];
-
- 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; /* DEPRECATED (Time swapped in or out.) */
-#define p_argslen p_swtime /* Length of process arguments. */
- 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; /* DEPRECATED. */
-
- 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;
-
-/* The following fields are all copied upon creation in fork. */
-#define p_startcopy p_sigmask
-
- sigset_t p_sigmask; /* DEPRECATED */
- 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_xstat
-
- u_short p_xstat; /* Exit status for wait; also stop signal. */
- u_short p_acflag; /* Accounting flags. */
- struct rusage *p_ru; /* Exit information. XXX */