diff options
Diffstat (limited to 'proc/proc.h')
-rw-r--r-- | proc/proc.h | 77 |
1 files changed, 34 insertions, 43 deletions
diff --git a/proc/proc.h b/proc/proc.h index 30886487..7943e0be 100644 --- a/proc/proc.h +++ b/proc/proc.h @@ -1,5 +1,5 @@ /* Process server definitions - Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1992,93,94,95,96,99,2000,01 Free Software Foundation, Inc. This file is part of the GNU Hurd. @@ -23,7 +23,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #define PROC_H_INCLUDED #include <sys/resource.h> +#include <sys/mman.h> #include <hurd/ports.h> +#include <hurd/ihash.h> #include <cthreads.h> struct proc @@ -34,8 +36,8 @@ struct proc struct proc *p_gnext, **p_gprevp; /* process group */ /* Hash table pointers that point here */ - void **p_pidhashloc; /* by pid */ - void **p_taskhashloc; /* by task port */ + hurd_ihash_locp_t p_pidhashloc; /* by pid */ + hurd_ihash_locp_t p_taskhashloc; /* by task port */ /* Identification of this process */ task_t p_task; @@ -64,28 +66,31 @@ struct proc vm_address_t p_argv, p_envp; int p_status; /* to return via wait */ int p_sigcode; - - int p_exec:1; /* has called proc_mark_exec */ - int p_stopped:1; /* has called proc_mark_stop */ - int p_waited:1; /* stop has been reported to parent */ - int p_exiting:1; /* has called proc_mark_exit */ - int p_waiting:1; /* blocked in wait */ - int p_traced:1; /* has called proc_mark_traced */ - int p_nostopcld:1; /* has called proc_mark_nostopchild */ - int p_parentset:1; /* has had a parent set with proc_child */ - int p_deadmsg:1; /* hang on requests for a message port */ - int p_checkmsghangs:1; /* someone is currently hanging on us */ - int p_msgportwait:1; /* blocked in getmsgport */ - int p_noowner:1; /* has no owner known */ - int p_loginleader:1; /* leader of login collection */ - int p_dead:1; /* process is dead */ + struct rusage p_rusage; /* my usage if I'm dead, to return via wait */ + + struct rusage p_child_rusage; /* accumulates p_rusage of all dead children */ + + unsigned int p_exec:1; /* has called proc_mark_exec */ + unsigned int p_stopped:1; /* has called proc_mark_stop */ + unsigned int p_waited:1; /* stop has been reported to parent */ + unsigned int p_exiting:1; /* has called proc_mark_exit */ + unsigned int p_waiting:1; /* blocked in wait */ + unsigned int p_traced:1; /* has called proc_mark_traced */ + unsigned int p_nostopcld:1; /* has called proc_mark_nostopchild */ + unsigned int p_parentset:1; /* has had a parent set with proc_child */ + unsigned int p_deadmsg:1; /* hang on requests for a message port */ + unsigned int p_checkmsghangs:1; /* someone is currently hanging on us */ + unsigned int p_msgportwait:1; /* blocked in getmsgport */ + unsigned int p_noowner:1; /* has no owner known */ + unsigned int p_loginleader:1; /* leader of login collection */ + unsigned int p_dead:1; /* process is dead */ }; typedef struct proc *pstruct_t; struct pgrp { - void **pg_hashloc; + hurd_ihash_locp_t pg_hashloc; struct proc *pg_plist; /* member processes */ struct pgrp *pg_next, **pg_prevp; /* list of pgrps in session */ pid_t pg_pgid; @@ -95,7 +100,7 @@ struct pgrp struct session { - void **s_hashloc; + hurd_ihash_locp_t s_hashloc; pid_t s_sid; struct pgrp *s_pgrps; /* list of member pgrps */ mach_port_t s_sessionid; /* receive right */ @@ -109,10 +114,9 @@ struct login struct ids { - int i_nuids, i_ngids; - uid_t *i_uids; - gid_t *i_gids; int i_refcnt; + int i_nuids; + uid_t i_uids[0]; }; /* Structure for an exception port we are listening on. */ @@ -143,11 +147,7 @@ mach_port_t generic_port; /* messages not related to a specific proc */ struct mutex global_lock; -/* Our name for version system */ -#define OUR_SERVER_NAME "proc" -#define OUR_VERSION "0.0" - -extern inline void +static inline void __attribute__ ((unused)) process_drop (struct proc *p) { if (p) @@ -156,7 +156,6 @@ process_drop (struct proc *p) /* Forward declarations */ void complete_wait (struct proc *, int); -int nextprime (int); int check_uid (struct proc *, uid_t); void addalltasks (void); void prociterate (void (*)(struct proc *, void *), void *); @@ -169,7 +168,7 @@ int genpid (); void abort_getmsgport (struct proc *); int zombie_check_pid (pid_t); void check_message_dying (struct proc *, struct proc *); -void message_port_dead (struct proc *); +int check_msgport_death (struct proc *); void check_dead_execdata_notify (mach_port_t); void add_proc_to_hash (struct proc *); @@ -194,7 +193,10 @@ void exc_clean (void *); struct proc *add_tasks (task_t); int pidfree (pid_t); -struct proc *new_proc (task_t); +struct proc *create_startup_proc (void); +struct proc *allocate_proc (task_t); +void proc_death_notify (struct proc *); +void complete_proc (struct proc *, pid_t); void leave_pgrp (struct proc *); void join_pgrp (struct proc *); @@ -208,17 +210,6 @@ void complete_exit (struct proc *); void initialize_version_info (void); void send_signal (mach_port_t, int, mach_port_t); - -/* Returns true if PROC1 has `owner' privileges over PROC2 (and can thus get - its task port &c). If PROC2 has an owner, then PROC1 must have that uid; - otherwise, both must be in the same login collection. */ -extern inline int -check_owner (struct proc *proc1, struct proc *proc2) -{ - return - proc2->p_noowner - ? check_uid (proc1, 0) || proc1->p_login == proc2->p_login - : check_uid (proc1, proc2->p_owner); -} + #endif |