aboutsummaryrefslogtreecommitdiff
path: root/src/sysbin/login/main.c
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2016-07-16 15:59:46 +0200
committerAlex Auvolat <alex@adnab.me>2016-07-16 15:59:46 +0200
commit3d6a857b9186ef6304ea6cf04627c2b787169f29 (patch)
tree756179ce1e1838f75c57e3efec2a570d72051594 /src/sysbin/login/main.c
parent59000174aa50ed6b2d24a71576d15e6a53c5be0c (diff)
downloadkogata-3d6a857b9186ef6304ea6cf04627c2b787169f29.tar.gz
kogata-3d6a857b9186ef6304ea6cf04627c2b787169f29.zip
Make way for libc implementation
Diffstat (limited to 'src/sysbin/login/main.c')
-rw-r--r--src/sysbin/login/main.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/sysbin/login/main.c b/src/sysbin/login/main.c
index c9d2455..c4cd260 100644
--- a/src/sysbin/login/main.c
+++ b/src/sysbin/login/main.c
@@ -1,6 +1,8 @@
#include <string.h>
#include <stdlib.h>
+#include <proto/launch.h>
+
#include <kogata/debug.h>
#include <kogata/syscall.h>
@@ -8,42 +10,42 @@ int main(int argc, char **argv) {
dbg_print("[login] Starting up.\n");
// communication channel between terminal && shell
- fd_pair_t tc = make_channel(false);
+ fd_pair_t tc = sc_make_channel(false);
// just launch a terminal
- pid_t term_pid = new_proc();
+ pid_t term_pid = sc_new_proc();
if (term_pid == 0) {
PANIC("[login] Could not launch terminal");
}
bool ok;
- ok = bind_fs(term_pid, "sys", "sys")
- && bind_fs(term_pid, "config", "config")
- && bind_fd(term_pid, 1, 1)
- && bind_fd(term_pid, 2, tc.a);
+ ok = sc_bind_fs(term_pid, "sys", "sys")
+ && sc_bind_fs(term_pid, "config", "config")
+ && sc_bind_fd(term_pid, STD_FD_GIP, STD_FD_GIP)
+ && sc_bind_fd(term_pid, STD_FD_TTYSRV, tc.a);
if (!ok) PANIC("[login] Could not bind to terminal process.");
- ok = proc_exec(term_pid, "sys:/bin/terminal.bin");
+ ok = sc_proc_exec(term_pid, "sys:/bin/terminal.bin");
if (!ok) PANIC("[login] Could not run terminal.bin");
// and launch the shell
- pid_t shell_pid = new_proc();
+ pid_t shell_pid = sc_new_proc();
if (shell_pid == 0) {
PANIC("[login] Could not launch shell");
}
- ok = bind_fs(shell_pid, "root", "root")
- && bind_fs(shell_pid, "sys", "sys")
- && bind_fs(shell_pid, "config", "config")
- && bind_fd(shell_pid, 1, tc.b);
+ ok = sc_bind_fs(shell_pid, "root", "root")
+ && sc_bind_fs(shell_pid, "sys", "sys")
+ && sc_bind_fs(shell_pid, "config", "config")
+ && sc_bind_fd(shell_pid, STD_FD_TTY_STDIO, tc.b);
if (!ok) PANIC("[login] Could not bind to shell process.");
- ok = proc_exec(shell_pid, "sys:/bin/shell.bin");
+ ok = sc_proc_exec(shell_pid, "sys:/bin/shell.bin");
if (!ok) PANIC("[login] Could not run shell.bin");
proc_status_t s;
- proc_wait(0, true, &s);
+ sc_proc_wait(0, true, &s);
return 0;
}