diff options
author | Ian Moffett <ian@osmora.org> | 2025-09-19 23:26:20 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-09-19 23:26:20 -0400 |
commit | 69933fc75a701502f06fc30680fa6fa1f13b5ebb (patch) | |
tree | 767ec2d108df9ecba69aeacc1b37e644ed3d5485 /src/sys/arch/amd64 | |
parent | dafae63886c6f97e03d436084a4b757f3137767e (diff) |
kern/amd64: proc: Add proc_self()
Introduce a new proc_self() function to get the current running process
on the current CPU core.
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/arch/amd64')
-rw-r--r-- | src/sys/arch/amd64/os/os_proc.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/sys/arch/amd64/os/os_proc.c b/src/sys/arch/amd64/os/os_proc.c index 1064c10..8318476 100644 --- a/src/sys/arch/amd64/os/os_proc.c +++ b/src/sys/arch/amd64/os/os_proc.c @@ -252,3 +252,18 @@ md_proc_kill(struct proc *procp, int flags) return 0; } + +/* + * Get the current running process + */ +struct proc * +proc_self(void) +{ + struct pcore *core = this_core(); + + if (core == NULL) { + return NULL; + } + + return core->curproc; +} |