summaryrefslogtreecommitdiff
path: root/src/user/init
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/init')
-rw-r--r--src/user/init/Makefile6
-rw-r--r--src/user/init/main.c24
2 files changed, 30 insertions, 0 deletions
diff --git a/src/user/init/Makefile b/src/user/init/Makefile
new file mode 100644
index 0000000..286de06
--- /dev/null
+++ b/src/user/init/Makefile
@@ -0,0 +1,6 @@
+Obj = main.o
+Out = init.elf
+
+include $(SrcPath)/user/app_common.make
+
+LDFLAGS += -Map test.map
diff --git a/src/user/init/main.c b/src/user/init/main.c
new file mode 100644
index 0000000..7d4ea0e
--- /dev/null
+++ b/src/user/init/main.c
@@ -0,0 +1,24 @@
+#include <tce/syscall.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+int main(char** args) {
+ int i;
+
+ FILE term = open("/.ui/klog", 0);
+ if (term <= 0) return -1;
+
+ fprint(term, "(init) Trivial/Computing Environment says hello. Press super to go home.\n");
+
+ for (i = 0; args[i] != 0; i++) {
+ if (i == 0) continue;
+ fprintf(term, "(init) Spawning %s...\n", args[i]);
+ int pid = run(args[i], 0);
+ if (pid < 0) {
+ fprint(term, "(init) Error. Sorry.\n");
+ } else {
+ waitpid(pid);
+ }
+ }
+ fprint(term, "(init) Goodbye.\n");
+}