You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jeff Trawick <tr...@attglobal.net> on 2002/09/19 11:22:18 UTC

[1.3 PATCH] PR 12072 - fix union semun definition

This is the same fix which was applied to APR prior to Apache 2.0.40's
release.  With 2.0, the problem was first reported on HP-UX/Itanium.
With 1.3, the problem was first reported on Linux/zSeries.

I also removed a bogus comment.  In fact, it is normal for union semun
to not be defined in the header files for user applications.

Before I committed Madhu's fix to APR, I tried in vain to find any
doc which said that the first field should be long instead of int.
With this change to Apache 1.3, SysV sems still work and as far as I
can tell the world did not come to an end, so I'd like to commit this
before 1.3.27 is rolled.

Index: src/CHANGES
===================================================================
RCS file: /home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1851
diff -u -r1.1851 CHANGES
--- src/CHANGES	17 Sep 2002 01:09:18 -0000	1.1851
+++ src/CHANGES	19 Sep 2002 09:13:57 -0000
@@ -1,5 +1,9 @@
 Changes with Apache 1.3.27
 
+  *) Fix a problem with the definition of union semun which broke
+     System V semaphores on systems where sizeof(int) != sizeof(long).
+     PR 12072  [<wi...@de.ibm.com>]
+
   *) The protocol version (eg: HTTP/1.1) in the request line parsing
      is now case insensitive. This closes a few PRs and implies that
      ProtocolReqCheck will trigger on *true* invalid protocols.
Index: src/main/http_main.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.590
diff -u -r1.590 http_main.c
--- src/main/http_main.c	10 Sep 2002 22:51:14 -0000	1.590
+++ src/main/http_main.c	19 Sep 2002 09:14:02 -0000
@@ -749,9 +749,8 @@
 #include <sys/sem.h>
 
 #ifdef NEED_UNION_SEMUN
-/* it makes no sense, but this isn't defined on solaris */
 union semun {
-    long val;
+    int val;
     struct semid_ds *buf;
     ushort *array;
 };

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

Re: [1.3 PATCH] PR 12072 - fix union semun definition

Posted by Justin Erenkrantz <je...@apache.org>.
On Thu, Sep 19, 2002 at 05:22:18AM -0400, Jeff Trawick wrote:
> I also removed a bogus comment.  In fact, it is normal for union semun
> to not be defined in the header files for user applications.

Indeed.

> Before I committed Madhu's fix to APR, I tried in vain to find any
> doc which said that the first field should be long instead of int.
> With this change to Apache 1.3, SysV sems still work and as far as I
> can tell the world did not come to an end, so I'd like to commit this
> before 1.3.27 is rolled.

Stevens Vol. 2 has it as int (pg. 288 and 506).  That's good enough
for me to switch it.

+1 for adding it to 1.3.27.  -- justin

Re: [1.3 PATCH] PR 12072 - fix union semun definition

Posted by gr...@apache.org.
Jeff Trawick wrote:
> 
> This is the same fix which was applied to APR prior to Apache 2.0.40's
> release.  With 2.0, the problem was first reported on HP-UX/Itanium.
> With 1.3, the problem was first reported on Linux/zSeries.
> 
> I also removed a bogus comment.  In fact, it is normal for union semun
> to not be defined in the header files for user applications.
> 
> Before I committed Madhu's fix to APR, I tried in vain to find any
> doc which said that the first field should be long instead of int.
> With this change to Apache 1.3, SysV sems still work and as far as I
> can tell the world did not come to an end, so I'd like to commit this
> before 1.3.27 is rolled.

+1...this seems safe.  

I don't understand why the OSes make us roll our own header, but maybe there was
a good reason for it once upon a time.

Greg