Annotation of researchv10dc/lsys/sys/proc.h, revision 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: 
        !            10: struct proc
        !            11: {
        !            12:        struct  proc *p_link;   /* linked list of running processes */
        !            13:        struct  proc *p_rlink;  /* (used by hardware q instructions) */
        !            14:        struct  pte *p_addr;    /* u-area kernel map address */
        !            15:        unsigned char   p_usrpri;       /* user-priority based on p_cpu and p_nice */
        !            16:        char    p_pri;          /* priority, negative is high */
        !            17:        unsigned 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:        long    p_sig;          /* signals pending to this process */
        !            24:        long    p_siga0;        /* low bit of 2 bit signal action */
        !            25:        long    p_siga1;        /* high bit of 2 bit signal action */
        !            26: #define        p_ignsig p_siga0        /* ignored signal mask */
        !            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:        void    *Jp_lnode;      /* per-user scheduling */
        !            33:        float   Jp_sharepri;    /* priority based on p_nice and p_lnode->kl.l_usage */
        !            34:        short   p_poip;         /* count of page outs in progress */
        !            35:        short   p_szpt;         /* copy of page table size */
        !            36:        clicks_t        p_tsize;        /* size of text (clicks) */
        !            37:        clicks_t        p_dsize;        /* size of data space (clicks) */
        !            38:        clicks_t        p_ssize;        /* copy of stack size (clicks) */
        !            39:        clicks_t        p_rssize;       /* current resident set size in clicks */
        !            40:        clicks_t        p_maxrss;       /* copy of u.u_limit[MAXRSS] */
        !            41:        clicks_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:        unsigned short  p_clktim;       /* time to alarm clock signal */
        !            46:        unsigned short  p_tsleep;       /* time to tsleep */
        !            47:        struct  pte *p_p0br;    /* page table base P0BR */
        !            48:        struct  proc *p_xlink;  /* linked list of procs sharing same text */
        !            49:        short   p_cpticks;      /* ticks of cpu time (only for p_pctcpu) */
        !            50:        float   p_pctcpu;       /* %cpu for ps (only) */
        !            51:        short   Jp_ndx;         /* proc index for memall (because of vfork) */
        !            52:        short   Jp_idhash;      /* hashed based on p_pid for kill+exit+... */
        !            53:        struct  proc *p_pptr;   /* pointer to process structure of parent */
        !            54:        struct  inode *p_trace; /* inode for tracing, see proca.c */
        !            55: };
        !            56: 
        !            57: #ifdef KERNEL
        !            58: /*
        !            59:  * temporary expedient to clean up p_siga0/p_siga1 mess
        !            60:  */
        !            61: #define        P_SETDFL(p, mask)       (p->p_siga0&=~(mask),p->p_siga1&=~(mask))
        !            62: #define        P_SETIGN(p, mask)       (p->p_siga0|=(mask),p->p_siga1&=~(mask))
        !            63: #define        P_SETCATCH(p, mask)     (p->p_siga0&=~(mask),p->p_siga1|=(mask))
        !            64: #define        P_SETHOLD(p, mask)      (p->p_siga0|=(mask),p->p_siga1|=(mask))
        !            65: 
        !            66: #define        P_SIGVAL(p, mask)       ((int(*)())\
        !            67:        (((p->p_siga0&(mask))!=0)|(((p->p_siga1&(mask))!=0)<<1)))
        !            68: 
        !            69: #define        SIGMASK(sig)    (1<<((sig)-1))
        !            70: extern struct proc proc[];
        !            71: extern int proccnt;
        !            72: extern struct  proc *procNPROC;        /* high water mark */
        !            73: struct proc *pfind();
        !            74: 
        !            75: #define        NQS     32              /* 32 run queues */
        !            76: struct prochd {
        !            77:        struct  proc *ph_link;  /* linked list of running processes */
        !            78:        struct  proc *ph_rlink;
        !            79: } qs[NQS];
        !            80: int    whichqs;                /* bit mask summarizing non-empty qs's */
        !            81: #endif
        !            82: 
        !            83: /* stat codes */
        !            84: #define        SSLEEP  1               /* awaiting an event */
        !            85: #define        SWAIT   2               /* (abandoned state) */
        !            86: #define        SRUN    3               /* running */
        !            87: #define        SIDL    4               /* intermediate state in process creation */
        !            88: #define        SZOMB   5               /* intermediate state in process termination */
        !            89: #define        SSTOP   6               /* process being traced */
        !            90: 
        !            91: /* flag codes */
        !            92: #define        SLOAD   0x00000001      /* in core */
        !            93: #define        SSYS    0x00000002      /* swapper or pager process */
        !            94: #define        SLOCK   0x00000004      /* process being swapped out */
        !            95: #define        SSWAP   0x00000008      /* save area flag */
        !            96: #define        STRC    0x00000010      /* process is being traced */
        !            97: #define        SWTED   0x00000020      /* another tracing flag */
        !            98: #define        SULOCK  0x00000040      /* user settable lock in core */
        !            99: #define        SPAGE   0x00000080      /* process in page wait state */
        !           100: #define        SKEEP   0x00000100      /* another flag to prevent swap out */
        !           101: #define        SDLYU   0x00000200      /* delayed unlock of pages */
        !           102: #define        SWEXIT  0x00000400      /* working on exiting */
        !           103: #define        SPHYSIO 0x00000800      /* doing physical i/o (bio.c) */
        !           104: #define        SPAGI   0x00008000      /* init data space on demand, from inode */
        !           105: #define        SSEQL   0x00010000      /* user warned of sequential vm behavior */
        !           106: #define        SUANOM  0x00020000      /* user warned of random vm behavior */
        !           107: #define        STIMO   0x00040000      /* timing out during sleep */
        !           108: #define        SOWEUPC 0x00200000      /* owe process an addupc() call at next ast */
        !           109: #define        SSEL    0x00400000      /* selecting: wakeup/waiting danger */
        !           110: #define        SPROCTR 0x00800000      /* tracing via /proc */
        !           111: #define        SPROCIO 0x01000000      /* doing I/O via /proc, so don't swap */
        !           112: #define        SSEXEC  0x02000000      /* stop on exec */
        !           113: #define        SPROCWT 0x04000000      /* wanted by /proc after SPAGE */
        !           114: 
        !           115: #define PTRACED(p)     ((p)->p_trace || ((p)->p_flag&(STRC|SPROCTR|SSEXEC)))
        !           116: 
        !           117: /*
        !           118:  * special system process IDs
        !           119:  * it is assumed that proc[syspid].p_pid == syspid
        !           120:  */
        !           121: #define        SWAPPID 0       /* swapper */
        !           122: #define        INITPID 1       /* init; user process, but still special */
        !           123: #define        PAGEPID 2       /* pageout daemon */
        !           124: #define        SYSPIDS 3       /* number of system pids */
        !           125: 
        !           126: /*
        !           127:  * parallel proc structure
        !           128:  * to replace part with times
        !           129:  * to be passed to parent process
        !           130:  * in ZOMBIE state.
        !           131:  *
        !           132:  * THIS SHOULD BE DONE WITH A union() CONSTRUCTION
        !           133:  */
        !           134: struct xproc
        !           135: {
        !           136:        struct  proc *xp_link;
        !           137:        struct  proc *xp_rlink;
        !           138:        struct  pte *xp_addr;
        !           139:        char    xp_usrpri;
        !           140:        char    xp_pri;         /* priority, negative is high */
        !           141:        char    xp_cpu;         /* cpu usage for scheduling */
        !           142:        char    xp_stat;
        !           143:        char    xp_time;        /* resident time for scheduling */
        !           144:        char    xp_nice;        /* nice for cpu usage */
        !           145:        char    xp_slptime;
        !           146:        char    xp_cursig;
        !           147:        long    xp_sig;         /* signals pending to this process */
        !           148:        long    xp_siga0;
        !           149:        long    xp_siga1;
        !           150:        int     xp_flag;
        !           151:        short   xp_uid;         /* user id, used to direct tty signals */
        !           152:        short   xp_pgrp;        /* name of process group leader */
        !           153:        short   xp_pid;         /* unique process id */
        !           154:        short   xp_ppid;        /* process id of parent */
        !           155:        void    *Jxp_lnode;     /* per-user scheduling */
        !           156:        float   Jxp_sharepri;   /* priority based on p_nice and p_lnode->kl.l_usage */
        !           157:        short   xp_xstat;       /* Exit status for wait */
        !           158:        struct  vtimes xp_vm;
        !           159: };

unix.superglobalmegacorp.com

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