[Opendnssec-commits] [svn.opendnssec.org/svn/dnssec] r6693 - in trunk/OpenDNSSEC: . libhsm/src/lib

rickard at opendnssec.org rickard at opendnssec.org
Wed Sep 19 14:12:49 CEST 2012


Author: rb
Date: 2012-09-19 14:12:49 +0200 (Wed, 19 Sep 2012)
New Revision: 6693

Modified:
   trunk/OpenDNSSEC/configure.ac
   trunk/OpenDNSSEC/libhsm/src/lib/pin.c
Log:
Check if union semun is defined


Modified: trunk/OpenDNSSEC/configure.ac
===================================================================
--- trunk/OpenDNSSEC/configure.ac	2012-09-19 12:00:50 UTC (rev 6692)
+++ trunk/OpenDNSSEC/configure.ac	2012-09-19 12:12:49 UTC (rev 6693)
@@ -68,6 +68,20 @@
 AC_TYPE_SIZE_T
 AC_TYPE_UID_T
 AC_TYPE_UINT16_T
+AC_MSG_CHECKING(for union semun)
+AC_TRY_COMPILE([#include <sys/types.h>
+                #include <sys/ipc.h>
+                #include <sys/sem.h>],
+               [union semun arg;],
+               [have_union_semun=1],
+               [have_union_semun=0]
+)
+if test $have_union_semun = 1; then
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(HAVE_UNION_SEMUN, 1, [union semun is defined])
+else
+  AC_MSG_RESULT(no)
+fi
 
 # pthread
 ACX_PTHREAD

Modified: trunk/OpenDNSSEC/libhsm/src/lib/pin.c
===================================================================
--- trunk/OpenDNSSEC/libhsm/src/lib/pin.c	2012-09-19 12:00:50 UTC (rev 6692)
+++ trunk/OpenDNSSEC/libhsm/src/lib/pin.c	2012-09-19 12:12:49 UTC (rev 6693)
@@ -55,6 +55,15 @@
 #define SHM_PERM S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP
 #define SEM_PERM S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP
 
+#ifndef HAVE_UNION_SEMUN
+/* From man page for semctl */
+union semun {
+    int              val;    /* Value for SETVAL */
+    struct semid_ds *buf;    /* Buffer for IPC_STAT, IPC_SET */
+    unsigned short  *array;  /* Array for GETALL, SETALL */
+};
+#endif
+
 /* Remember PIN that we can save */
 static char pin[HSM_MAX_PIN_LENGTH+1];
 
@@ -99,15 +108,6 @@
 {
     int semid;
     struct semid_ds buf;
-
-    /* From man page for semctl */
-    union semun {
-        int              val;    /* Value for SETVAL */
-        struct semid_ds *buf;    /* Buffer for IPC_STAT, IPC_SET */
-        unsigned short  *array;  /* Array for GETALL, SETALL */
-        struct seminfo  *__buf;  /* Buffer for IPC_INFO
-                                    (Linux-specific) */
-    };
     union semun arg;
 
     /* Create/get the semaphore */




More information about the Opendnssec-commits mailing list