From 2f8da5a5eb726f3c05b8fca19e82928d8acb147d Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 10 Oct 2025 18:49:43 -0400 Subject: 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 --- src/lib/libc/src/l5/spawn.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/lib') 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 +#include #include #include #include @@ -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 ); } -- cgit v1.2.3