2005-05-13 10:57:08 +02:00
|
|
|
/* This table has one slot per process. It contains all the process management
|
2005-05-03 17:35:52 +02:00
|
|
|
* information for each process. Among other things, it defines the text, data
|
|
|
|
* and stack segments, uids and gids, and various flags. The kernel and file
|
|
|
|
* systems have tables that are also indexed by process, with the contents
|
|
|
|
* of corresponding slots referring to the same process in all three.
|
|
|
|
*/
|
2005-07-14 17:16:12 +02:00
|
|
|
#include <timers.h>
|
2008-11-19 13:26:10 +01:00
|
|
|
#include <signal.h>
|
2005-05-03 17:35:52 +02:00
|
|
|
|
2009-08-15 23:37:26 +02:00
|
|
|
#include "const.h"
|
|
|
|
|
2005-05-03 17:35:52 +02:00
|
|
|
EXTERN struct mproc {
|
|
|
|
char mp_exitstatus; /* storage for status when process exits */
|
|
|
|
char mp_sigstatus; /* storage for signal # for killed procs */
|
|
|
|
pid_t mp_pid; /* process id */
|
2006-06-20 12:04:33 +02:00
|
|
|
endpoint_t mp_endpoint; /* kernel endpoint id */
|
2005-05-03 17:35:52 +02:00
|
|
|
pid_t mp_procgrp; /* pid of process group (used for signals) */
|
|
|
|
pid_t mp_wpid; /* pid this process is waiting for */
|
|
|
|
int mp_parent; /* index of parent process */
|
|
|
|
|
2005-05-31 11:50:51 +02:00
|
|
|
/* Child user and system times. Accounting done on child exit. */
|
|
|
|
clock_t mp_child_utime; /* cumulative user time of children */
|
|
|
|
clock_t mp_child_stime; /* cumulative sys time of children */
|
|
|
|
|
2005-05-03 17:35:52 +02:00
|
|
|
/* Real and effective uids and gids. */
|
|
|
|
uid_t mp_realuid; /* process' real uid */
|
|
|
|
uid_t mp_effuid; /* process' effective uid */
|
|
|
|
gid_t mp_realgid; /* process' real gid */
|
|
|
|
gid_t mp_effgid; /* process' effective gid */
|
|
|
|
|
|
|
|
/* Signal handling information. */
|
|
|
|
sigset_t mp_ignore; /* 1 means ignore the signal, 0 means don't */
|
|
|
|
sigset_t mp_catch; /* 1 means catch the signal, 0 means don't */
|
2005-07-19 14:11:11 +02:00
|
|
|
sigset_t mp_sig2mess; /* 1 means transform into notify message */
|
2005-05-03 17:35:52 +02:00
|
|
|
sigset_t mp_sigmask; /* signals to be blocked */
|
|
|
|
sigset_t mp_sigmask2; /* saved copy of mp_sigmask */
|
2005-05-13 10:57:08 +02:00
|
|
|
sigset_t mp_sigpending; /* pending signals to be handled */
|
2005-05-03 17:35:52 +02:00
|
|
|
struct sigaction mp_sigact[_NSIG + 1]; /* as in sigaction(2) */
|
|
|
|
vir_bytes mp_sigreturn; /* address of C library __sigreturn function */
|
2006-05-11 16:57:23 +02:00
|
|
|
struct sigmsg mp_sigmsg; /* Save the details of the signal until the
|
|
|
|
* PM_UNPAUSE request is delivered.
|
|
|
|
*/
|
2009-08-15 18:09:32 +02:00
|
|
|
struct timer mp_timer; /* watchdog timer for alarm(2), setitimer(2) */
|
2009-08-15 23:37:26 +02:00
|
|
|
clock_t mp_interval[NR_ITIMERS]; /* setitimer(2) repetition intervals */
|
2005-05-03 17:35:52 +02:00
|
|
|
|
|
|
|
unsigned mp_flags; /* flag bits */
|
|
|
|
vir_bytes mp_procargs; /* ptr to proc's initial stack arguments */
|
|
|
|
message mp_reply; /* reply message to be sent to one */
|
|
|
|
|
2006-05-11 16:57:23 +02:00
|
|
|
/* Communication with FS */
|
2006-05-15 14:06:19 +02:00
|
|
|
int mp_fs_call; /* Record the call for normal system calls */
|
|
|
|
int mp_fs_call2; /* Record the call for signals */
|
2006-05-11 16:57:23 +02:00
|
|
|
char *mp_exec_path; /* Path of executable */
|
|
|
|
vir_bytes mp_exec_path_len; /* Length of path (including nul) */
|
|
|
|
char *mp_exec_frame; /* Arguments */
|
|
|
|
vir_bytes mp_exec_frame_len; /* Length of arguments */
|
|
|
|
|
2005-07-01 19:58:29 +02:00
|
|
|
/* Scheduling priority. */
|
|
|
|
signed int mp_nice; /* nice is PRIO_MIN..PRIO_MAX, standard 0. */
|
|
|
|
|
2005-05-03 17:35:52 +02:00
|
|
|
char mp_name[PROC_NAME_LEN]; /* process name */
|
|
|
|
} mproc[NR_PROCS];
|
|
|
|
|
|
|
|
/* Flag values */
|
|
|
|
#define IN_USE 0x001 /* set when 'mproc' slot in use */
|
|
|
|
#define WAITING 0x002 /* set by WAIT system call */
|
2009-07-10 00:33:56 +02:00
|
|
|
#define ZOMBIE 0x004 /* waiting for parent to issue WAIT call */
|
2005-05-03 17:35:52 +02:00
|
|
|
#define PAUSED 0x008 /* set by PAUSE system call */
|
|
|
|
#define ALARM_ON 0x010 /* set when SIGALRM timer started */
|
|
|
|
#define TRACED 0x040 /* set if process is to be traced */
|
|
|
|
#define STOPPED 0x080 /* set if process stopped for tracing */
|
|
|
|
#define SIGSUSPENDED 0x100 /* set by SIGSUSPEND system call */
|
|
|
|
#define REPLY 0x200 /* set if a reply message is pending */
|
2005-07-19 14:11:11 +02:00
|
|
|
#define PRIV_PROC 0x2000 /* system process, special privileges */
|
2006-05-11 16:57:23 +02:00
|
|
|
#define PM_SIG_PENDING 0x4000 /* process got a signal while waiting for FS */
|
|
|
|
#define PARTIAL_EXEC 0x8000 /* Process got a new map but no content */
|
2006-10-25 13:29:43 +02:00
|
|
|
#define TOLD_PARENT 0x10000 /* Parent wait() completed, ZOMBIE off */
|
2009-07-10 00:33:56 +02:00
|
|
|
#define EXITING 0x20000 /* set by EXIT, process is now exiting */
|
2009-07-11 15:22:56 +02:00
|
|
|
#define TRACE_EXIT 0x40000 /* tracer is forcing this process to exit */
|
2005-05-03 17:35:52 +02:00
|
|
|
|
|
|
|
#define NIL_MPROC ((struct mproc *) 0)
|
2005-05-31 11:50:51 +02:00
|
|
|
|