Add an Akaros-only sysdeps/akaros/bits/{stdlib,string}-akaros.h
with prototypes for reallocarray and strlcpy and strlcat respectively.
Modify sysdeps/stdlib.h and sysdeps/string.h to include those headers,
respectively.  Modify Makefile and Versions to export these functions.

Tested: Wrote, compiled and ran a C program that used all three functions.
Change-Id: Ie1c86c261c398f2db67b1968d51e446b84e42293
Signed-off-by: Dan Cross <[email protected]>
---
 .../gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Makefile        | 10 ++++++++++
 .../gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Versions        |  5 +++++
 .../glibc-2.19-akaros/sysdeps/akaros/bits/stdlib-akaros.h      |  1 +
 .../glibc-2.19-akaros/sysdeps/akaros/bits/string-akaros.h      |  2 ++
 .../gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/stdlib.h        |  4 ++++
 .../gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/string.h        |  4 ++++
 6 files changed, 26 insertions(+)
 create mode 100644 
tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/bits/stdlib-akaros.h
 create mode 100644 
tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/bits/string-akaros.h

diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Makefile 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Makefile
index fb7c1a5..38cbb74 100644
--- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Makefile
+++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Makefile
@@ -46,6 +46,16 @@ ifeq ($(subdir),stdlib)
 sysdep_routines += sched_getcpu
 endif
 
+# Imports from OpenBSD.
+ifeq ($(subdir),stdlib)
+sysdep_routines += reallocarray
+endif
+ifeq ($(subdir),string)
+sysdep_routines += strlcat
+sysdep_routines += strlcpy
+endif
+sysdep_headers += stdlib.h string.h bits/stdlib-akaros.h bits/string-akaros.h
+
 # Syscall pack arg routines
 ifeq ($(subdir),stdlib)
 sysdep_routines += serialize
diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Versions 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Versions
index b0e8e32..a35e2e5 100644
--- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Versions
+++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Versions
@@ -42,6 +42,11 @@ libc {
     serialize_argv_envp;
     free_serialized_data;
 
+    # Imports from other OpenBSD.
+    reallocarray;
+    strlcat;
+    strlcpy;
+
     # helper functions from resolv (which we don't build)
     __h_errno_location;
 
diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/bits/stdlib-akaros.h
 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/bits/stdlib-akaros.h
new file mode 100644
index 0000000..0ab724d
--- /dev/null
+++ 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/bits/stdlib-akaros.h
@@ -0,0 +1 @@
+void *reallocarray(void *ptr, size_t nmemb, size_t size);
diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/bits/string-akaros.h
 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/bits/string-akaros.h
new file mode 100644
index 0000000..82df09d
--- /dev/null
+++ 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/bits/string-akaros.h
@@ -0,0 +1,2 @@
+size_t strlcpy(char *dst, const char *src, size_t dstsize);
+size_t strlcat(char *dst, const char *src, size_t dstsize);
diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/stdlib.h 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/stdlib.h
index d35ffac..1eb54ad 100644
--- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/stdlib.h
+++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/stdlib.h
@@ -33,6 +33,10 @@
 
 __BEGIN_DECLS
 
+#ifdef __ros__
+#include <bits/stdlib-akaros.h>
+#endif
+
 #ifndef __need_malloc_and_calloc
 #define        _STDLIB_H       1
 
diff --git 
a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/string.h 
b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/string.h
index b127e8d..1457cb7 100644
--- a/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/string.h
+++ b/tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/string.h
@@ -31,6 +31,10 @@ __BEGIN_DECLS
 #define        __need_NULL
 #include <stddef.h>
 
+#ifdef __ros__
+#include <bits/string-akaros.h>
+#endif
+
 /* Provide correct C++ prototypes, and indicate this to the caller.  This
    requires a compatible C++ standard library.  As a heuristic, we provide
    these when the compiler indicates full conformance with C++98 or later,
-- 
2.8.0.rc3.226.g39d4020

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to