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

[UNIKRAFT PATCH 2/5] lib/vfscore: Register `lseek` to syscall_shim



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

diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index 631f351..ec415f4 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -29,4 +29,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += write-3 writev-3
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += read-3 readv-3
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += fstat-2
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += readlink-3
-UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += close-1
\ No newline at end of file
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += close-1
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += lseek-3
\ No newline at end of file
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index cb01f33..5ad97c2 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -89,6 +89,8 @@ uk_syscall_e_readlink
 uk_syscall_r_readlink
 fallocate
 lseek
+uk_syscall_e_lseek
+uk_syscall_r_lseek
 uk_syscall_e_writev
 uk_syscall_r_writev
 umask
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index e970df1..8bbce80 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -262,7 +262,7 @@ UK_TRACEPOINT(trace_vfs_lseek, "%d 0x%x %d", int, off_t, 
int);
 UK_TRACEPOINT(trace_vfs_lseek_ret, "0x%x", off_t);
 UK_TRACEPOINT(trace_vfs_lseek_err, "%d", int);
 
-off_t lseek(int fd, off_t offset, int whence)
+UK_SYSCALL_R_DEFINE(off_t, lseek, int, fd, off_t, offset, int, whence)
 {
        struct vfscore_file *fp;
        off_t org;
@@ -271,20 +271,19 @@ off_t lseek(int fd, off_t offset, int whence)
        trace_vfs_lseek(fd, offset, whence);
        error = fget(fd, &fp);
        if (error)
-               goto out_errno;
+               goto out_error;
 
        error = sys_lseek(fp, offset, whence, &org);
        fdrop(fp);
 
        if (error)
-               goto out_errno;
+               goto out_error;
        trace_vfs_lseek_ret(org);
        return org;
 
-       out_errno:
+       out_error:
        trace_vfs_lseek_err(error);
-       errno = error;
-       return -1;
+       return -error;
 }
 
 LFS64(lseek);
-- 
2.17.1




 


Rackspace

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