Annotation of 41BSD/4.0.upgrade/sys/h/proc.h, revision 1.1.1.1

1.1       root        1: /*     proc.h  4.8     81/04/23        */
                      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: {
                     13:        struct  proc *p_link;   /* linked list of running processes */
                     14:        struct  proc *p_rlink;
                     15:        struct  pte *p_addr;    /* u-area kernel map address */
                     16:        char    p_usrpri;       /* user-priority based on p_cpu and p_nice */
                     17:        char    p_pri;          /* priority, negative is high */
                     18:        char    p_cpu;          /* cpu usage for scheduling */
                     19:        char    p_stat;
                     20:        char    p_time;         /* resident time for scheduling */
                     21:        char    p_nice;         /* nice for cpu usage */
                     22:        char    p_slptime;      /* time since last block */
                     23:        char    p_cursig;
                     24:        long    p_sig;          /* signals pending to this process */
                     25:        long    p_siga0;        /* low bit of 2 bit signal action */
                     26:        long    p_siga1;        /* high bit of 2 bit signal action */
                     27: #define        p_ignsig p_siga0        /* ignored signal mask */
                     28:        int     p_flag;
                     29:        short   p_uid;          /* user id, used to direct tty signals */
                     30:        short   p_pgrp;         /* name of process group leader */
                     31:        short   p_pid;          /* unique process id */
                     32:        short   p_ppid;         /* process id of parent */
                     33:        short   p_poip;         /* count of page outs in progress */
                     34:        short   p_szpt;         /* copy of page table size */
                     35:        size_t  p_tsize;        /* size of text (clicks) */
                     36:        size_t  p_dsize;        /* size of data space (clicks) */
                     37:        size_t  p_ssize;        /* copy of stack size (clicks) */
                     38:        size_t  p_rssize;       /* current resident set size in clicks */
                     39:        size_t  p_maxrss;       /* copy of u.u_limit[MAXRSS] */
                     40:        size_t  p_swrss;        /* resident set size before last swap */
                     41:        swblk_t p_swaddr;       /* disk address of u area when swapped */
                     42:        caddr_t p_wchan;        /* event process is awaiting */
                     43:        struct  text *p_textp;  /* pointer to text structure */
                     44:        int     p_clktim;       /* time to alarm clock signal */
                     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: };
                     53: 
                     54: #define        PIDHSZ          63
                     55: #define        PIDHASH(pid)    ((pid) % PIDHSZ)
                     56: 
                     57: #ifdef KERNEL
                     58: short  pidhash[PIDHSZ];
                     59: 
                     60: struct proc *pfind();
                     61: #endif
                     62: 
                     63: #ifdef KERNEL
                     64: struct proc *proc, *procNPROC; /* the proc table itself */
                     65: int    nproc;
                     66: 
                     67: #define        NQS     32              /* 32 run queues */
                     68: struct prochd {
                     69:        struct  proc *ph_link;  /* linked list of running processes */
                     70:        struct  proc *ph_rlink;
                     71: } qs[NQS];
                     72: int    whichqs;                /* bit mask summarizing non-empty qs's */
                     73: #endif
                     74: 
                     75: /* stat codes */
                     76: #define        SSLEEP  1               /* awaiting an event */
                     77: #define        SWAIT   2               /* (abandoned state) */
                     78: #define        SRUN    3               /* running */
                     79: #define        SIDL    4               /* intermediate state in process creation */
                     80: #define        SZOMB   5               /* intermediate state in process termination */
                     81: #define        SSTOP   6               /* process being traced */
                     82: 
                     83: /* flag codes */
                     84: #define        SLOAD   0x000001        /* in core */
                     85: #define        SSYS    0x000002        /* swapper or pager process */
                     86: #define        SLOCK   0x000004        /* process being swapped out */
                     87: #define        SSWAP   0x000008        /* save area flag */
                     88: #define        STRC    0x000010        /* process is being traced */
                     89: #define        SWTED   0x000020        /* another tracing flag */
                     90: #define        SULOCK  0x000040        /* user settable lock in core */
                     91: #define        SPAGE   0x000080        /* process in page wait state */
                     92: #define        SKEEP   0x000100        /* another flag to prevent swap out */
                     93: #define        SDLYU   0x000200        /* delayed unlock of pages */
                     94: #define        SWEXIT  0x000400        /* working on exiting */
                     95: #define        SPHYSIO 0x000800        /* doing physical i/o (bio.c) */
                     96: #define        SVFORK  0x001000        /* process resulted from vfork() */
                     97: #define        SVFDONE 0x002000        /* another vfork flag */
                     98: #define        SNOVM   0x004000        /* no vm, parent in a vfork() */
                     99: #define        SPAGI   0x008000        /* init data space on demand, from inode */
                    100: #define        SSEQL   0x010000        /* user warned of sequential vm behavior */
                    101: #define        SUANOM  0x020000        /* user warned of random vm behavior */
                    102: #define        STIMO   0x040000        /* timing out during sleep */
                    103: #define        SDETACH 0x080000        /* detached inherited by init */
                    104: #define        SNUSIG  0x100000        /* using new signal mechanism */
                    105: #define        SOWEUPC 0x200000        /* owe process an addupc() call at next ast */
                    106: 
                    107: /*
                    108:  * parallel proc structure
                    109:  * to replace part with times
                    110:  * to be passed to parent process
                    111:  * in ZOMBIE state.
                    112:  *
                    113:  * THIS SHOULD BE DONE WITH A union() CONSTRUCTION
                    114:  */
                    115: struct xproc
                    116: {
                    117:        struct  proc *xp_link;
                    118:        struct  proc *xp_rlink;
                    119:        struct  pte *xp_addr;
                    120:        char    xp_usrpri;
                    121:        char    xp_pri;         /* priority, negative is high */
                    122:        char    xp_cpu;         /* cpu usage for scheduling */
                    123:        char    xp_stat;
                    124:        char    xp_time;        /* resident time for scheduling */
                    125:        char    xp_nice;        /* nice for cpu usage */
                    126:        char    xp_slptime;
                    127:        char    p_cursig;
                    128:        int     xp_sig;         /* signals pending to this process */
                    129:        int     xp_siga0;
                    130:        int     xp_siga1;
                    131:        int     xp_flag;
                    132:        short   xp_uid;         /* user id, used to direct tty signals */
                    133:        short   xp_pgrp;        /* name of process group leader */
                    134:        short   xp_pid;         /* unique process id */
                    135:        short   xp_ppid;        /* process id of parent */
                    136:        short   xp_xstat;       /* Exit status for wait */
                    137:        struct  vtimes xp_vm;
                    138: };

unix.superglobalmegacorp.com

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