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

[UNIKRAFT PATCH 1/8] lib/vfscore: Register `unlink` to syscall_shim



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

diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index e7f327a..ad06a4b 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -54,4 +54,5 @@ 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
-UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += flock-2
\ No newline at end of file
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += flock-2
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += unlink-1
\ No newline at end of file
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 20595e1..47d50a2 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -64,6 +64,8 @@ link
 uk_syscall_e_link
 uk_syscall_r_link
 unlink
+uk_syscall_e_unlink
+uk_syscall_r_unlink
 getcwd
 chown
 chroot
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index 746dd7f..fcf4873 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -1135,7 +1135,7 @@ UK_TRACEPOINT(trace_vfs_unlink, "\"%s\"", const char*);
 UK_TRACEPOINT(trace_vfs_unlink_ret, "");
 UK_TRACEPOINT(trace_vfs_unlink_err, "%d", int);
 
-int unlink(const char *pathname)
+UK_SYSCALL_R_DEFINE(int, unlink, const char*, pathname)
 {
        trace_vfs_unlink(pathname);
        struct task *t = main_task;
@@ -1144,19 +1144,19 @@ int unlink(const char *pathname)
 
        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_unlink(path);
        if (error)
-               goto out_errno;
+               goto out_error;
        trace_vfs_unlink_ret();
        return 0;
-       out_errno:
+
+       out_error:
        trace_vfs_unlink_err(error);
-       errno = error;
-       return -1;
+       return -error;
 }
 
 UK_TRACEPOINT(trace_vfs_stat, "\"%s\" %p", const char*, struct stat*);
-- 
2.17.1




 


Rackspace

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