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

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