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

[UNIKRAFT PATCH 02/11] lib/vfscore: Register `pwritev` to syscall_shim



Registers `pwritev` 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        | 12 ++++++------
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index 5906a40..aea4470 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -44,3 +44,4 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fchdir-1
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup-1
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup3-3
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += dup2-2
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += pwritev-4
\ No newline at end of file
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 037537c..b54a6a1 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -79,6 +79,8 @@ closedir
 pread
 pwrite
 pwritev
+uk_syscall_e_pwritev
+uk_syscall_r_pwritev
 readv
 uk_syscall_e_readv
 uk_syscall_r_readv
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 5a287ed..3edcd49 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -418,7 +418,8 @@ UK_TRACEPOINT(trace_vfs_pwritev, "%d %p 0x%x 0x%x", int, 
const struct iovec*,
 UK_TRACEPOINT(trace_vfs_pwritev_ret, "0x%x", ssize_t);
 UK_TRACEPOINT(trace_vfs_pwritev_err, "%d", int);
 
-ssize_t pwritev(int fd, const struct iovec *iov, int iovcnt, off_t offset)
+UK_SYSCALL_R_DEFINE(ssize_t, pwritev, int, fd, const struct iovec*, iov,
+                       int, iovcnt, off_t, offset)
 {
        struct vfscore_file *fp;
        size_t bytes;
@@ -427,20 +428,19 @@ ssize_t pwritev(int fd, const struct iovec *iov, int 
iovcnt, off_t offset)
        trace_vfs_pwritev(fd, iov, iovcnt, offset);
        error = fget(fd, &fp);
        if (error)
-               goto out_errno;
+               goto out_error;
 
        error = sys_write(fp, iov, iovcnt, offset, &bytes);
        fdrop(fp);
 
        if (has_error(error, bytes))
-               goto out_errno;
+               goto out_error;
        trace_vfs_pwritev_ret(bytes);
        return bytes;
 
-       out_errno:
+       out_error:
        trace_vfs_pwritev_err(error);
-       errno = error;
-       return -1;
+       return -error;
 }
 LFS64(pwritev);
 
-- 
2.17.1




 


Rackspace

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