Annotation of researchv8dc/sys/h/proc.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * One structure allocated per active
                      3:  * process. It contains all data needed
                      4:  * about the process while the
                      5:  * process may be swapped out.
                      6:  * Other per process data (user.h)
                      7:  * is swapped with the process.
                      8:  */
                      9: struct proc
                     10: {
                     11:        struct  proc *p_link;   /* linked list of running processes */
                     12:        struct  proc *p_rlink;  /* (used by hardware q instructions) */
                     13:        struct  pte *p_addr;    /* u-area kernel map address */
                     14:        char    p_usrpri;       /* user-priority based on p_cpu and p_nice */
                     15:        char    p_pri;          /* priority, negative is high */
                     16:        char    p_cpu;          /* cpu usage for scheduling */
                     17:        char    p_stat;
                     18:        char    p_time;         /* resident time for scheduling */
                     19:        char    p_nice;         /* nice for cpu usage */
                     20:        char    p_slptime;      /* time since last block */
                     21:        char    p_cursig;
                     22:        long    p_sig;          /* signals pending to this process */
                     23:        long    p_siga0;        /* low bit of 2 bit signal action */
                     24:        long    p_siga1;        /* high bit of 2 bit signal action */
                     25: #define        p_ignsig p_siga0        /* ignored signal mask */
                     26:        int     p_flag;
                     27:        short   p_uid;          /* user id, used to direct tty signals */
                     28:        short   p_pgrp;         /* name of process group leader */
                     29:        short   p_pid;          /* unique process id */
                     30:        short   p_ppid;         /* process id of parent */
                     31:        short   p_poip;         /* count of page outs in progress */
                     32:        short   p_szpt;         /* copy of page table size */
                     33:        size_t  p_tsize;        /* size of text (clicks) */
                     34:        size_t  p_dsize;        /* size of data space (clicks) */
                     35:        size_t  p_ssize;        /* copy of stack size (clicks) */
                     36:        size_t  p_rssize;       /* current resident set size in clicks */
                     37:        size_t  p_maxrss;       /* copy of u.u_limit[MAXRSS] */
                     38:        size_t  p_swrss;        /* resident set size before last swap */
                     39:        swblk_t p_swaddr;       /* disk address of u area when swapped */
                     40:        caddr_t p_wchan;        /* event process is awaiting */
                     41:        struct  text *p_textp;  /* pointer to text structure */
                     42:        u_short p_clktim;       /* time to alarm clock signal */
                     43:        u_short p_tsleep;       /* time to tsleep */
                     44:        struct  pte *p_p0br;    /* page table base P0BR */
                     45:        struct  proc *p_xlink;  /* linked list of procs sharing same text */
                     46:        short   p_cpticks;      /* ticks of cpu time */
                     47:        float   p_pctcpu;       /* %cpu for this process during p_time */
                     48:        short   p_ndx;          /* proc index for memall (because of vfork) */
                     49:        short   p_idhash;       /* hashed based on p_pid for kill+exit+... */
                     50:        struct  proc *p_pptr;   /* pointer to process structure of parent */
                     51:        struct  inode *p_trace; /* inode for new process tracing stuff */
                     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   0x00000001      /* in core */
                     85: #define        SSYS    0x00000002      /* swapper or pager process */
                     86: #define        SLOCK   0x00000004      /* process being swapped out */
                     87: #define        SSWAP   0x00000008      /* save area flag */
                     88: #define        STRC    0x00000010      /* process is being traced */
                     89: #define        SWTED   0x00000020      /* another tracing flag */
                     90: #define        SULOCK  0x00000040      /* user settable lock in core */
                     91: #define        SPAGE   0x00000080      /* process in page wait state */
                     92: #define        SKEEP   0x00000100      /* another flag to prevent swap out */
                     93: #define        SDLYU   0x00000200      /* delayed unlock of pages */
                     94: #define        SWEXIT  0x00000400      /* working on exiting */
                     95: #define        SPHYSIO 0x00000800      /* doing physical i/o (bio.c) */
                     96: #define        SVFORK  0x00001000      /* process resulted from vfork() */
                     97: #define        SVFDONE 0x00002000      /* another vfork flag */
                     98: #define        SNOVM   0x00004000      /* no vm, parent in a vfork() */
                     99: #define        SPAGI   0x00008000      /* init data space on demand, from inode */
                    100: #define        SSEQL   0x00010000      /* user warned of sequential vm behavior */
                    101: #define        SUANOM  0x00020000      /* user warned of random vm behavior */
                    102: #define        STIMO   0x00040000      /* timing out during sleep */
                    103: #define        SDETACH 0x00080000      /* detached inherited by init */
                    104: #define        SNUSIG  0x00100000      /* using new signal mechanism */
                    105: #define        SOWEUPC 0x00200000      /* owe process an addupc() call at next ast */
                    106: #define        SSEL    0x00400000      /* selecting: wakeup/waiting danger */
                    107: #define        SPROCTR 0x00800000      /* tracing via /proc */
                    108: #define        SPROCIO 0x01000000      /* doing I/O via /proc, so don't swap */
                    109: #define        SSEXEC  0x02000000      /* stop on exec */
                    110: 
                    111: #define PTRACED(p)     ((p)->p_trace || ((p)->p_flag&(STRC|SPROCTR|SSEXEC)))
                    112: 
                    113: /*
                    114:  * parallel proc structure
                    115:  * to replace part with times
                    116:  * to be passed to parent process
                    117:  * in ZOMBIE state.
                    118:  *
                    119:  * THIS SHOULD BE DONE WITH A union() CONSTRUCTION
                    120:  */
                    121: struct xproc
                    122: {
                    123:        struct  proc *xp_link;
                    124:        struct  proc *xp_rlink;
                    125:        struct  pte *xp_addr;
                    126:        char    xp_usrpri;
                    127:        char    xp_pri;         /* priority, negative is high */
                    128:        char    xp_cpu;         /* cpu usage for scheduling */
                    129:        char    xp_stat;
                    130:        char    xp_time;        /* resident time for scheduling */
                    131:        char    xp_nice;        /* nice for cpu usage */
                    132:        char    xp_slptime;
                    133:        char    p_cursig;
                    134:        int     xp_sig;         /* signals pending to this process */
                    135:        int     xp_siga0;
                    136:        int     xp_siga1;
                    137:        int     xp_flag;
                    138:        short   xp_uid;         /* user id, used to direct tty signals */
                    139:        short   xp_pgrp;        /* name of process group leader */
                    140:        short   xp_pid;         /* unique process id */
                    141:        short   xp_ppid;        /* process id of parent */
                    142:        short   xp_xstat;       /* Exit status for wait */
                    143:        struct  vtimes xp_vm;
                    144: };

unix.superglobalmegacorp.com

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