From b9f5f92bff69059471a76e73539780eedb356455 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Mon, 25 Dec 2023 19:08:04 +0100 Subject: kernel: _sys_getnull() (basically /dev/null) --- src/cmd/tests/kernel/miscsyscall.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/cmd') 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); } -- cgit v1.2.3