Annotation of 41BSD/sys/h/proc.h, revision 1.1

1.1     ! root        1: /*     proc.h  4.1     11/9/80 */
        !             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:  * NB: OFFSETS HERE ARE ALSO DEFINED IN proc.m
        !            12:  */
        !            13: struct proc
        !            14: {
        !            15:        struct  proc *p_link;   /* linked list of running processes */
        !            16:        struct  proc *p_rlink;
        !            17:        struct  pte *p_addr;    /* u-area kernel map address */
        !            18:        char    p_usrpri;       /* user-priority based on p_cpu and p_nice */
        !            19:        char    p_pri;          /* priority, negative is high */
        !            20:        char    p_cpu;          /* cpu usage for scheduling */
        !            21:        char    p_stat;
        !            22:        char    p_time;         /* resident time for scheduling */
        !            23:        char    p_nice;         /* nice for cpu usage */
        !            24:        char    p_slptime;      /* time since last block */
        !            25:        char    p_cursig;
        !            26:        long    p_sig;          /* signals pending to this process */
        !            27:        long    p_siga0;        /* low bit of 2 bit signal action */
        !            28:        long    p_siga1;        /* high bit of 2 bit signal action */
        !            29: #define        p_ignsig p_siga0        /* ignored signal mask */
        !            30:        int     p_flag;
        !            31:        short   p_uid;          /* user id, used to direct tty signals */
        !            32:        short   p_pgrp;         /* name of process group leader */
        !            33:        short   p_pid;          /* unique process id */
        !            34:        short   p_ppid;         /* process id of parent */
        !            35:        short   p_poip;         /* count of page outs in progress */
        !            36:        short   p_szpt;         /* copy of page table size */
        !            37:        size_t  p_tsize;        /* size of text (clicks) */
        !            38:        size_t  p_dsize;        /* size of data space (clicks) */
        !            39:        size_t  p_ssize;        /* copy of stack size (clicks) */
        !            40:        size_t  p_rssize;       /* current resident set size in clicks */
        !            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:        int     p_clktim;       /* time to alarm clock signal */
        !            46:        struct  pte *p_p0br;    /* page table base P0BR */
        !            47:        struct  proc *p_xlink;  /* linked list of procs sharing same text */
        !            48:        short   p_cpticks;      /* ticks of cpu time */
        !            49:        float   p_pctcpu;       /* %cpu for this process during p_time */
        !            50:        short   p_ndx;          /* proc index for memall (because of vfork) */
        !            51:        short   p_idhash;       /* hashed based on p_pid for kill+exit+... */
        !            52:        struct  proc *p_pptr;   /* pointer to process structure of parent */
        !            53: };
        !            54: 
        !            55: #define        PIDHSZ          63
        !            56: #define        PIDHASH(pid)    ((pid) % PIDHSZ)
        !            57: 
        !            58: #ifdef KERNEL
        !            59: short  pidhash[PIDHSZ];
        !            60: 
        !            61: struct proc *pfind();
        !            62: #endif
        !            63: 
        !            64: #ifdef KERNEL
        !            65: extern struct proc proc[];     /* the proc table itself */
        !            66: 
        !            67: #ifdef FASTVAX
        !            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: #else
        !            75: struct proc *runq;
        !            76: #endif
        !            77: #endif
        !            78: 
        !            79: /* stat codes */
        !            80: #define        SSLEEP  1               /* awaiting an event */
        !            81: #define        SWAIT   2               /* (abandoned state) */
        !            82: #define        SRUN    3               /* running */
        !            83: #define        SIDL    4               /* intermediate state in process creation */
        !            84: #define        SZOMB   5               /* intermediate state in process termination */
        !            85: #define        SSTOP   6               /* process being traced */
        !            86: 
        !            87: /* flag codes */
        !            88: #define        SLOAD   0x000001        /* in core */
        !            89: #define        SSYS    0x000002        /* swapper or pager process */
        !            90: #define        SLOCK   0x000004        /* process being swapped out */
        !            91: #define        SSWAP   0x000008        /* save area flag */
        !            92: #define        STRC    0x000010        /* process is being traced */
        !            93: #define        SWTED   0x000020        /* another tracing flag */
        !            94: #define        SULOCK  0x000040        /* user settable lock in core */
        !            95: #define        SPAGE   0x000080        /* process in page wait state */
        !            96: #define        SKEEP   0x000100        /* another flag to prevent swap out */
        !            97: #define        SDLYU   0x000200        /* delayed unlock of pages */
        !            98: #define        SWEXIT  0x000400        /* working on exiting */
        !            99: #define        SPHYSIO 0x000800        /* doing physical i/o (bio.c) */
        !           100: #define        SVFORK  0x001000        /* process resulted from vfork() */
        !           101: #define        SVFDONE 0x002000        /* another vfork flag */
        !           102: #define        SNOVM   0x004000        /* no vm, parent in a vfork() */
        !           103: #define        SPAGI   0x008000        /* init data space on demand, from inode */
        !           104: #define        SANOM   0x010000        /* system detected anomalous vm behavior */
        !           105: #define        SUANOM  0x020000        /* user warned of anomalous vm behavior */
        !           106: #define        STIMO   0x040000        /* timing out during sleep */
        !           107: #define        SDETACH 0x080000        /* detached inherited by init */
        !           108: #define        SNUSIG  0x100000        /* using new signal mechanism */
        !           109: 
        !           110: /*
        !           111:  * parallel proc structure
        !           112:  * to replace part with times
        !           113:  * to be passed to parent process
        !           114:  * in ZOMBIE state.
        !           115:  *
        !           116:  * THIS SHOULD BE DONE WITH A union() CONSTRUCTION
        !           117:  */
        !           118: struct xproc
        !           119: {
        !           120:        struct  proc *xp_link;
        !           121:        struct  proc *xp_rlink;
        !           122:        struct  pte *xp_addr;
        !           123:        char    xp_usrpri;
        !           124:        char    xp_pri;         /* priority, negative is high */
        !           125:        char    xp_cpu;         /* cpu usage for scheduling */
        !           126:        char    xp_stat;
        !           127:        char    xp_time;        /* resident time for scheduling */
        !           128:        char    xp_nice;        /* nice for cpu usage */
        !           129:        char    xp_slptime;
        !           130:        char    p_cursig;
        !           131:        int     xp_sig;         /* signals pending to this process */
        !           132:        int     xp_siga0;
        !           133:        int     xp_siga1;
        !           134:        int     xp_flag;
        !           135:        short   xp_uid;         /* user id, used to direct tty signals */
        !           136:        short   xp_pgrp;        /* name of process group leader */
        !           137:        short   xp_pid;         /* unique process id */
        !           138:        short   xp_ppid;        /* process id of parent */
        !           139:        short   xp_xstat;       /* Exit status for wait */
        !           140:        struct  vtimes xp_vm;
        !           141: };

unix.superglobalmegacorp.com

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