diff options
author | Ian Moffett <ian@osmora.org> | 2025-10-13 14:53:04 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-10-13 14:53:04 -0400 |
commit | 44bbb86a75043b38bdfb9ed6ff4be0764e3fc905 (patch) | |
tree | d64c2a0baa08c85c9fb284be150204f10d84307b /src/sys/include | |
parent | 959dd1c5dd5b2a369a33946a081d8764bcc51e2f (diff) |
kern: proc: Implement process sleeping and waking
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/include')
-rw-r--r-- | src/sys/include/sys/proc.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/sys/include/sys/proc.h b/src/sys/include/sys/proc.h index 9f5cd73..bb34066 100644 --- a/src/sys/include/sys/proc.h +++ b/src/sys/include/sys/proc.h @@ -90,6 +90,7 @@ struct proc { struct filedesc *fdtab[FD_MAX]; struct penv_blk *envblk; struct ptrbox *envblk_box; + struct proc *parent; mac_level_t level; struct spinlock maplist_lock; sigtab_t sigtab; @@ -99,6 +100,7 @@ struct proc { }; #define PROC_EXITING BIT(0) /* Process is exiting */ +#define PROC_SLEEPING BIT(1) /* Process is sleeping */ /* * Initialize a process into a basic minimal @@ -204,6 +206,26 @@ int md_set_ip(struct proc *procp, uintptr_t ip); int proc_check_addr(struct proc *proc, uintptr_t addr, size_t len); /* + * Put a process to sleep + * + * @proc: Process to put to sleep + * + * Returns zero if the address is within the process bounds, + * otherwise a less than zero value on failure. + */ +int proc_sleep(struct proc *proc); + +/* + * Wake up a process + * + * @proc: Process to wake up + * + * Returns zero if the address is within the process bounds, + * otherwise a less than zero value on failure. + */ +int proc_wake(struct proc *proc); + +/* * Lookup a process using its PID * * @pid: PID of process to lookup @@ -213,6 +235,12 @@ int proc_check_addr(struct proc *proc, uintptr_t addr, size_t len); struct proc *proc_lookup(pid_t pid); /* + * Put the current process to sleep until woken + * up + */ +void md_proc_sleep(void); + +/* * Put the current process into a halt loop * until the next one runs. */ |