summaryrefslogtreecommitdiff
path: root/src/user/app/init
diff options
context:
space:
mode:
authorAlex AUVOLAT <alexis211@gmail.com>2012-05-19 11:45:49 +0200
committerAlex AUVOLAT <alexis211@gmail.com>2012-05-19 11:45:49 +0200
commit499ca6c243b05da176a2d4bd9a2317f0b28afc7f (patch)
treef55ff788632b017ab8de83b71ad02b0998e1dda5 /src/user/app/init
parent7b466345af0d3a7dc5622617ce443a90c64e34a4 (diff)
downloadTCE-499ca6c243b05da176a2d4bd9a2317f0b28afc7f.tar.gz
TCE-499ca6c243b05da176a2d4bd9a2317f0b28afc7f.zip
Introducing FWIK, the userland C++ framework. Far from complete.
Diffstat (limited to 'src/user/app/init')
-rw-r--r--src/user/app/init/Makefile6
-rw-r--r--src/user/app/init/main.cpp22
2 files changed, 28 insertions, 0 deletions
diff --git a/src/user/app/init/Makefile b/src/user/app/init/Makefile
new file mode 100644
index 0000000..6ab7cf8
--- /dev/null
+++ b/src/user/app/init/Makefile
@@ -0,0 +1,6 @@
+Obj = main.o
+Out = init.elf
+
+include $(SrcPath)/user/app/fwik.make
+
+LDFLAGS += -Map init.map
diff --git a/src/user/app/init/main.cpp b/src/user/app/init/main.cpp
new file mode 100644
index 0000000..4bb12da
--- /dev/null
+++ b/src/user/app/init/main.cpp
@@ -0,0 +1,22 @@
+#include <tce/syscall.h>
+#include <IO/IOStream.h>
+
+int Main(char** args) {
+ FILE home_term = libc::open("/.ui/home", 0);
+ if (home_term < 0) return -1;
+
+ stdio << "(init) Trivial/Computing Environment says hello. Press super to go home.\n";
+
+ for (int i = 0; args[i] != 0; i++) {
+ if (i == 0) continue;
+ stdio.printf("(init) Spawning %s...\n", args[i]);
+ int pid = libc::run(args[i], 0, home_term);
+ if (pid < 0) {
+ stdio << "(init) Error. Sorry.\n";
+ } else {
+ libc::waitpid(pid, 1);
+ }
+ }
+ stdio << "(init) Goodbye.\n";
+ return 0;
+}