about summary refs log tree commit diff
path: root/tests/openat.c
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2024-04-22 23:48:07 +0200
committerBaitinq <manuelpalenzuelamerino@gmail.com>2024-04-22 23:48:07 +0200
commit220d53a4d872e4965a46a6dc90f71e40f6ded3d8 (patch)
treebb0f937784d6a0f42d59d4d63a498c33d3c6c3ae /tests/openat.c
parentTODO (diff)
downloadfs-tracer-220d53a4d872e4965a46a6dc90f71e40f6ded3d8.tar.gz
fs-tracer-220d53a4d872e4965a46a6dc90f71e40f6ded3d8.tar.bz2
fs-tracer-220d53a4d872e4965a46a6dc90f71e40f6ded3d8.zip
Add tests
Diffstat (limited to 'tests/openat.c')
-rw-r--r--tests/openat.c26
1 files changed, 26 insertions, 0 deletions
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 <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <fcntl.h>
+
+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;
+}