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

[UNIKRAFT PATCH 08/11] lib/vfscore: Register `preadv` to syscall_shim



Registers `preadv` 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 a643c03..5c64046 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -50,4 +50,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += mknod-3
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rmdir-1
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += rename-2
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fsync-1
-UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fdatasync-1
\ No newline at end of file
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fdatasync-1
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += preadv-4
\ No newline at end of file
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index d297957..46c7437 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -94,6 +94,8 @@ mknod
 uk_syscall_e_mknod
 uk_syscall_r_mknod
 preadv
+uk_syscall_e_preadv
+uk_syscall_r_preadv
 ioctl
 fdatasync
 uk_syscall_e_fdatasync
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 25da26b..e7b0e90 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -381,7 +381,8 @@ UK_SYSCALL_DEFINE(ssize_t, write, int, fd, const void *, 
buf, size_t, count)
        return pwrite(fd, buf, count, -1);
 }
 
-ssize_t preadv(int fd, const struct iovec *iov, int iovcnt, off_t offset)
+UK_SYSCALL_R_DEFINE(ssize_t, preadv, int, fd, const struct iovec*, iov,
+       int, iovcnt, off_t, offset)
 {
        struct vfscore_file *fp;
        size_t bytes;
@@ -389,18 +390,17 @@ ssize_t preadv(int fd, const struct iovec *iov, int 
iovcnt, off_t offset)
 
        error = fget(fd, &fp);
        if (error)
-               goto out_errno;
+               goto out_error;
 
        error = sys_read(fp, iov, iovcnt, offset, &bytes);
        fdrop(fp);
 
        if (has_error(error, bytes))
-               goto out_errno;
+               goto out_error;
        return bytes;
 
-       out_errno:
-       errno = error;
-       return -1;
+       out_error:
+       return -error;
 }
 
 LFS64(preadv);
-- 
2.17.1




 


Rackspace

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