diff options
author | dzwdz | 2021-09-16 06:33:26 +0000 |
---|---|---|
committer | dzwdz | 2021-09-16 06:33:26 +0000 |
commit | 206ca77636cca94d14d7486a7a0e2679bf107a28 (patch) | |
tree | b35bd3919e19d785b2141c2e2a645bba861541c8 /src/init | |
parent | 9e056016ce39036abbc223260e49964ef74aaa82 (diff) |
fs_read stub, basic implementation in userland
Diffstat (limited to 'src/init')
-rw-r--r-- | src/init/main.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/init/main.c b/src/init/main.c index 15afaf5..bed9ddb 100644 --- a/src/init/main.c +++ b/src/init/main.c @@ -43,6 +43,14 @@ void fs_test(void) { file = _syscall_open(argify("/mnt/tty")); log("open returned. "); _syscall_write(file, argify("hello")); + + // try reading + char buf[8]; + int len; + for (int i = 0; i < 8; i++) + buf[i] = '.'; + len = _syscall_read(file, buf, len); + _syscall_write(tty_fd, buf, len + 1); // read 1 byte past, should be a dot } void fs_server(handle_t back) { @@ -57,6 +65,11 @@ void fs_server(handle_t back) { _syscall_fs_respond(NULL, 32); // doesn't check the path yet break; + case VFSOP_READ: + // all reads output "world" + _syscall_fs_respond("world", 5); + break; + case VFSOP_WRITE: // uppercase the buffer for (int i = 0; i < len; i++) buf[i] &= ~id; // id == 32 |