diff options
author | dzwdz | 2023-12-25 19:08:04 +0100 |
---|---|---|
committer | dzwdz | 2023-12-25 19:08:04 +0100 |
commit | b9f5f92bff69059471a76e73539780eedb356455 (patch) | |
tree | 55302764cbc2a6ab159cf2621dc34aab04ca4085 /src/cmd/tests | |
parent | 4e1a6f1b3c543b9fbeb882a9e97551f7c58ca65a (diff) |
kernel: _sys_getnull() (basically /dev/null)
Diffstat (limited to 'src/cmd/tests')
-rw-r--r-- | src/cmd/tests/kernel/miscsyscall.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cmd/tests/kernel/miscsyscall.c b/src/cmd/tests/kernel/miscsyscall.c index 3cf3f2e..c7ce9e0 100644 --- a/src/cmd/tests/kernel/miscsyscall.c +++ b/src/cmd/tests/kernel/miscsyscall.c @@ -304,6 +304,24 @@ static void test_timer(void) { } } +static void test_getnull(void) { + hid_t h, h2; + char buf[16]; + + test((h = _sys_getnull(0)) >= 0); + test((h2 = dup(h))); + + test(_sys_read(h, buf, 16, 0) == -ENOSYS); + test(_sys_write(h, buf, 16, 0, 0) == -ENOSYS); + test(_sys_getsize(h) == -ENOSYS); + test(_sys_remove(h) == -ENOSYS); + test(_sys_fs_respond(h, buf, 16, 0) == -EBADF); + test(_sys_mount(h, "/asdf", 5) == -EGENERIC); + + close(h); + close(h2); +} + void r_k_miscsyscall(void) { run_test(test_await); run_test(test_await2); @@ -315,4 +333,5 @@ void r_k_miscsyscall(void) { run_test(test_sleep); run_test(test_badopen); run_test(test_timer); + run_test(test_getnull); } |