- Timestamp:
- Apr 5, 2017, 9:51:43 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/config.h.in
r511 r522 934 934 /* Define to 1 if you have the `uname' function. */ 935 935 #undef HAVE_UNAME 936 937 /* union semun already defined in sys/ipc.h or sys/sem.h */ 938 #undef HAVE_UNION_SEMUN 936 939 937 940 /* Define to 1 if you have the <unistd.h> header file. */ -
trunk/configure.ac
r521 r522 672 672 fi 673 673 674 AC_MSG_CHECKING(for union semun) 675 AC_TRY_COMPILE([#include <sys/types.h> 676 #include <sys/ipc.h> 677 #include <sys/sem.h>],[union semun foo;], [sh_have_semun=yes], [sh_have_semun=no]) 678 AC_MSG_RESULT($sh_have_semun) 679 if test x$sh_have_semun = xyes 680 then 681 AC_DEFINE(HAVE_UNION_SEMUN, 1, [union semun already defined in sys/ipc.h or sys/sem.h]) 682 fi 674 683 675 684 dnl ***************************************** -
trunk/docs/Changelog
r521 r522 1 1 4.2.1: 2 * fix alignment problem with semget() (reported by Rolf) 2 3 * fix dependency on chkconfig package on Redhat/CentOS: search 3 4 /etc/init.d/functions also under /etc/rc.d/init.d/functions -
trunk/src/sh_sem.c
r481 r522 44 44 } sh_estat; 45 45 46 #if 0 46 47 47 /* FreeBSD 6.1 defines this in <sys/sem.h> too... */ 48 48 #if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) 49 49 /* union semun is defined by including <sys/sem.h> */ 50 50 #else 51 #if !defined(HAVE_UNION_SEMUN) 51 52 /* according to X/OPEN we have to define it ourselves */ 52 53 union semun { … … 58 59 #endif 59 60 61 60 62 #define SH_SEMVMX 32767 61 63 … … 75 77 static void sem_purge(int sem_id) 76 78 { 79 union semun tmp; 80 81 tmp.val = 0; 82 77 83 if (sem_id != -1) 78 semctl(sem_id, 0, IPC_RMID, (int)0);84 semctl(sem_id, 0, IPC_RMID, tmp); 79 85 return; 80 86 } … … 103 109 int semid; 104 110 int errnum; 111 union semun tmp; 105 112 key_t key = ftok(DEFAULT_DATAROOT, '#'); 106 113 … … 112 119 errnum = errno; 113 120 umask(mask); 121 122 tmp.val = 1; 114 123 115 124 if (semid < 0) 116 125 return report_err(errnum, FIL__, __LINE__, _("semget")); 117 126 for (i=0; i<nsems; ++i) 118 if (semctl (semid, i, SETVAL, (int) 1) == -1)127 if (semctl (semid, i, SETVAL, tmp) == -1) 119 128 return report_err(errnum, FIL__, __LINE__, _("semclt")); 120 129 return semid; … … 124 133 static int sem_set(int semid, int sem_no, int val) 125 134 { 135 union semun tmp; 136 137 tmp.val = val; 138 126 139 if (semid < 0) 127 140 return -1; 128 if (semctl (semid, sem_no, SETVAL, val) == -1)141 if (semctl (semid, sem_no, SETVAL, tmp) == -1) 129 142 return -1; 130 143 return 0; … … 133 146 static int sem_get(int semid, int sem_no) 134 147 { 148 union semun tmp; 135 149 if (semid < 0) 136 150 return -1; 137 return semctl (semid, sem_no, GETVAL, (int) 0); 151 tmp.val = 0; 152 return semctl (semid, sem_no, GETVAL, tmp); 138 153 } 139 154
Note:
See TracChangeset
for help on using the changeset viewer.