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

Re: [UNIKRAFT PATCH 11/11] lib/vfscore: Register `flock` to syscall_shim



Looks good.

Reviewed-by: Daniel Dinca <dincadaniel97@xxxxxxxxx>

On 02.05.2020 21:18, Constantin Raducanu wrote:
Registers `flock` 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, 13 insertions(+), 4 deletions(-)

diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index dfd33d6..e7f327a 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -53,4 +53,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fsync-1
  UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fdatasync-1
  UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += preadv-4
  UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += umask-1
-UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lstat-2
\ No newline at end of file
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lstat-2
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += flock-2
\ No newline at end of file
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 6061c85..20595e1 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -31,6 +31,8 @@ fstat
  uk_syscall_e_fstat
  uk_syscall_r_fstat
  flock
+uk_syscall_e_flock
+uk_syscall_r_flock
  fhold
  fdrop
  fget
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 8f955ff..746dd7f 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -605,12 +605,14 @@ int fstatat(int dirfd, const char *path, struct stat *st, 
int flags)
LFS64(fstatat); -int flock(int fd, int operation)
+UK_SYSCALL_R_DEFINE(int, flock, int, fd, int, operation)
  {
        struct vfscore_file *file;
+       int error;
if (!fget(fd, &file)) {
-               return libc_error(EBADF);
+               error = EBADF;
+               goto out_error;
        }
switch (operation) {
@@ -621,10 +623,14 @@ int flock(int fd, int operation)
        case LOCK_UN:
                break;
        default:
-               return libc_error(EINVAL);
+               error = EINVAL;
+               goto out_error;
        }
return 0;
+
+       out_error:
+       return -error;
  }
UK_TRACEPOINT(trace_vfs_readdir, "%d %p", int, struct dirent*);




 


Rackspace

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