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

[UNIKRAFT PATCH 01/10] lib/vfscore: Register `access` to syscall_shim



Registers `access` system call to syscall_shim library.

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

diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index 662a2c8..5d50b5d 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -33,4 +33,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += close-1
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lseek-3
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += link-2
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += ftruncate-2
-UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += truncate-2
\ No newline at end of file
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += truncate-2
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += access-2
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 2805b73..9c1803a 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -89,6 +89,8 @@ symlink
 statvfs
 fstatvfs
 access
+uk_syscall_e_access
+uk_syscall_r_access
 faccessat
 readlink
 uk_syscall_e_readlink
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 1bcafe0..759c41b 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -1592,7 +1592,7 @@ UK_TRACEPOINT(trace_vfs_access_err, "%d", int);
 /*
  * Check permission for file access
  */
-int access(const char *pathname, int mode)
+UK_SYSCALL_R_DEFINE(int, access, const char*, pathname, int, mode)
 {
        trace_vfs_access(pathname, mode);
        struct task *t = main_task;
@@ -1606,17 +1606,17 @@ int access(const char *pathname, int mode)
                acc |= VWRITE;
 
        if ((error = task_conv(t, pathname, acc, path)) != 0)
-               goto out_errno;
+               goto out_error;
 
        error = sys_access(path, mode);
        if (error)
-               goto out_errno;
+               goto out_error;
        trace_vfs_access_ret();
        return 0;
-       out_errno:
-       errno = error;
+
+       out_error:
        trace_vfs_access_err(error);
-       return -1;
+       return -error;
 }
 
 int faccessat(int dirfd, const char *pathname, int mode, int flags)
-- 
2.17.1




 


Rackspace

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