[PATCH] include sys/sysmacros.h for major/minor
Mike Frysinger <[email protected]> Mon, 18 Apr 2016 18:57:14 -0400
| Newsgroups | org.kernel.vger.linux-numa |
|---|---|
| Message-ID | <[email protected]> |
These functions are not part of any official spec, and glibc has always
kept them in sys/sysmacros.h. As glibc moves to conform to POSIX, and
more alternative C libraries come up, we need to include this header
explicitly to get the prototypes. Otherwise we fail to build like:
affinity.c: In function 'affinity_file':
affinity.c:177:7: warning: implicit declaration of function 'major' [-Wimplicit-function-declaration]
if (major(d) != maj || minor(d) != min)
^
affinity.c:177:26: warning: implicit declaration of function 'minor' [-Wimplicit-function-declaration]
if (major(d) != maj || minor(d) != min)
^
./.libs/libnuma.so: undefined reference to 'minor'
./.libs/libnuma.so: undefined reference to 'major'
collect2: error: ld returned 1 exit status
Signed-off-by: Mike Frysinger <[email protected]>
---
affinity.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/affinity.c b/affinity.c
index 9fbd6af..984291c 100644
--- a/affinity.c
+++ b/affinity.c
@@ -40,6 +40,7 @@
#include <linux/rtnetlink.h>
#include <linux/netlink.h>
#include <sys/types.h>
+#include <sys/sysmacros.h>
#include <ctype.h>
#include <assert.h>
#include <regex.h>
--
2.7.4