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

[UNIKRAFT PATCH 2/8] lib/vfscore: Register `stat` to syscall_shim



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

diff --git a/lib/vfscore/Makefile.uk b/lib/vfscore/Makefile.uk
index ad06a4b..c8451e7 100644
--- a/lib/vfscore/Makefile.uk
+++ b/lib/vfscore/Makefile.uk
@@ -55,4 +55,5 @@ 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
-UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += unlink-1
\ No newline at end of file
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += unlink-1
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBVFSCORE) += stat-2
\ No newline at end of file
diff --git a/lib/vfscore/exportsyms.uk b/lib/vfscore/exportsyms.uk
index 47d50a2..3e9642b 100644
--- a/lib/vfscore/exportsyms.uk
+++ b/lib/vfscore/exportsyms.uk
@@ -40,6 +40,8 @@ ftruncate
 uk_syscall_e_ftruncate
 uk_syscall_r_ftruncate
 stat
+uk_syscall_e_stat
+uk_syscall_r_stat
 chmod
 uk_syscall_e_chmod
 uk_syscall_r_chmod
diff --git a/lib/vfscore/main.c b/lib/vfscore/main.c
index fcf4873..db190b9 100644
--- a/lib/vfscore/main.c
+++ b/lib/vfscore/main.c
@@ -1173,28 +1173,27 @@ int __xstat(int ver __unused, const char *pathname, 
struct stat *st)
 
        error = task_conv(t, pathname, 0, path);
        if (error)
-               goto out_errno;
+               goto out_error;
 
        error = sys_stat(path, st);
        if (error)
-               goto out_errno;
+               goto out_error;
        trace_vfs_stat_ret();
        return 0;
 
-       out_errno:
+       out_error:
        trace_vfs_stat_err(error);
-       errno = error;
-       return -1;
+       return -error;
 }
 
 LFS64(__xstat);
 
-int stat(const char *pathname, struct stat *st)
+UK_SYSCALL_R_DEFINE(int, stat, const char*, pathname, struct stat*, st)
 {
        if (!pathname) {
-               errno = EINVAL;
-               return -1;
+               return -EINVAL;
        }
+
        return __xstat(1, pathname, st);
 }
 
-- 
2.17.1




 


Rackspace

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