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

[UNIKRAFT PATCH 6/8] lib/vfscore: Register `symlink` to syscall_shim



Registers `symlink` 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 5b2c4fb..fcd5c8c 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -59,4 +59,5 @@ UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += unlink-1
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += stat-2
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += open-3
 UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += mkdir-2
-UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += creat-2
\ No newline at end of file
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += creat-2
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += symlink-2
\ No newline at end of file
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 34c6540..413ea99 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -126,6 +126,8 @@ fchdir
 uk_syscall_e_fchdir
 uk_syscall_r_fchdir
 symlink
+uk_syscall_e_symlink
+uk_syscall_r_symlink
 statvfs
 fstatvfs
 access
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index c026796..fa43e0e 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -1113,7 +1113,7 @@ UK_TRACEPOINT(trace_vfs_symlink, "oldpath=%s, 
newpath=%s", const char*,
 UK_TRACEPOINT(trace_vfs_symlink_ret, "");
 UK_TRACEPOINT(trace_vfs_symlink_err, "errno=%d", int);
 
-int symlink(const char *oldpath, const char *newpath)
+UK_SYSCALL_R_DEFINE(int, symlink, const char*, oldpath, const char*, newpath)
 {
        int error;
 
@@ -1121,20 +1121,20 @@ int symlink(const char *oldpath, const char *newpath)
 
        error = ENOENT;
        if (oldpath == NULL || newpath == NULL) {
-               errno = ENOENT;
-               trace_vfs_symlink_err(error);
-               return (-1);
+               goto out_error;
        }
 
        error = sys_symlink(oldpath, newpath);
        if (error) {
-               errno = error;
-               trace_vfs_symlink_err(error);
-               return (-1);
+               goto out_error;
        }
 
        trace_vfs_symlink_ret();
        return 0;
+
+       out_error:
+       trace_vfs_symlink_err(error);
+       return -error;
 }
 
 UK_TRACEPOINT(trace_vfs_unlink, "\"%s\"", const char*);
-- 
2.17.1




 


Rackspace

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