[systemd-devel] [PATCH 1/2] missing: Redefine aligned_alloc() to memalign() if we don't have C11

Henrik Grindal Bakken hgb at ifi.uio.no
Wed Apr 17 09:17:33 PDT 2013


---
 src/shared/missing.h |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/shared/missing.h b/src/shared/missing.h
index d4ba0d3..7f49a6d 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -23,6 +23,11 @@
 
 /* Missing glibc definitions to access certain kernel APIs */
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <features.h>
 #include <sys/resource.h>
 #include <sys/syscall.h>
 #include <fcntl.h>
@@ -265,3 +270,8 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle
 #ifndef TFD_TIMER_CANCEL_ON_SET
 #define TFD_TIMER_CANCEL_ON_SET (1 << 1)
 #endif
+
+#ifndef _ISOC11_SOURCE
+#include <malloc.h>
+#define aligned_alloc memalign
+#endif
-- 
1.7.10.1



More information about the systemd-devel mailing list