]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/vfscore: Register `creat` using the raw variant
authorSergiu Moga <sergiu@unikraft.io>
Mon, 17 Feb 2025 13:50:56 +0000 (15:50 +0200)
committerUnikraft Bot <monkey@unikraft.io>
Mon, 17 Feb 2025 14:47:35 +0000 (14:47 +0000)
The `creat` has been registered as non-raw a long time ago, back
when the registration policy was different. Now, all system calls
should be registered as raw. Do so for `creat` as well and make it
call the `uk_syscall_do_` variant of `open` in order to avoid
invoking the system call enter/exit tables twice.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
GitHub-Closes: #1591

lib/vfscore/main.c

index 2b5c90212e6526cf250e0138e361c3c0004b3bf8..d3caf4b0d171c07732fdf157868d87f10fffaea1 100644 (file)
@@ -236,10 +236,11 @@ int openat(int dirfd, const char *pathname, int flags, ...)
 LFS64(openat);
 #endif /* UK_LIBC_SYSCALLS */
 
-UK_SYSCALL_DEFINE(int, creat, const char*, pathname, mode_t, mode)
+UK_SYSCALL_R_DEFINE(int, creat, const char*, pathname, mode_t, mode)
 {
-       return uk_syscall_e_open((long int) pathname,
-               O_CREAT|O_WRONLY|O_TRUNC, mode);
+       return uk_syscall_do_open((long int)pathname,
+                                 O_CREAT | O_WRONLY | O_TRUNC,
+                                 mode);
 }
 
 #ifdef creat64