diff options
Diffstat (limited to 'src/kernel/proc.h')
-rw-r--r-- | src/kernel/proc.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/kernel/proc.h b/src/kernel/proc.h index 07cba28..135baad 100644 --- a/src/kernel/proc.h +++ b/src/kernel/proc.h @@ -6,9 +6,12 @@ struct vfs_mount; #define HANDLE_MAX 16 +/* legal transitions described by process_transition */ enum process_state { PS_RUNNING, - PS_DEAD, // return message not collected + PS_TOREAP, /* return message not collected */ + PS_TOMBSTONE, /* fully dead, supports alive children */ + PS_WAITS4CHILDDEATH, PS_WAITS4FS, PS_WAITS4REQUEST, @@ -18,6 +21,8 @@ enum process_state { PS_LAST, }; +#define proc_alive(p) (p && p->state != PS_TOREAP && p->state != PS_TOMBSTONE) + struct process { struct pagedir *pages; /* if NULL, refcount == 1. kmalloc'd */ @@ -80,8 +85,8 @@ struct process *process_seed(void *data, size_t datalen); struct process *process_fork(struct process *parent, int flags); void process_kill(struct process *proc, int ret); -/** Tries to free a process / collect its return value. */ -void process_try2collect(struct process *dead); +/** Tries to reap a dead process / free a tombstone. */ +void process_tryreap(struct process *dead); /** Switches execution to any running process. */ _Noreturn void process_switch_any(void); |