Annotation of coherent/f/usr/include/sys/proc.h, revision 1.1.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 <common/feature.h>
                     19: #include <kernel/timeout.h>
                     20: #include <sys/poll.h>
                     21: #include <sys/types.h>
                     22: #include <sys/seg.h>
                     23: #include <sys/ksynch.h>
                     24: #include <sys/signal.h>
                     25: 
                     26: #if    ! __KERNEL__
                     27: # error        You must be compiling the kernel to use this header
                     28: #endif
                     29: 
                     30: 
                     31: /*
                     32:  * Number of user segments.
                     33:  */
                     34: 
                     35: #if    _I386
                     36: 
                     37: #define NUSEG  4
                     38: #define NSHMSEG        6
                     39: 
                     40: #else
                     41: 
                     42: #define NUSEG  6
                     43: 
                     44: #endif
                     45: 
                     46: /*
                     47:  * In core information about a process.
                     48:  * The `p_lforw' and `p_lback' entries must not move as they must be
                     49:  * in the same place as in the `plink' structure.
                     50:  */
                     51: typedef struct proc {
                     52:        struct   proc *p_lforw;         /* Working forward pointer */
                     53:        struct   proc *p_lback;         /* Working backward pointer */
                     54:        struct   proc *p_nforw;         /* Next forward pointer */
                     55:        struct   proc *p_nback;         /* Next backward pointer */
                     56: #if    1
                     57:        /*
                     58:         * NIGEL: What is the +1 for ? Who can tell, but it is never, ever,
                     59:         * actually used.
                     60:         */
                     61:        struct seg    * p_segp [NUSEG]; /* Segments */
                     62: #else
                     63:        struct   seg  *p_segp[NUSEG+1]; /* Segments */
                     64: #endif
                     65:        unsigned p_pid;                 /* Process id */
                     66:        unsigned p_ppid;                /* Process id of parent */
                     67:        unsigned p_uid;                 /* Effective uid */
                     68:        unsigned p_ruid;                /* Real uid */
                     69:        unsigned p_rgid;                /* Real gid */
                     70:        unsigned p_state;               /* Scheduling state */
                     71:        unsigned p_flags;               /* Flags */
                     72: 
                     73: /*
                     74:  * NIGEL: New deal for signals; the old stuff appears lower in the file.
                     75:  */
                     76:        __sigset_t      p_pending_signals;
                     77:        __sigset_t      p_ignored_signals;
                     78:        __sigset_t      p_signal_mask;
                     79:        __sigset_t      p_queued_signals;
                     80:        __sigmiscfl_t   p_sigflags;     /* General signal flags */
                     81: 
                     82:        char     *p_event;              /* Wakeup event channel */
                     83:        unsigned p_alarm;               /* Timer for alarms */
                     84:        unsigned p_group;               /* Process group */
                     85:        dev_t    p_ttdev;               /* Controlling terminal */
                     86:        unsigned p_nice;                /* Nice value */
                     87: #if    _I386
                     88:        int      p_schedPri;            /* will index into table in sys/ts.h */
                     89: #else
                     90:        unsigned p_cval;                /* Cpu schedule value */
                     91:        unsigned p_sval;                /* Swap schedule value */
                     92:        int      p_ival;                /* Importance value */
                     93:        unsigned p_rval;                /* Response value */
                     94:        unsigned p_lctim;               /* Last time cval was updated */
                     95: #endif
                     96:        long     p_utime;               /* User time (HZ) */
                     97:        long     p_stime;               /* System time */
                     98:        long     p_cutime;              /* Sum of childs user time */
                     99:        long     p_cstime;              /* Sum of childs system time */
                    100:        int      p_exit;                /* Exit status */
                    101:        event_t *p_polls;               /* Enabled polls */
                    102:        TIM      p_polltim;             /* Poll  timer */
                    103:        TIM      p_alrmtim;             /* Alarm timer */
                    104: #if    _I386
                    105:        struct   rlock *p_prl;          /* Pending record lock */
                    106:        struct   sr p_shmsr[NSHMSEG];   /* Shared Memory Segments */
                    107:        struct   sem_undo *p_semu;      /* Sem. undo link list */
                    108:        struct {
                    109:                char    _space [32];
                    110:        } p_ddi_space;
                    111: #endif
                    112: } PROC;
                    113: 
                    114: /*
                    115:  * Segment indices.
                    116:  */
                    117: 
                    118: #if    _I386
                    119: 
                    120: #define SIUSERP        0                       /* User area segment */
                    121: #define        SISTEXT 1                       /* Shared text segment */
                    122: #define SIPDATA        2                       /* Private data segment */
                    123: #define SISTACK        3                       /* Stack segment */
                    124: #define SIAUXIL        4                       /* Auxiliary segment */
                    125: #define        SIBSS   0                       /* overlay of SIUSERP [coh/exec.c] */
                    126: 
                    127: #else
                    128: 
                    129: #define SIUSERP        0                       /* User area segment */
                    130: #define SISTACK        1                       /* Stack segment */
                    131: #define        SISTEXT 2                       /* Shared text segment */
                    132: #define SIPTEXT        3                       /* Private text segment */
                    133: #define SISDATA        4                       /* Shared data segment */
                    134: #define SIPDATA        5                       /* Private data segment */
                    135: #define SIAUXIL        6                       /* Auxiliary segment */
                    136: 
                    137: #endif /* ! _I386 */
                    138: 
                    139: /*
                    140:  * Status of process (p_state).
                    141:  */
                    142: #define PSSLEEP        1       /* Sleeping, signals do not interrupt   */
                    143: #define PSRUN  2       /* Running                              */
                    144: #define PSDEAD 3       /* Exiting                              */
                    145: #define PSSLSIG        4       /* Sleeping, signals interrupt          */
                    146: 
                    147: #define ASLEEP(pp)     (pp->p_state == PSSLEEP || pp->p_state == PSSLSIG)
                    148: 
                    149: /*
                    150:  * Flags (p_flags).
                    151:  */
                    152: #define PFCORE 0x0001                  /* Process is in core */
                    153: #define PFLOCK 0x0002                  /* Process is locked in core */
                    154: #define PFSWIO 0x0004                  /* Swap I/O in progress */
                    155: #define PFSWAP 0x0008                  /* Process is swapped out */
                    156: #define PFWAIT 0x0010                  /* Process is stopped (not waited) */
                    157: #define PFSTOP 0x0020                  /* Process is stopped (waited on) */
                    158: #define PFTRAC 0x0040                  /* Process is being traced */
                    159: #define PFKERN 0x0080                  /* Kernel process */
                    160: #define PFAUXM 0x0100                  /* Auxiliary segments in memory */
                    161: #define PFDISP 0x0200                  /* Dispatch at earliest convenience */
                    162: #define PFNDMP 0x0400                  /* Command mode forbids dump */
                    163: 
                    164: #ifdef QWAKEUP
                    165: #define PFWAKE 0x0800                  /* Wakeup requested */
                    166: extern int     wakeup2();
                    167: extern int     ntowake;                /* Wakeup pending */
                    168: #endif
                    169: 
                    170: /*
                    171:  * Values of nice.
                    172:  */
                    173: #define MINNICE        0                       /* Minimum value of nice */
                    174: #define DEFNICE        20                      /* Default nice value */
                    175: #define MAXNICE        40                      /* Maximum nice value */
                    176: 
                    177: /*
                    178:  * Number of entries in sleep/wakeup queue.
                    179:  */
                    180: 
                    181: #if    _I386
                    182: #define        NHPLINK 97
                    183: #else
                    184: #define        NHPLINK 32
                    185: #endif
                    186: 
                    187: /*
                    188:  * Sleep/wakeup queues.
                    189:  */
                    190: typedef struct plink {
                    191:        struct   proc *p_lforw;         /* Working forward pointer */
                    192:        struct   proc *p_lback;         /* Working backward pointer */
                    193: } PLINK;
                    194: 
                    195: #if    __KERNEL__
                    196: 
                    197: #define SELF           cprocp
                    198: 
                    199: #if    ! _I386
                    200: #define p_u            p_segp[SIUSERP]
                    201: #endif
                    202: 
                    203: /*
                    204:  * Functions.
                    205:  */
                    206: extern int     idle();
                    207: extern int     wakeup();
                    208: #if    ! _I386
                    209: extern PROC    *process();
                    210: #endif
                    211: 
                    212: /*
                    213:  * Global variables.
                    214:  */
                    215: extern int     quantum;                /* Current quantum */
                    216: extern int     disflag;                /* Dispatch soon as possible */
                    217: extern int     intflag;                /* We are in an interrupt */
                    218: extern int     cpid;                   /* Current process id */
                    219: extern GATE    pnxgate;                /* Gate for p_next */
                    220: extern PROC    procq;                  /* Process queue */
                    221: extern PROC    *iprocp;                /* Idle process struct */
                    222: extern PROC    *eprocp;                /* Init process struct */
                    223: extern PROC    *cprocp;                /* Current process */
                    224: extern PLINK   linkq[NHPLINK];         /* Sleep/wakeup hash queue */
                    225: 
                    226: #ifndef NOMONITOR
                    227: extern int     swmflag;                /* Monitor swapper */
                    228: #endif
                    229: 
                    230: /*
                    231:  * Function to hash a wakeup channel.
                    232:  * Most channels are even.
                    233:  */
                    234: 
                    235: #if    _I386
                    236: #define hash(e)        ((unsigned)(e) % NHPLINK)
                    237: #else
                    238: #define hash(e)        ((((unsigned)(e))>>1)%NHPLINK)
                    239: #endif
                    240: 
                    241: #endif /* __KERNEL__ */
                    242: 
                    243: #endif /* ! defined (__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.