Annotation of 43BSDTahoe/sys/h/proc.h, revision 1.1.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.2 (Berkeley) 10/13/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: #if defined(tahoe)
                     66:        int     p_ckey;         /* code cache key */
                     67:        int     p_dkey;         /* data cache key */
                     68: #endif
                     69: };
                     70: 
                     71: #define        PIDHSZ          64
                     72: #define        PIDHASH(pid)    ((pid) & (PIDHSZ - 1))
                     73: 
                     74: #ifdef KERNEL
                     75: short  pidhash[PIDHSZ];
                     76: struct proc *pfind();
                     77: struct proc *proc, *procNPROC; /* the proc table itself */
                     78: struct proc *freeproc, *zombproc, *allproc;
                     79:                        /* lists of procs in various states */
                     80: int    nproc;
                     81: 
                     82: #define        NQS     32              /* 32 run queues */
                     83: struct prochd {
                     84:        struct  proc *ph_link;  /* linked list of running processes */
                     85:        struct  proc *ph_rlink;
                     86: } qs[NQS];
                     87: int    whichqs;                /* bit mask summarizing non-empty qs's */
                     88: #endif
                     89: 
                     90: /* stat codes */
                     91: #define        SSLEEP  1               /* awaiting an event */
                     92: #define        SWAIT   2               /* (abandoned state) */
                     93: #define        SRUN    3               /* running */
                     94: #define        SIDL    4               /* intermediate state in process creation */
                     95: #define        SZOMB   5               /* intermediate state in process termination */
                     96: #define        SSTOP   6               /* process being traced */
                     97: 
                     98: /* flag codes */
                     99: #define        SLOAD   0x0000001       /* in core */
                    100: #define        SSYS    0x0000002       /* swapper or pager process */
                    101: #define        SLOCK   0x0000004       /* process being swapped out */
                    102: #define        SSWAP   0x0000008       /* save area flag */
                    103: #define        STRC    0x0000010       /* process is being traced */
                    104: #define        SWTED   0x0000020       /* another tracing flag */
                    105: #define        SULOCK  0x0000040       /* user settable lock in core */
                    106: #define        SPAGE   0x0000080       /* process in page wait state */
                    107: #define        SKEEP   0x0000100       /* another flag to prevent swap out */
                    108: #define        SOMASK  0x0000200       /* restore old mask after taking signal */
                    109: #define        SWEXIT  0x0000400       /* working on exiting */
                    110: #define        SPHYSIO 0x0000800       /* doing physical i/o (bio.c) */
                    111: #define        SVFORK  0x0001000       /* process resulted from vfork() */
                    112: #define        SVFDONE 0x0002000       /* another vfork flag */
                    113: #define        SNOVM   0x0004000       /* no vm, parent in a vfork() */
                    114: #define        SPAGI   0x0008000       /* init data space on demand, from inode */
                    115: #define        SSEQL   0x0010000       /* user warned of sequential vm behavior */
                    116: #define        SUANOM  0x0020000       /* user warned of random vm behavior */
                    117: #define        STIMO   0x0040000       /* timing out during sleep */
                    118: /* was SDETACH */
                    119: #define        SOUSIG  0x0100000       /* using old signal mechanism */
                    120: #define        SOWEUPC 0x0200000       /* owe process an addupc() call at next ast */
                    121: #define        SSEL    0x0400000       /* selecting; wakeup/waiting danger */
                    122: #define        SLOGIN  0x0800000       /* a login process (legit child of init) */
                    123: #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.