From 220d53a4d872e4965a46a6dc90f71e40f6ded3d8 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Mon, 22 Apr 2024 23:48:07 +0200 Subject: Add tests --- tests/openat.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/openat.c (limited to 'tests/openat.c') diff --git a/tests/openat.c b/tests/openat.c new file mode 100644 index 0000000..62628cc --- /dev/null +++ b/tests/openat.c @@ -0,0 +1,26 @@ +#include +#include +#include +#include +#include +#include + +int main(int argc, char** argv) { + printf("PID: %d\n", getpid()); + + int ret = syscall(SYS_openat, -100, "testfile", O_RDWR); + printf("Openat ret: %d\n", ret); + + if (ret == -1) { + printf("Opneat error: %s\n", strerror(errno)); + } + + ret = syscall(SYS_write, ret, "writing this :)", 14); + printf("Write ret: %d\n", ret); + + if (ret == -1) { + printf("Write error: %s\n", strerror(errno)); + } + + return 0; +} -- cgit 1.4.1