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

[Minios-devel] [UNIKRAFT/NEWLIB PATCH 1/1] Add stubs for C++ libraries



This patch adds the missing stubs needed by the
C++ llvm libraries. It creates a new locale.c
file for the stubs related to the locales.
This patch adds the missing include
to stddef inside mman.h.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
---
 Makefile.uk        |  1 +
 include/sys/mman.h |  2 ++
 locale.c           | 26 ++++++++++++++++++++++++++
 mem.c              |  6 ++++++
 resource.c         |  4 ++++
 time.c             |  5 +++++
 6 files changed, 44 insertions(+)
 create mode 100644 locale.c

diff --git a/Makefile.uk b/Makefile.uk
index 6a918b8..5db32b2 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -108,6 +108,7 @@ LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/process.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/resource.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/pty.c
 LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/time.c|glue
+LIBNEWLIBGLUE_SRCS-y += $(LIBNEWLIBC_BASE)/locale.c
 
 
################################################################################
 # Newlib/libc code -- argz
diff --git a/include/sys/mman.h b/include/sys/mman.h
index cbedba9..7abf57f 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -30,6 +30,8 @@
 extern "C" {
 #endif
 
+#include <stddef.h>
+
 #define __NEED_mode_t
 #define __NEED_size_t
 #define __NEED_off_t
diff --git a/locale.c b/locale.c
new file mode 100644
index 0000000..c38aa3a
--- /dev/null
+++ b/locale.c
@@ -0,0 +1,26 @@
+#include <string.h>
+#include <stddef.h>
+
+int strcoll_l(const char *s1, const char *s2,
+                               locale_t locale)
+{
+       return 0;
+}
+
+size_t strxfrm_l(char *restrict s1, const char *restrict s2,
+                               size_t n, locale_t locale)
+{
+       return 0;
+}
+
+int wcscoll_l(const wchar_t *ws1, const wchar_t *ws2,
+                               locale_t locale)
+{
+       return 0;
+}
+
+size_t wcsxfrm_l(wchar_t *restrict ws1, const wchar_t *restrict ws2,
+                               size_t n, locale_t locale)
+{
+       return 0;
+}
diff --git a/mem.c b/mem.c
index 3eb4db7..5870bcf 100644
--- a/mem.c
+++ b/mem.c
@@ -34,6 +34,7 @@
 
 #include <sys/types.h>
 #include <uk/alloc.h>
+#include <sys/mman.h>
 
 /* Forward to libucallocator calls */
 void *malloc(size_t size)
@@ -66,3 +67,8 @@ void free(void *ptr)
 {
        return uk_free(uk_alloc_get_default(), ptr);
 }
+
+int mprotect(void *addr __unused, size_t len __unused, int prot __unused)
+{
+       return 0;
+}
diff --git a/resource.c b/resource.c
index f76573a..321854f 100644
--- a/resource.c
+++ b/resource.c
@@ -47,3 +47,7 @@ int setrlimit(int resource __unused, const struct rlimit 
*rlim __unused)
        return 0;
 }
 
+long sysconf(int name __unused)
+{
+       return 0;
+}
diff --git a/time.c b/time.c
index 84eccba..fa887ba 100644
--- a/time.c
+++ b/time.c
@@ -102,3 +102,8 @@ int nanosleep(const struct timespec *req, struct timespec 
*rem)
        }
        return 0;
 }
+
+int clock_gettime(clockid_t clk_id __unused, struct timespec *tp __unused)
+{
+       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®.