[4] | 1 | /* This table has one slot per process. It contains all the process management
|
---|
| 2 | * information for each process. Among other things, it defines the text, data
|
---|
| 3 | * and stack segments, uids and gids, and various flags. The kernel and file
|
---|
| 4 | * systems have tables that are also indexed by process, with the contents
|
---|
| 5 | * of corresponding slots referring to the same process in all three.
|
---|
| 6 | */
|
---|
| 7 | #include <timers.h>
|
---|
| 8 |
|
---|
| 9 | EXTERN struct mproc {
|
---|
| 10 | struct mem_map mp_seg[NR_LOCAL_SEGS]; /* points to text, data, stack */
|
---|
| 11 | char mp_exitstatus; /* storage for status when process exits */
|
---|
| 12 | char mp_sigstatus; /* storage for signal # for killed procs */
|
---|
| 13 | pid_t mp_pid; /* process id */
|
---|
| 14 | pid_t mp_procgrp; /* pid of process group (used for signals) */
|
---|
| 15 | pid_t mp_wpid; /* pid this process is waiting for */
|
---|
| 16 | int mp_parent; /* index of parent process */
|
---|
| 17 |
|
---|
| 18 | /* Child user and system times. Accounting done on child exit. */
|
---|
| 19 | clock_t mp_child_utime; /* cumulative user time of children */
|
---|
| 20 | clock_t mp_child_stime; /* cumulative sys time of children */
|
---|
| 21 |
|
---|
| 22 | /* Real and effective uids and gids. */
|
---|
| 23 | uid_t mp_realuid; /* process' real uid */
|
---|
| 24 | uid_t mp_effuid; /* process' effective uid */
|
---|
| 25 | gid_t mp_realgid; /* process' real gid */
|
---|
| 26 | gid_t mp_effgid; /* process' effective gid */
|
---|
| 27 |
|
---|
| 28 | /* File identification for sharing. */
|
---|
| 29 | ino_t mp_ino; /* inode number of file */
|
---|
| 30 | dev_t mp_dev; /* device number of file system */
|
---|
| 31 | time_t mp_ctime; /* inode changed time */
|
---|
| 32 |
|
---|
| 33 | /* Signal handling information. */
|
---|
| 34 | sigset_t mp_ignore; /* 1 means ignore the signal, 0 means don't */
|
---|
| 35 | sigset_t mp_catch; /* 1 means catch the signal, 0 means don't */
|
---|
| 36 | sigset_t mp_sig2mess; /* 1 means transform into notify message */
|
---|
| 37 | sigset_t mp_sigmask; /* signals to be blocked */
|
---|
| 38 | sigset_t mp_sigmask2; /* saved copy of mp_sigmask */
|
---|
| 39 | sigset_t mp_sigpending; /* pending signals to be handled */
|
---|
| 40 | struct sigaction mp_sigact[_NSIG + 1]; /* as in sigaction(2) */
|
---|
| 41 | vir_bytes mp_sigreturn; /* address of C library __sigreturn function */
|
---|
| 42 | struct timer mp_timer; /* watchdog timer for alarm(2) */
|
---|
| 43 |
|
---|
| 44 | /* Backwards compatibility for signals. */
|
---|
| 45 | sighandler_t mp_func; /* all sigs vectored to a single user fcn */
|
---|
| 46 |
|
---|
| 47 | unsigned mp_flags; /* flag bits */
|
---|
| 48 | vir_bytes mp_procargs; /* ptr to proc's initial stack arguments */
|
---|
| 49 | struct mproc *mp_swapq; /* queue of procs waiting to be swapped in */
|
---|
| 50 | message mp_reply; /* reply message to be sent to one */
|
---|
| 51 |
|
---|
| 52 | /* Scheduling priority. */
|
---|
| 53 | signed int mp_nice; /* nice is PRIO_MIN..PRIO_MAX, standard 0. */
|
---|
| 54 |
|
---|
| 55 | char mp_name[PROC_NAME_LEN]; /* process name */
|
---|
| 56 | } mproc[NR_PROCS];
|
---|
| 57 |
|
---|
| 58 | /* Flag values */
|
---|
| 59 | #define IN_USE 0x001 /* set when 'mproc' slot in use */
|
---|
| 60 | #define WAITING 0x002 /* set by WAIT system call */
|
---|
| 61 | #define ZOMBIE 0x004 /* set by EXIT, cleared by WAIT */
|
---|
| 62 | #define PAUSED 0x008 /* set by PAUSE system call */
|
---|
| 63 | #define ALARM_ON 0x010 /* set when SIGALRM timer started */
|
---|
| 64 | #define SEPARATE 0x020 /* set if file is separate I & D space */
|
---|
| 65 | #define TRACED 0x040 /* set if process is to be traced */
|
---|
| 66 | #define STOPPED 0x080 /* set if process stopped for tracing */
|
---|
| 67 | #define SIGSUSPENDED 0x100 /* set by SIGSUSPEND system call */
|
---|
| 68 | #define REPLY 0x200 /* set if a reply message is pending */
|
---|
| 69 | #define ONSWAP 0x400 /* set if data segment is swapped out */
|
---|
| 70 | #define SWAPIN 0x800 /* set if on the "swap this in" queue */
|
---|
| 71 | #define DONT_SWAP 0x1000 /* never swap out this process */
|
---|
| 72 | #define PRIV_PROC 0x2000 /* system process, special privileges */
|
---|
| 73 |
|
---|
| 74 | #define NIL_MPROC ((struct mproc *) 0)
|
---|
| 75 |
|
---|