Skip to content

Commit

Permalink
include sys/sysmacros.h for major/minor
Browse files Browse the repository at this point in the history
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

See downstream bug: https://bugs.gentoo.org/580098
  • Loading branch information
vapier authored and Lars Wendler committed Feb 9, 2018
1 parent 108a9fc commit 25691a0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions affinity.c
Expand Up @@ -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>
Expand Down

0 comments on commit 25691a0

Please sign in to comment.