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

Re: [UNIKRAFT PATCH 04/10] lib/vfscore: Register `chmod` to syscall_shim



Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@xxxxxxxxx>

On 28.04.2020 15:07, Constantin Raducanu wrote:
Registers `chmod` 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        | 14 +++++++-------
  3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index 1cae643..8fef26e 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -37,3 +37,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += truncate-2
  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
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index b897aa7..30e6aba 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -37,6 +37,8 @@ uk_syscall_e_ftruncate
  uk_syscall_r_ftruncate
  stat
  chmod
+uk_syscall_e_chmod
+uk_syscall_r_chmod
  fchmod
  fchown
  dup
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index eb007b9..aa688b8 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -1978,25 +1978,25 @@ UK_TRACEPOINT(trace_vfs_chmod, "\"%s\" 0%0o", const 
char*, mode_t);
  UK_TRACEPOINT(trace_vfs_chmod_ret, "");
  UK_TRACEPOINT(trace_vfs_chmod_err, "%d", int);
-int chmod(const char *pathname, mode_t mode)
+UK_SYSCALL_R_DEFINE(int, chmod, const char*, pathname, mode_t, mode)
  {
        trace_vfs_chmod(pathname, mode);
        struct task *t = main_task;
        char path[PATH_MAX];
        int error = ENOENT;
        if (pathname == NULL)
-               goto out_errno;
+               goto out_error;
        if ((error = task_conv(t, pathname, VWRITE, path)) != 0)
-               goto out_errno;
+               goto out_error;
        error = sys_chmod(path, mode & UK_ALLPERMS);
        if (error)
-               goto out_errno;
+               goto out_error;
        trace_vfs_chmod_ret();
        return 0;
-out_errno:
+
+out_error:
        trace_vfs_chmod_err(error);
-       errno = error;
-       return -1;
+       return -error;
  }
UK_TRACEPOINT(trace_vfs_fchmod, "\"%d\" 0%0o", int, mode_t);




 


Rackspace

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