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