From afb20bf59d72f430b461eead0b753a82ed1b331c Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sat, 30 May 2026 10:20:21 +0100 Subject: [PATCH] herdd: replace task_duplicate test with fork test --- services/herdd/main.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/services/herdd/main.c b/services/herdd/main.c index 1b271b7..6694d44 100644 --- a/services/herdd/main.c +++ b/services/herdd/main.c @@ -2,6 +2,7 @@ #include "queue.h" #include "runlevel.h" #include "service.h" +#include "spawn.h" #include #include @@ -111,19 +112,15 @@ int main(int argc, const char *argv[], const char *envp[]) } runlevel_activate(rl); +#if 1 + pid_t child = fork(); + kern_logf(" fork returned %d", child); - kern_handle_t new_task = 123, new_space = 456; - kern_status_t status = task_duplicate(&new_task, &new_space); - kern_logf( - " task_duplicate returned %d (%x/%x)", - status, - new_task, - new_space); - - if (new_task == KERN_HANDLE_INVALID) { + if (child == 0) { kern_log("this is the child"); long r = printf("hello\n"); kern_logf("printf returned %ld (%d)", r, (errno)); + execlp(NULL, NULL); } else { kern_log("this is the parent"); long r = printf("goodbye\n"); @@ -131,5 +128,6 @@ int main(int argc, const char *argv[], const char *envp[]) } kern_logf("exiting (%s)", strerror(EFTYPE)); +#endif return 0; }