feat: wrapper function for bootstraping user program
[lunaix-os.git] / lunaix-os / uprog / init.c
diff --git a/lunaix-os/uprog/init.c b/lunaix-os/uprog/init.c
new file mode 100644 (file)
index 0000000..a197245
--- /dev/null
@@ -0,0 +1,23 @@
+#include <fcntl.h>
+#include <sys/lunaix.h>
+#include <unistd.h>
+
+int
+main(int argc, const char** argv)
+{
+    int errno = 0;
+
+    if ((errno = open("/dev/tty", 0))) {
+        syslog(2, "fail to open tty (%d)\n", errno);
+        return 0;
+    }
+
+    if ((errno = dup(errno))) {
+        syslog(2, "fail to setup tty i/o (%d)\n", errno);
+        return 0;
+    }
+
+    syslog(0, "user space!\n");
+
+    return 0;
+}
\ No newline at end of file