Incorporate new functions into glibc and expose to userland (XCC)
authorDan Cross <crossd@gmail.com>
Thu, 2 Jun 2016 22:28:20 +0000 (18:28 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 3 Jun 2016 12:36:58 +0000 (08:36 -0400)
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.

Rebuild glibc.

Tested: Wrote, compiled and ran a C program that used all three functions.
Change-Id: Ie1c86c261c398f2db67b1968d51e446b84e42293
Signed-off-by: Dan Cross <crossd@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Makefile
tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/Versions
tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/bits/stdlib-akaros.h [new file with mode: 0644]
tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/bits/string-akaros.h [new file with mode: 0644]
tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/stdlib.h
tools/compilers/gcc-glibc/glibc-2.19-akaros/sysdeps/akaros/string.h

index fb7c1a5..38cbb74 100644 (file)
@@ -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
index b0e8e32..a35e2e5 100644 (file)
@@ -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 (file)
index 0000000..0ab724d
--- /dev/null
@@ -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 (file)
index 0000000..82df09d
--- /dev/null
@@ -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);
index d35ffac..1eb54ad 100644 (file)
 
 __BEGIN_DECLS
 
+#ifdef __ros__
+#include <bits/stdlib-akaros.h>
+#endif
+
 #ifndef __need_malloc_and_calloc
 #define        _STDLIB_H       1
 
index b127e8d..1457cb7 100644 (file)
@@ -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,