All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] include sys/sysmacros.h for major/minor
@ 2016-04-18 22:57 Mike Frysinger
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2016-04-18 22:57 UTC (permalink / raw)
  To: linux-numa

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 <vapier@gentoo.org>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] include sys/sysmacros.h for major/minor
  2016-04-20 16:52 Mike Frysinger
@ 2016-04-21 11:47 ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2016-04-21 11:47 UTC (permalink / raw)
  To: Mike Frysinger, fio

On 04/20/2016 12:52 PM, Mike Frysinger wrote:
> These functions have always been defined in sys/sysmacros.h under
> Linux C libraries.  For some, including sys/types.h implicitly
> includes that as well, but glibc wants to deprecate that, and some
> others already have.  Include the header explicitly for the funcs.
>
> The mtd change is already in upstream mtd-utils too.

Added, thanks.

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] include sys/sysmacros.h for major/minor
@ 2016-04-20 16:52 Mike Frysinger
  2016-04-21 11:47 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2016-04-20 16:52 UTC (permalink / raw)
  To: fio

These functions have always been defined in sys/sysmacros.h under
Linux C libraries.  For some, including sys/types.h implicitly
includes that as well, but glibc wants to deprecate that, and some
others already have.  Include the header explicitly for the funcs.

The mtd change is already in upstream mtd-utils too.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 os/os-linux.h         | 1 +
 oslib/libmtd_common.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/os/os-linux.h b/os/os-linux.h
index 9e708f0..23c16b6 100644
--- a/os/os-linux.h
+++ b/os/os-linux.h
@@ -6,6 +6,7 @@
 #include <sys/ioctl.h>
 #include <sys/uio.h>
 #include <sys/syscall.h>
+#include <sys/sysmacros.h>
 #include <sys/vfs.h>
 #include <sys/mman.h>
 #include <unistd.h>
diff --git a/oslib/libmtd_common.h b/oslib/libmtd_common.h
index a123323..9768066 100644
--- a/oslib/libmtd_common.h
+++ b/oslib/libmtd_common.h
@@ -30,6 +30,7 @@
 #include <errno.h>
 #include <features.h>
 #include <inttypes.h>
+#include <sys/sysmacros.h>
 
 #ifndef PROGRAM_NAME
 # error "You must define PROGRAM_NAME before including this header"
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-21 11:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-18 22:57 [PATCH] include sys/sysmacros.h for major/minor Mike Frysinger
2016-04-20 16:52 Mike Frysinger
2016-04-21 11:47 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.