summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libc/src/l5/spawn.c15
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
);
}