diff options
author | dzwdz | 2022-07-18 23:55:58 +0200 |
---|---|---|
committer | dzwdz | 2022-07-18 23:55:58 +0200 |
commit | 96f41ff64d8113307f1b60d2eb6852423db34d14 (patch) | |
tree | 5a85a9706a2a11d047f7f5c91f4964bd2167b1ee /src/user/tests/main.c | |
parent | 121794214fd5ae36609c30418dfaf1a073b8784c (diff) |
syscalls: implement execbuf
i have been planning to implement something like this for a while now.
it should be faster when doing consecutive syscalls (to be tested).
it will also be helpful in writing the elf loader
Diffstat (limited to 'src/user/tests/main.c')
-rw-r--r-- | src/user/tests/main.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/user/tests/main.c b/src/user/tests/main.c index ab6b4a8..97714e7 100644 --- a/src/user/tests/main.c +++ b/src/user/tests/main.c @@ -1,5 +1,6 @@ #define TEST_MACROS #include <shared/errno.h> +#include <shared/execbuf.h> #include <shared/flags.h> #include <shared/syscalls.h> #include <user/lib/stdlib.h> @@ -221,6 +222,19 @@ static void test_efault(void) { close(h); } +static void test_execbuf(void) { + // not really a test, TODO + const char str1[] = "test_execbuf: string 1\n"; + const char str2[] = "test_execbuf: and 2\n"; + uint64_t buf[] = { + EXECBUF_SYSCALL, _SYSCALL_WRITE, 1, (uintptr_t)str1, sizeof(str1) - 1, -1, + EXECBUF_SYSCALL, _SYSCALL_WRITE, 1, (uintptr_t)str2, sizeof(str2) - 1, -1, + EXECBUF_SYSCALL, _SYSCALL_EXIT, 0, 0, 0, 0, + }; + _syscall_execbuf(buf, sizeof buf); + test_fail(); +} + static void test_misc(void) { assert(_syscall(~0, 0, 0, 0, 0) < 0); /* try making an invalid syscall */ } @@ -237,5 +251,6 @@ void test_all(void) { run_forked(test_pipe); run_forked(test_semaphore); run_forked(test_efault); + run_forked(test_execbuf); run_forked(test_misc); } |