Annotation of 42BSD/sys/h/proc.h, revision 1.1.1.1

1.1       root        1: /*     proc.h  6.1     83/07/29        */
                      2: 
                      3: /*
                      4:  * One structure allocated per active
                      5:  * process. It contains all data needed
                      6:  * about the process while the
                      7:  * process may be swapped out.
                      8:  * Other per process data (user.h)
                      9:  * is swapped with the process.
                     10:  */
                     11: struct proc {
                     12:        struct  proc *p_link;   /* linked list of running processes */
                     13:        struct  proc *p_rlink;
                     14:        struct  pte *p_addr;    /* u-area kernel map address */
                     15:        char    p_usrpri;       /* user-priority based on p_cpu and p_nice */
                     16:        char    p_pri;          /* priority, negative is high */
                     17:        char    p_cpu;          /* cpu usage for scheduling */
                     18:        char    p_stat;
                     19:        char    p_time;         /* resident time for scheduling */
                     20:        char    p_nice;         /* nice for cpu usage */
                     21:        char    p_slptime;      /* time since last block */
                     22:        char    p_cursig;
                     23:        int     p_sig;          /* signals pending to this process */
                     24:        int     p_sigmask;      /* current signal mask */
                     25:        int     p_sigignore;    /* signals being ignored */
                     26:        int     p_sigcatch;     /* signals being caught by user */
                     27:        int     p_flag;
                     28:        short   p_uid;          /* user id, used to direct tty signals */
                     29:        short   p_pgrp;         /* name of process group leader */
                     30:        short   p_pid;          /* unique process id */
                     31:        short   p_ppid;         /* process id of parent */
                     32:        u_short p_xstat;        /* Exit status for wait */
                     33:        struct  rusage *p_ru;   /* mbuf holding exit information */
                     34:        short   p_poip;         /* page outs in progress */
                     35:        short   p_szpt;         /* copy of page table size */
                     36:        size_t  p_tsize;        /* size of text (clicks) */
                     37:        size_t  p_dsize;        /* size of data space (clicks) */
                     38:        size_t  p_ssize;        /* copy of stack size (clicks) */
                     39:        size_t  p_rssize;       /* current resident set size in clicks */
                     40:        size_t  p_maxrss;       /* copy of u.u_limit[MAXRSS] */
                     41:        size_t  p_swrss;        /* resident set size before last swap */
                     42:        swblk_t p_swaddr;       /* disk address of u area when swapped */
                     43:        caddr_t p_wchan;        /* event process is awaiting */
                     44:        struct  text *p_textp;  /* pointer to text structure */
                     45:        struct  pte *p_p0br;    /* page table base P0BR */
                     46:        struct  proc *p_xlink;  /* linked list of procs sharing same text */
                     47:        short   p_cpticks;      /* ticks of cpu time */
                     48:        float   p_pctcpu;       /* %cpu for this process during p_time */
                     49:        short   p_ndx;          /* proc index for memall (because of vfork) */
                     50:        short   p_idhash;       /* hashed based on p_pid for kill+exit+... */
                     51:        struct  proc *p_pptr;   /* pointer to process structure of parent */
                     52:        struct  proc *p_cptr;   /* pointer to youngest living child */
                     53:        struct  proc *p_osptr;  /* pointer to older sibling processes */
                     54:        struct  proc *p_ysptr;  /* pointer to younger siblings */
                     55:        struct  itimerval p_realtimer;
                     56:        struct  quota *p_quota; /* quotas for this process */
                     57: };
                     58: 
                     59: #define        PIDHSZ          63
                     60: #define        PIDHASH(pid)    ((pid) % PIDHSZ)
                     61: 
                     62: #ifdef KERNEL
                     63: short  pidhash[PIDHSZ];
                     64: struct proc *pfind();
                     65: struct proc *proc, *procNPROC; /* the proc table itself */
                     66: int    nproc;
                     67: 
                     68: #define        NQS     32              /* 32 run queues */
                     69: struct prochd {
                     70:        struct  proc *ph_link;  /* linked list of running processes */
                     71:        struct  proc *ph_rlink;
                     72: } qs[NQS];
                     73: int    whichqs;                /* bit mask summarizing non-empty qs's */
                     74: #endif
                     75: 
                     76: /* stat codes */
                     77: #define        SSLEEP  1               /* awaiting an event */
                     78: #define        SWAIT   2               /* (abandoned state) */
                     79: #define        SRUN    3               /* running */
                     80: #define        SIDL    4               /* intermediate state in process creation */
                     81: #define        SZOMB   5               /* intermediate state in process termination */
                     82: #define        SSTOP   6               /* process being traced */
                     83: 
                     84: /* flag codes */
                     85: #define        SLOAD   0x0000001       /* in core */
                     86: #define        SSYS    0x0000002       /* swapper or pager process */
                     87: #define        SLOCK   0x0000004       /* process being swapped out */
                     88: #define        SSWAP   0x0000008       /* save area flag */
                     89: #define        STRC    0x0000010       /* process is being traced */
                     90: #define        SWTED   0x0000020       /* another tracing flag */
                     91: #define        SULOCK  0x0000040       /* user settable lock in core */
                     92: #define        SPAGE   0x0000080       /* process in page wait state */
                     93: #define        SKEEP   0x0000100       /* another flag to prevent swap out */
                     94: #define        SOMASK  0x0000200       /* restore old mask after taking signal */
                     95: #define        SWEXIT  0x0000400       /* working on exiting */
                     96: #define        SPHYSIO 0x0000800       /* doing physical i/o (bio.c) */
                     97: #define        SVFORK  0x0001000       /* process resulted from vfork() */
                     98: #define        SVFDONE 0x0002000       /* another vfork flag */
                     99: #define        SNOVM   0x0004000       /* no vm, parent in a vfork() */
                    100: #define        SPAGI   0x0008000       /* init data space on demand, from inode */
                    101: #define        SSEQL   0x0010000       /* user warned of sequential vm behavior */
                    102: #define        SUANOM  0x0020000       /* user warned of random vm behavior */
                    103: #define        STIMO   0x0040000       /* timing out during sleep */
                    104: /* was SDETACH */
                    105: #define        SOUSIG  0x0100000       /* using old signal mechanism */
                    106: #define        SOWEUPC 0x0200000       /* owe process an addupc() call at next ast */
                    107: #define        SSEL    0x0400000       /* selecting; wakeup/waiting danger */
                    108: #define        SLOGIN  0x0800000       /* a login process (legit child of init) */
                    109: #define        SPTECHG 0x1000000       /* pte's for process have changed */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.