xref: /minix/minix/servers/pm/mproc.h (revision 0a6a1f1d)
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 <limits.h>
8 #include <minix/timers.h>
9 #include <signal.h>
10 
11 #include <sys/cdefs.h>
12 
13 /* Needs to be included here, for 'ps' etc */
14 #include "const.h"
15 
16 typedef struct sigaction ixfer_sigaction;
17 
18 EXTERN struct mproc {
19   char mp_exitstatus;		/* storage for status when process exits */
20   char mp_sigstatus;		/* storage for signal # for killed procs */
21   pid_t mp_pid;			/* process id */
22   endpoint_t mp_endpoint;	/* kernel endpoint id */
23   pid_t mp_procgrp;		/* pid of process group (used for signals) */
24   pid_t mp_wpid;		/* pid this process is waiting for */
25   vir_bytes mp_waddr;		/* struct rusage address while waiting */
26   int mp_parent;		/* index of parent process */
27   int mp_tracer;		/* index of tracer process, or NO_TRACER */
28 
29   /* Child user and system times. Accounting done on child exit. */
30   clock_t mp_child_utime;	/* cumulative user time of children */
31   clock_t mp_child_stime;	/* cumulative sys time of children */
32 
33   /* Real and effective uids and gids. */
34   uid_t mp_realuid;		/* process' real uid */
35   uid_t mp_effuid;		/* process' effective uid */
36   gid_t mp_realgid;		/* process' real gid */
37   gid_t mp_effgid;		/* process' effective gid */
38 
39   /* Supplemental groups. */
40   int mp_ngroups;		/* number of supplemental groups */
41   gid_t mp_sgroups[NGROUPS_MAX];/* process' supplemental groups */
42 
43   /* Signal handling information. */
44   sigset_t mp_ignore;		/* 1 means ignore the signal, 0 means don't */
45   sigset_t mp_catch;		/* 1 means catch the signal, 0 means don't */
46   sigset_t mp_sigmask;		/* signals to be blocked */
47   sigset_t mp_sigmask2;		/* saved copy of mp_sigmask */
48   sigset_t mp_sigpending;	/* pending signals to be handled */
49   sigset_t mp_ksigpending;	/* bitmap for pending signals from the kernel */
50   sigset_t mp_sigtrace;		/* signals to hand to tracer first */
51   ixfer_sigaction mp_sigact[_NSIG]; /* as in sigaction(2) */
52 #ifdef __ACK__
53   char mp_padding[60];		/* align structure with new libc */
54 #endif
55   vir_bytes mp_sigreturn; 	/* address of C library __sigreturn function */
56   minix_timer_t mp_timer;	/* watchdog timer for alarm(2), setitimer(2) */
57   clock_t mp_interval[NR_ITIMERS];	/* setitimer(2) repetition intervals */
58 
59   unsigned mp_flags;		/* flag bits */
60   unsigned mp_trace_flags;	/* trace options */
61   message mp_reply;		/* reply message to be sent to one */
62 
63   /* Process execution frame. Both fields are used by procfs. */
64   vir_bytes mp_frame_addr;	/* ptr to proc's initial stack arguments */
65   size_t mp_frame_len;		/* size of proc's initial stack arguments */
66 
67   /* Scheduling priority. */
68   signed int mp_nice;		/* nice is PRIO_MIN..PRIO_MAX, standard 0. */
69 
70   /* User space scheduling */
71   endpoint_t mp_scheduler;	/* scheduler endpoint id */
72 
73   char mp_name[PROC_NAME_LEN];	/* process name */
74 
75   int mp_magic;			/* sanity check, MP_MAGIC */
76 } mproc[NR_PROCS];
77 
78 /* Flag values */
79 #define IN_USE		0x00001	/* set when 'mproc' slot in use */
80 #define WAITING		0x00002	/* set by WAIT4 system call */
81 #define ZOMBIE		0x00004	/* waiting for parent to issue WAIT4 call */
82 #define PROC_STOPPED	0x00008	/* process is stopped in the kernel */
83 #define ALARM_ON	0x00010	/* set when SIGALRM timer started */
84 #define EXITING		0x00020	/* set by EXIT, process is now exiting */
85 #define TOLD_PARENT	0x00040	/* parent wait() completed, ZOMBIE off */
86 #define TRACE_STOPPED	0x00080	/* set if process stopped for tracing */
87 #define SIGSUSPENDED	0x00100	/* set by SIGSUSPEND system call */
88 #define VFS_CALL       	0x00400	/* set if waiting for VFS (normal calls) */
89 #define NEW_PARENT	0x00800	/* process's parent changed during VFS call */
90 #define UNPAUSED	0x01000	/* VFS has replied to unpause request */
91 #define PRIV_PROC	0x02000	/* system process, special privileges */
92 #define PARTIAL_EXEC	0x04000	/* process got a new map but no content */
93 #define TRACE_EXIT	0x08000	/* tracer is forcing this process to exit */
94 #define TRACE_ZOMBIE	0x10000	/* waiting for tracer to issue WAIT4 call */
95 #define DELAY_CALL	0x20000	/* waiting for call before sending signal */
96 #define TAINTED		0x40000 /* process is 'tainted' */
97 
98 #define MP_MAGIC	0xC0FFEE0
99