home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 202.img / SCO386N2.TD0 / usr / include / sys / proc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-07-13  |  5.6 KB  |  174 lines

  1. /*
  2.  *    @(#) proc.h 2.6 88/07/13 
  3.  *
  4.  *    Copyright (C) The Santa Cruz Operation, 1984, 1985, 1986, 1987, 1988.
  5.  *    Copyright (C) Microsoft Corporation, 1984, 1985, 1986, 1987, 1988.
  6.  *    This Module contains Proprietary Information of
  7.  *    The Santa Cruz Operation, Microsoft Corporation
  8.  *    and AT&T, and should be treated as Confidential.
  9.  */
  10.  
  11. /*
  12.  * One structure allocated per active process. It contains all data needed
  13.  * about the process while the process may be swapped out.
  14.  * Other per process data (user.h) is swapped with the process.
  15.  */
  16.  
  17. struct proc {
  18.     char    p_stat;
  19. #ifndef M_I386
  20.     char    p_flag;
  21. #endif
  22.     char    p_pri;        /* priority, negative is high */
  23.     char    p_time;        /* resident time for scheduling */
  24.     char    p_cpu;        /* cpu usage for scheduling */
  25.     char    p_nice;        /* nice for cpu usage */
  26.     ushort    p_uid;        /* real user id */
  27.     ushort    p_suid;        /* set (effective) user id */
  28.     ushort    p_sgid;        /* set (effective) group id */
  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. #ifdef M_I386
  33.     unsigned int p_flag;    
  34. #endif
  35.     long    p_sig;        /* signals pending to this process */
  36. #ifdef M_I386
  37.     int    p_hold;        /* hold signal bit mask */
  38.     int    p_chold;    /* defer signal bit mask */
  39.                 /* sigset turns on this bit */
  40.                 /* signal does not turn on this bit */
  41.     struct tabent p_addr[MAXUSIZE]; /* page table entries for u-area */
  42.     int p_wsize;        /* working set size */
  43. #define    p_uaddr    p_addr        /* used by resume */
  44. #else
  45.     union {
  46.         unsigned short p_daddr;    /* block number of u on swap */
  47.         mloc_t    p_caddr;    /* location of p_usize region in core */
  48.     } p_addr;
  49. #define    p_uaddr    p_addr.p_caddr    /* used by resume */
  50. #endif
  51.     unsigned short p_fcsel;  /* first code selector */
  52.     unsigned short p_fdsel;  /* first data selector */
  53.     unsigned short p_ldsel;  /* last data selector */
  54.     short    p_tsize;     /* size of text (used by exec/swapin) */
  55.     short    p_ssize;     /* size of stack (used by exec/swapin) */
  56.     unsigned short p_lsize;  /* size in bytes of the ldt: 286 only */
  57.     msize_t    p_usize;     /* size of u + ldts + ldtinfo seg: 286 only */
  58. #ifdef M_I386
  59.     inodep_t p_iptr;    /* pointer to inode of prototype */
  60. #else
  61.     struct text *p_textp;    /* pointer to text structure */
  62. #endif
  63.     struct proc *p_link;    /* linked list of running processes */
  64.     union {
  65.         caddr_t    p_cad;
  66.         int    p_int;
  67.     } p_unw;
  68. #define    p_wchan    p_unw.p_cad
  69. #define    p_arg    p_unw.p_int
  70.     int    p_clktim;    /* time to alarm clock signal */
  71.     struct sd *p_sdp;     /* pointer to list of shared data segments */
  72. #ifdef M_I386
  73.     caddr_t p_smbeg;     /* start of shared data */
  74.     caddr_t p_smend;     /* last byte of shared data */
  75. #ifdef VPIX
  76.     struct  v86dat *p_v86;    /* pointer to v86 structure */
  77. #else
  78.     caddr_t p_v86;        /* pointer to v86 structure */
  79. #endif
  80.     int p_dummy0;        /*  reserved 0 */
  81.     int p_dummy1;        /*  reserved 1 */
  82.     int p_dummy2;        /*  reserved 2 */
  83. #endif
  84. };
  85.  
  86. extern struct proc proc[];    /* the proc table itself */
  87.  
  88. #ifdef M_I8086
  89. #define p_size         p_usize       /* re-use field for other purpose */
  90. #define p_cflags     p_lsize
  91. #endif
  92.  
  93. /* stat codes */
  94. #define    SSLEEP    1        /* awaiting an event */
  95. #define    SWAIT    2        /* (abandoned state) */
  96. #define    SRUN    3        /* running */
  97. #define    SIDL    4        /* intermediate state in process creation */
  98. #define    SZOMB    5        /* intermediate state in process termination */
  99. #define    SSTOP    6        /* process being traced */
  100. #define    SXBRK    7        /* process being xswapped */
  101. #define    SXSTK    8        /* process being xswapped */
  102. #define    SXTXT    9        /* process being xswapped */
  103.  
  104. /* flag codes */
  105. #define    SLOAD    01        /* in core */
  106. #define    SSYS    02        /* scheduling process */
  107. #define    SLOCK    04        /* process cannot be swapped */
  108. #define    SSWAP    010        /* process is being swapped out */
  109. #define    STRC    020        /* process is being traced */
  110. #define    SWTED    040        /* another tracing flag */
  111. #define    STEXT    0100        /* text pointer valid */
  112. #define    SSCAN    0200        /* process has been scanned since last swapin */
  113.  
  114. #ifdef M_I386
  115. #define    SPOLL        0400    /* process in stream poll */
  116. #define SSEL       SPOLL    /* or doing select() (see SPOLL) */
  117. #define SNWAKE      001000    /* Process cannot wakeup by a signal */
  118. #define SREQLK   0x10000    /* process requests it not be swapped */
  119. #define SHAD2SWP 0x20000    /* process swapped anyway, despite request */
  120. #define SPARTOUT 0x40000    /* tried to swap out, but had locked page */
  121. #endif
  122.  
  123. /* contiguity flags */
  124. #define    SCSTACK    01
  125. #define    SCDATA    02
  126. #define SCWANT    04
  127. #define SCLDATA 010
  128. #define SCLTEXT 020
  129.  
  130. /*
  131.  * parallel proc structure
  132.  * to replace part with times
  133.  * to be passed to parent process
  134.  * in ZOMBIE state.
  135.  */
  136.  
  137. struct    xproc {
  138.     char    xp_stat;
  139. #ifndef M_I386
  140.     char    xp_flag;
  141. #endif
  142.     char    xp_pri;        /* priority, negative is high */
  143.     char    xp_time;    /* resident time for scheduling */
  144.     char    xp_cpu;        /* cpu usage for scheduling */
  145.     char    xp_nice;    /* nice for cpu usage */
  146.     ushort    xp_uid;        /* real user id */
  147.     ushort    xp_suid;    /* set (effective) user id */
  148.     ushort    xp_sgid;    /* set (effective) group id */
  149.     short    xp_pgrp;    /* name of process group leader */
  150.     short    xp_pid;        /* unique process id */
  151.     short    xp_ppid;    /* process id of parent */
  152. #ifdef M_I386
  153.     unsigned int xp_flag;    
  154. #endif
  155.     long    xp_sig;        /* signals pending to this process */
  156. #ifdef M_I386
  157.     int    xp_hold;    /* hold signal bit mask */
  158.     int    xp_chold;    /* defer signal bit mask */
  159.                 /* sigset turns on this bit */
  160.                 /* signal does not turn on this bit */
  161.     struct tabent xp_addr[MAXUSIZE]; /* page table entries for u-area */
  162.     int xp_wsize;        /* working set size */
  163. #else
  164.     union {
  165.         unsigned short xp_daddr;/* block number of u on swap */
  166.         mloc_t    xp_caddr;/* location of p_usize region in core */
  167.     } xp_addr;
  168. #endif
  169.     short    xp_xstat;    /* Exit status for wait */
  170.     time_t    xp_utime;    /* user time, this proc */
  171.     time_t    xp_stime;    /* system time, this proc */
  172. };
  173.  
  174.