On Mon, Sep 27, 1999, Cristi Estan wrote:
> I compiled mod_ssl-2.4.3-1.3.9 on a RedHat6.0 Linux and I got an error
> because union semun is not defined. /usr/include/bits/sem.h contains
> this on the subject:
> [...]
> /* according to X/OPEN we have to define it ourselves */
Yes, that's correct. I thought Apache's own NEED_UNION_SEMUN define is
consistent with this, but now I see that it's only defined for Solaris. Tz...
totally broken, of course. So the only portable way is to _always_ define an
own semun union and use this for semctl(2).
> +#ifdef _SEM_SEMUN_UNDEFINED
> +union semun
> + {
> + int val; /* value for SETVAL */
> + struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
> + unsigned short int *array; /* array for GETALL & SETALL */
> + struct seminfo *__buf; /* buffer for IPC_INFO */
> + };
> +
> +
> +#endif
So this patch works, but I propose a more portable solution which doesn't
suffer from namespace conflicts on platforms where semun _is_ defined (like
*BSD). The patch I propose for 2.4.4 is appended.
Ralf S. Engelschall
[EMAIL PROTECTED]
www.engelschall.com
Index: mod_ssl.h
===================================================================
RCS file: /e/modssl/cvs/mod_ssl/pkg.apache/src/modules/ssl/mod_ssl.h,v
retrieving revision 1.113
diff -u -r1.113 mod_ssl.h
--- mod_ssl.h 1999/09/19 09:54:21 1.113
+++ mod_ssl.h 1999/09/28 12:21:03
@@ -264,6 +264,18 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
+/*
+ * Some platforms have a `union semun' pre-defined but Single Unix
+ * Specification (SUSv2) says in semctl(2): `If required, it is of
+ * type union semun, which the application program must explicitly
+ * declare'. So we define it always ourself to avoid problems (but under
+ * a different name to avoid a namespace clash).
+ */
+union ssl_ipc_semun {
+ long val;
+ struct semid_ds *buf;
+ unsigned short int *array;
+};
#endif
#ifdef WIN32
#define SSL_CAN_USE_SEM
Index: ssl_engine_mutex.c
===================================================================
RCS file: /e/modssl/cvs/mod_ssl/pkg.apache/src/modules/ssl/ssl_engine_mutex.c,v
retrieving revision 1.27
diff -u -r1.27 ssl_engine_mutex.c
--- ssl_engine_mutex.c 1999/09/19 09:54:21 1.27
+++ ssl_engine_mutex.c 1999/09/28 12:20:13
@@ -270,22 +270,13 @@
** _________________________________________________________________
*/
-#if defined(SSL_CAN_USE_SEM) && defined(SSL_HAVE_IPCSEM) && defined(NEED_UNION_SEMUN)
-/* some platforms lack the `union semun' definition. Tz... */
-union semun {
- long val;
- struct semid_ds *buf;
- unsigned short int *array;
-};
-#endif
-
void ssl_mutex_sem_create(server_rec *s, pool *p)
{
#ifdef SSL_CAN_USE_SEM
int semid;
SSLModConfigRec *mc = myModConfig();
#ifdef SSL_HAVE_IPCSEM
- union semun semctlarg;
+ union ssl_ipc_semun semctlarg;
struct semid_ds semctlbuf;
#endif
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]