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

[UNIKRAFT PATCH 07/10] lib/vfscore: Register `fchdir` to syscall_shim



Registers `fchdir` 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        | 11 +++++------
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index 5ccc917..68d108c 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -40,3 +40,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fallocate-4
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chmod-2
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchmod-2
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += chdir-1
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchdir-1
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 64ca3f6..583a75e 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -91,6 +91,8 @@ telldir
 seekdir
 rmdir
 fchdir
+uk_syscall_e_fchdir
+uk_syscall_r_fchdir
 symlink
 statvfs
 fstatvfs
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 8d074fe..c6e446a 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -1040,7 +1040,7 @@ UK_TRACEPOINT(trace_vfs_fchdir, "%d", int);
 UK_TRACEPOINT(trace_vfs_fchdir_ret, "");
 UK_TRACEPOINT(trace_vfs_fchdir_err, "%d", int);
 
-int fchdir(int fd)
+UK_SYSCALL_R_DEFINE(int, fchdir, int, fd)
 {
        trace_vfs_fchdir(fd);
        struct task *t = main_task;
@@ -1049,21 +1049,20 @@ int fchdir(int fd)
 
        error = fget(fd, &fp);
        if (error)
-               goto out_errno;
+               goto out_error;
 
        error = __do_fchdir(fp, t);
        if (error) {
                fdrop(fp);
-               goto out_errno;
+               goto out_error;
        }
 
        trace_vfs_fchdir_ret();
        return 0;
 
-       out_errno:
+       out_error:
        trace_vfs_fchdir_err(error);
-       errno = error;
-       return -1;
+       return -error;
 }
 
 UK_TRACEPOINT(trace_vfs_link, "\"%s\" \"%s\"", const char*, const char*);
-- 
2.17.1




 


Rackspace

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