summaryrefslogtreecommitdiff
path: root/src/init
diff options
context:
space:
mode:
authordzwdz2021-08-25 14:28:53 +0200
committerdzwdz2021-08-25 14:28:53 +0200
commitab5150478dd14c1c5b28ca50b36b35e8224df54b (patch)
treee4998413332229459b7037871924c0d9e811252d /src/init
parent3ac131ea956fd62df966bac75e8d7f0c0434d68d (diff)
implement vfs_mount_seed, which creates the vfs passed to init
Diffstat (limited to 'src/init')
-rw-r--r--src/init/main.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/init/main.c b/src/init/main.c
index b0e31ae..c08cf21 100644
--- a/src/init/main.c
+++ b/src/init/main.c
@@ -18,17 +18,27 @@ const char *multipageify(const char *str) {
#define mount(fd, path) _syscall_fd_mount(fd, path, sizeof(path)-1)
int main(void) {
- mount(0, "/");
+ int fd;
+
mount(0, "/some/where");
mount(0, "/some");
- _syscall_fs_open(
+ _syscall_fs_open( // should fail
multipageify("/some/where/file"),
sizeof("/some/where/file") - 1);
- _syscall_fd_write(FD_STDOUT, "fd test ", 8);
- _syscall_fd_close(FD_STDOUT);
- _syscall_fd_write(FD_STDOUT, "fd test ", 8); // should fail
+ fd = _syscall_fs_open(
+ multipageify("/tty"),
+ sizeof("/tty") - 1);
+
+ if (fd < 0) {
+ _syscall_exit("couldn't open tty",
+ sizeof("couldn't open tty") - 1);
+ }
+
+ _syscall_fd_write(fd, "fd test ", 8);
+ _syscall_fd_close(fd);
+ _syscall_fd_write(fd, "fd test ", 8); // should fail
_syscall_exit("bye from init! ",
sizeof("bye from init! ") - 1);