diff options
author | Ian Moffett <ian@osmora.org> | 2025-10-10 18:49:43 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-10-10 18:49:43 -0400 |
commit | 2f8da5a5eb726f3c05b8fca19e82928d8acb147d (patch) | |
tree | 59bcbbddb3dbf86879821e40fe4d65693a5e2ddc /src/lib | |
parent | fe317f8e7cb245cc36c0c6ac8fdef5d54168e978 (diff) |
kern: proc: Add initial penv block support
This commit introduces the initial support for the process environment
block and implements argv and argc.
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libc/src/l5/spawn.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/libc/src/l5/spawn.c b/src/lib/libc/src/l5/spawn.c index 9f0c80b..50ade53 100644 --- a/src/lib/libc/src/l5/spawn.c +++ b/src/lib/libc/src/l5/spawn.c @@ -28,6 +28,7 @@ */ #include <sys/spawn.h> +#include <sys/proc.h> #include <sys/syscall.h> #include <stddef.h> #include <errno.h> @@ -35,14 +36,24 @@ int spawn(const char *path, char **argv) { + struct penv_blk blk; + size_t argc = 0; + if (path == NULL || argv == NULL) { return -EINVAL; } - /* TODO: We must handle the penv_blk */ + /* Get the argument count */ + while (argv[argc++] != NULL); + --argc; + + /* Setup the penv block */ + blk.argv = argv; + blk.argc = argc; + return syscall( SYS_spawn, (uintptr_t)path, - 0 + (uintptr_t)&blk ); } |