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

[Minios-devel] [UNIKRAFT PATCH v2 2/3] lib/posix-sysinfo: Register `uname` to syscall_shim



Registers `uname` system call to syscall_shim library. The
implementation is changed to be a raw system call.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 lib/posix-sysinfo/Makefile.uk   | 2 ++
 lib/posix-sysinfo/exportsyms.uk | 2 ++
 lib/posix-sysinfo/sysinfo.c     | 9 ++++-----
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/posix-sysinfo/Makefile.uk b/lib/posix-sysinfo/Makefile.uk
index c25b8abc..7aa60224 100644
--- a/lib/posix-sysinfo/Makefile.uk
+++ b/lib/posix-sysinfo/Makefile.uk
@@ -4,3 +4,5 @@ CINCLUDES-$(CONFIG_LIBPOSIX_SYSINFO)   += 
-I$(LIBPOSIX_SYSINFO_BASE)/include
 CXXINCLUDES-$(CONFIG_LIBPOSIX_SYSINFO) += -I$(LIBPOSIX_SYSINFO_BASE)/include
 
 LIBPOSIX_SYSINFO_SRCS-$(CONFIG_LIBPOSIX_SYSINFO) += 
$(LIBPOSIX_SYSINFO_BASE)/sysinfo.c
+
+UK_PROVIDED_SYSCALLS-$(CONFIG_LIBPOSIX_SYSINFO) += uname-1
diff --git a/lib/posix-sysinfo/exportsyms.uk b/lib/posix-sysinfo/exportsyms.uk
index d5131332..addc4990 100644
--- a/lib/posix-sysinfo/exportsyms.uk
+++ b/lib/posix-sysinfo/exportsyms.uk
@@ -5,5 +5,7 @@ confstr
 pathconf
 getpagesize
 uname
+uk_syscall_e_uname
+uk_syscall_r_uname
 gethostname
 sethostname
diff --git a/lib/posix-sysinfo/sysinfo.c b/lib/posix-sysinfo/sysinfo.c
index fe746ad3..abcbb79d 100644
--- a/lib/posix-sysinfo/sysinfo.c
+++ b/lib/posix-sysinfo/sysinfo.c
@@ -41,6 +41,7 @@
 #include <uk/essentials.h>
 #include <uk/config.h>
 #include <sys/sysinfo.h>
+#include <uk/syscall.h>
 
 static struct utsname utsname = {
        .sysname        = "Unikraft",
@@ -94,12 +95,10 @@ int getpagesize(void)
        return __PAGE_SIZE;
 }
 
-int uname(struct utsname *buf __unused)
+UK_SYSCALL_R_DEFINE(int, uname, struct utsname *, buf)
 {
-       if (buf == NULL) {
-               errno = EFAULT;
-               return -1;
-       }
+       if (buf == NULL)
+               return -EFAULT;
 
        memcpy(buf, &utsname, sizeof(struct utsname));
        return 0;
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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