Annotation of coherent/f/usr/include.78/sys/proc.h, revision 1.1

1.1     ! root        1: /* (-lgl
        !             2:  *     COHERENT Version 4.0
        !             3:  *     Copyright (c) 1982, 1992 by Mark Williams Company.
        !             4:  *     All rights reserved. May not be copied without permission.
        !             5:  -lgl) */
        !             6: /*
        !             7:  * /usr/include/sys/proc.h
        !             8:  *
        !             9:  * Process information.  PROC structs, unlike UPROC structs, are visible
        !            10:  * whether the process is active or not.
        !            11:  *
        !            12:  * Revised: Wed May 12 09:48:19 1993 CDT
        !            13:  */
        !            14: 
        !            15: #ifndef __SYS_PROC_H__
        !            16: #define        __SYS_PROC_H__
        !            17: 
        !            18: #include <sys/types.h>
        !            19: #include <poll.h>
        !            20: #include <sys/timeout.h>
        !            21: #include <sys/seg.h>
        !            22: 
        !            23: #include <sys/ksynch.h>
        !            24: 
        !            25: /*
        !            26:  * NIGEL: For some reason, the "sig_t" type was defined in <sys/types.h>
        !            27:  * instead of here where it belongs.
        !            28:  */
        !            29: 
        !            30: typedef        long            sig_t;
        !            31: 
        !            32: 
        !            33: /*
        !            34:  * Number of user segments.
        !            35:  */
        !            36: #ifdef _I386
        !            37: #define NUSEG  4
        !            38: #define NSHMSEG        6
        !            39: #else
        !            40: #define NUSEG  6
        !            41: #endif
        !            42: 
        !            43: /*
        !            44:  * In core information about a process.
        !            45:  * The `p_lforw' and `p_lback' entries must not move as they must be
        !            46:  * in the same place as in the `plink' structure.
        !            47:  */
        !            48: typedef struct proc {
        !            49:        struct   proc *p_lforw;         /* Working forward pointer */
        !            50:        struct   proc *p_lback;         /* Working backward pointer */
        !            51:        struct   proc *p_nforw;         /* Next forward pointer */
        !            52:        struct   proc *p_nback;         /* Next backward pointer */
        !            53:        struct   seg  *p_segp[NUSEG+1]; /* Segments */
        !            54:        unsigned p_pid;                 /* Process id */
        !            55:        unsigned p_ppid;                /* Process id of parent */
        !            56:        unsigned p_uid;                 /* Effective uid */
        !            57:        unsigned p_ruid;                /* Real uid */
        !            58:        unsigned p_rgid;                /* Real gid */
        !            59:        unsigned p_state;               /* Scheduling state */
        !            60:        unsigned p_flags;               /* Flags */
        !            61:        sig_t    p_ssig;                /* Signals which have been sent */
        !            62: 
        !            63: /* bit fields p_dfsig and p_isig are redundant with u.u_sfunc, but
        !            64:    appear in PROC data for visibility across processes. */
        !            65: 
        !            66: #ifdef _I386
        !            67:        sig_t    p_dfsig;               /* Signals which are defaulted */
        !            68:        sig_t    p_hsig;                /* Signals which are held */
        !            69:        sig_t    p_dsig;                /* Signals which are sigset */
        !            70: #endif
        !            71:        sig_t    p_isig;                /* Signals which are being ignored */
        !            72:        char     *p_event;              /* Wakeup event channel */
        !            73:        unsigned p_alarm;               /* Timer for alarms */
        !            74:        unsigned p_group;               /* Process group */
        !            75:        dev_t    p_ttdev;               /* Controlling terminal */
        !            76:        unsigned p_nice;                /* Nice value */
        !            77: #ifdef _I386
        !            78:        int      p_schedPri;            /* will index into table in sys/ts.h */
        !            79: #else
        !            80:        unsigned p_cval;                /* Cpu schedule value */
        !            81:        unsigned p_sval;                /* Swap schedule value */
        !            82:        int      p_ival;                /* Importance value */
        !            83:        unsigned p_rval;                /* Response value */
        !            84: #endif
        !            85:        unsigned p_lctim;               /* Last time cval was updated */
        !            86:        long     p_utime;               /* User time (HZ) */
        !            87:        long     p_stime;               /* System time */
        !            88:        long     p_cutime;              /* Sum of childs user time */
        !            89:        long     p_cstime;              /* Sum of childs system time */
        !            90:        int      p_exit;                /* Exit status */
        !            91:        event_t *p_polls;               /* Enabled polls */
        !            92:        TIM      p_polltim;             /* Poll  timer */
        !            93:        TIM      p_alrmtim;             /* Alarm timer */
        !            94: #ifdef _I386
        !            95:        struct   rlock *p_prl;          /* Pending record lock */
        !            96:        struct   sr p_shmsr[NSHMSEG];   /* Shared Memory Segments */
        !            97:        struct   sem_undo *p_semu;      /* Sem. undo link list */
        !            98:        char     p_nigel[16];           /* He made me do it! -hws- */
        !            99: #endif
        !           100: } PROC;
        !           101: 
        !           102: /*
        !           103:  * Segment indices.
        !           104:  */
        !           105: #ifdef _I386
        !           106: #define SIUSERP        0                       /* User area segment */
        !           107: #define        SISTEXT 1                       /* Shared text segment */
        !           108: #define SIPDATA        2                       /* Private data segment */
        !           109: #define SISTACK        3                       /* Stack segment */
        !           110: #define SIAUXIL        4                       /* Auxiliary segment */
        !           111: #define        SIBSS   0                       /* overlay of SIUSERP [coh/exec.c] */
        !           112: #else
        !           113: #define SIUSERP        0                       /* User area segment */
        !           114: #define SISTACK        1                       /* Stack segment */
        !           115: #define        SISTEXT 2                       /* Shared text segment */
        !           116: #define SIPTEXT        3                       /* Private text segment */
        !           117: #define SISDATA        4                       /* Shared data segment */
        !           118: #define SIPDATA        5                       /* Private data segment */
        !           119: #define SIAUXIL        6                       /* Auxiliary segment */
        !           120: #endif
        !           121: 
        !           122: /*
        !           123:  * Status of process (p_state).
        !           124:  */
        !           125: #define PSSLEEP        1       /* Sleeping, signals do not interrupt   */
        !           126: #define PSRUN  2       /* Running                              */
        !           127: #define PSDEAD 3       /* Exiting                              */
        !           128: #define PSSLSIG        4       /* Sleeping, signals interrupt          */
        !           129: 
        !           130: #define ASLEEP(pp)     (pp->p_state == PSSLEEP || pp->p_state == PSSLSIG)
        !           131: 
        !           132: /*
        !           133:  * Flags (p_flags).
        !           134:  */
        !           135: #define PFCORE 0x0001                  /* Process is in core */
        !           136: #define PFLOCK 0x0002                  /* Process is locked in core */
        !           137: #define PFSWIO 0x0004                  /* Swap I/O in progress */
        !           138: #define PFSWAP 0x0008                  /* Process is swapped out */
        !           139: #define PFWAIT 0x0010                  /* Process is stopped (not waited) */
        !           140: #define PFSTOP 0x0020                  /* Process is stopped (waited on) */
        !           141: #define PFTRAC 0x0040                  /* Process is being traced */
        !           142: #define PFKERN 0x0080                  /* Kernel process */
        !           143: #define PFAUXM 0x0100                  /* Auxiliary segments in memory */
        !           144: #define PFDISP 0x0200                  /* Dispatch at earliest convenience */
        !           145: #define PFNDMP 0x0400                  /* Command mode forbids dump */
        !           146: 
        !           147: #ifdef QWAKEUP
        !           148: #define PFWAKE 0x0800                  /* Wakeup requested */
        !           149: extern int     wakeup2();
        !           150: extern int     ntowake;                /* Wakeup pending */
        !           151: #endif
        !           152: 
        !           153: /*
        !           154:  * Values of nice.
        !           155:  */
        !           156: #define MINNICE        0                       /* Minimum value of nice */
        !           157: #define DEFNICE        20                      /* Default nice value */
        !           158: #define MAXNICE        40                      /* Maximum nice value */
        !           159: 
        !           160: /*
        !           161:  * Number of entries in sleep/wakeup queue.
        !           162:  */
        !           163: #ifdef _I386
        !           164: #define        NHPLINK 97
        !           165: #else
        !           166: #define        NHPLINK 32
        !           167: #endif
        !           168: 
        !           169: /*
        !           170:  * Sleep/wakeup queues.
        !           171:  */
        !           172: typedef struct plink {
        !           173:        struct   proc *p_lforw;         /* Working forward pointer */
        !           174:        struct   proc *p_lback;         /* Working backward pointer */
        !           175: } PLINK;
        !           176: #endif
        !           177: 
        !           178: #ifdef KERNEL
        !           179: 
        !           180: #define SELF           cprocp
        !           181: #define locked(gate)   ((gate)[0])
        !           182: #ifndef _I386
        !           183: #define p_u            p_segp[SIUSERP]
        !           184: #endif
        !           185: /*
        !           186:  * Functions.
        !           187:  */
        !           188: extern int     idle();
        !           189: extern PROC    *process();
        !           190: extern int     wakeup();
        !           191: 
        !           192: /*
        !           193:  * Global variables.
        !           194:  */
        !           195: extern int     quantum;                /* Current quantum */
        !           196: extern int     disflag;                /* Dispatch soon as possible */
        !           197: extern int     intflag;                /* We are in an interrupt */
        !           198: extern int     cpid;                   /* Current process id */
        !           199: extern GATE    pnxgate;                /* Gate for p_next */
        !           200: extern PROC    procq;                  /* Process queue */
        !           201: extern PROC    *iprocp;                /* Idle process struct */
        !           202: extern PROC    *eprocp;                /* Init process struct */
        !           203: extern PROC    *cprocp;                /* Current process */
        !           204: extern PLINK   linkq[NHPLINK];         /* Sleep/wakeup hash queue */
        !           205: 
        !           206: #ifndef NOMONITOR
        !           207: extern int     swmflag;                /* Monitor swapper */
        !           208: #endif
        !           209: 
        !           210: /*
        !           211:  * Function to hash a wakeup channel.
        !           212:  * Most channels are even.
        !           213:  */
        !           214: #ifdef _I386
        !           215: #define hash(e)        ((unsigned)(e) % NHPLINK)
        !           216: #else
        !           217: #define hash(e)        ((((unsigned)(e))>>1)%NHPLINK)
        !           218: #endif
        !           219: #endif
        !           220: 
        !           221: /* end of sys/proc.h */

unix.superglobalmegacorp.com

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