summaryrefslogtreecommitdiff
path: root/usr.sbin/init/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/init/main.c')
-rw-r--r--usr.sbin/init/main.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/usr.sbin/init/main.c b/usr.sbin/init/main.c
index 8ef90d3..bad8201 100644
--- a/usr.sbin/init/main.c
+++ b/usr.sbin/init/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
+ * Copyright (c) 2023-2025 Ian Marco Moffett and the Osmora Team.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,8 +27,29 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/spawn.h>
+#include <stddef.h>
+
+#define SHELL_PATH "/usr/bin/osh"
+#define INIT_RC_PATH "/usr/rc/init.rc"
+
int
-main(void)
+main(int argc, char **argv)
{
+ char *start_argv[] = { SHELL_PATH, INIT_RC_PATH, NULL };
+ char *start_envp[] = { NULL };
+
+ spawn(SHELL_PATH, start_argv, start_envp, 0);
+ start_argv[1] = NULL;
+
+ /*
+ * We can override the start program header
+ * if there is something specified.
+ */
+ if (argc > 1) {
+ start_argv[0] = argv[1];
+ }
+
+ spawn(start_argv[0], start_argv, start_envp, SPAWN_WAIT);
return 0;
}