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