Permalink
Browse files

Portability fixes to build on Musl libc as well as glibc

Signed-off-by: Justin Cormack <justin.cormack@unikernel.com>
  • Loading branch information...
1 parent adbb255 commit e09f698b58685a25f414a33be283da83a453de39 @justincormack justincormack committed with justincormack Dec 24, 2015
Showing with 12 additions and 4 deletions.
  1. +6 −1 gcc-preinclude.h
  2. +1 −0 src/apps/solarflare/ef_vi.h
  3. +1 −0 src/apps/vhost/vhost_user.c
  4. +1 −1 src/core/lib.c
  5. +1 −1 src/core/memory.c
  6. +2 −1 src/lib/traceprof/traceprof.c
View
@@ -2,7 +2,12 @@
// See: http://www.win.tue.nl/~aeb/linux/misc/gcc-semibug.html
// https://rjpower9000.wordpress.com/2012/04/09/fun-with-shared-libraries-version-glibc_2-14-not-found/
+#define _GNU_SOURCE 1
+
+#include <features.h>
+
#ifndef __ASSEMBLER__
+#ifdef __GLIBC__
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
#endif
-
+#endif
@@ -1,3 +1,4 @@
+#include <time.h>
/* etherfabric/base.h */
@@ -3,6 +3,7 @@
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
+#include <string.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/un.h>
View
@@ -2,7 +2,7 @@
#include <time.h>
#include <sys/stat.h>
#include <sys/time.h>
-#include <sys/unistd.h>
+#include <unistd.h>
/* Return the current wall-clock time in nanoseconds. */
uint64_t get_time_ns()
View
@@ -9,7 +9,7 @@
// virtual addresses (remove the tag bits) and to test addresses for
// validity (check the tag bits).
-#define _GNU_SOURCE
+#define _GNU_SOURCE 1
#include <assert.h>
#include <fcntl.h>
@@ -1,8 +1,9 @@
// Location where the next instruction pointer value will be stored.
+#define _GNU_SOURCE 1
+
#include <assert.h>
#include <stdio.h>
-#define __USE_GNU
#include <stdint.h>
#include <stdlib.h>
#include <sys/time.h>

0 comments on commit e09f698

Please sign in to comment.