[PATCH 06/10] build-sys: check for union semun instead of using _SEM_SEMUN_UNDEFINED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Older versions of glibc used to declare ‘union semun’ in <sys/sem.h>,
but POSIX.1-2001 requires the caller to declare it instead. Later
versions of glibc started defining _SEM_SEMUN_UNDEFINED to note that
the union was not being declared, but conforming systems are not
required to define that macro (e.g. FreeBSD). As a side effect we get
rid of some obsolete __GNU_LIBRARY__ macro usage.

Signed-off-by: Guillem Jover <guillem@xxxxxxxxxxx>
---
 configure.ac      |    5 +++++
 sys-utils/ipcrm.c |    2 +-
 sys-utils/ipcs.c  |    2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index ed3c3b0..7b11ab1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -469,6 +469,11 @@ printf(__progname);
 ])
 
 
+AC_CHECK_TYPES([union semun], [], [], [[
+#include <sys/sem.h>
+]])
+
+
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #include <wchar.h>
 #include <wctype.h>
diff --git a/sys-utils/ipcrm.c b/sys-utils/ipcrm.c
index 11a5af2..1a6bfc6 100644
--- a/sys-utils/ipcrm.c
+++ b/sys-utils/ipcrm.c
@@ -26,7 +26,7 @@
 /* for tolower and isupper */
 #include <ctype.h>
 
-#if defined (__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
+#if defined (HAVE_UNION_SEMUN)
 /* union semun is defined by including <sys/sem.h> */
 #else
 /* according to X/OPEN we have to define it ourselves */
diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c
index 44355ff..ec0a1c2 100644
--- a/sys-utils/ipcs.c
+++ b/sys-utils/ipcs.c
@@ -77,7 +77,7 @@ struct shm_info {
 /* The last arg of semctl is a union semun, but where is it defined?
    X/OPEN tells us to define it ourselves, but until recently
    Linux include files would also define it. */
-#if defined (__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
+#if defined (HAVE_UNION_SEMUN)
 /* union semun is defined by including <sys/sem.h> */
 #else
 /* according to X/OPEN we have to define it ourselves */
-- 
1.6.4.3

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux