[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[UNIKRAFT PATCH 05/10] lib/vfscore: Register `fchmod` to syscall_shim



Registers `fchmod` system call to syscall_shim library.

Signed-off-by: Constantin Raducanu <raducanu.costi@xxxxxxxxx>
---
 lib/vfscore/Makefile.uk   | 1 +
 lib/vfscore/exportsyms.uk | 2 ++
 lib/vfscore/main.c        | 9 ++++-----
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index 8fef26e..e77818d 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -38,3 +38,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += access-2
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += faccessat-4
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fallocate-4
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chmod-2
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchmod-2
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 30e6aba..03a02bb 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -40,6 +40,8 @@ chmod
 uk_syscall_e_chmod
 uk_syscall_r_chmod
 fchmod
+uk_syscall_e_fchmod
+uk_syscall_r_fchmod
 fchown
 dup
 dup2
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index aa688b8..d5ece51 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -2002,17 +2002,16 @@ out_error:
 UK_TRACEPOINT(trace_vfs_fchmod, "\"%d\" 0%0o", int, mode_t);
 UK_TRACEPOINT(trace_vfs_fchmod_ret, "");
 
-int fchmod(int fd, mode_t mode)
+UK_SYSCALL_R_DEFINE(int, fchmod, int, fd, mode_t, mode)
 {
        trace_vfs_fchmod(fd, mode);
        int error = sys_fchmod(fd, mode & UK_ALLPERMS);
        trace_vfs_fchmod_ret();
        if (error) {
-               errno = error;
-               return -1;
-       } else {
-               return 0;
+               return -error;
        }
+
+       return 0;
 }
 
 UK_TRACEPOINT(trace_vfs_fchown, "\"%d\" %d %d", int, uid_t, gid_t);
-- 
2.17.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.