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