httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Victor J. Orlikowski" <v.j.orlikow...@gte.net>
Subject [PATCH] Add apr_socklen_t typ
Date Wed, 20 Sep 2000 18:46:15 GMT
Well, I've been going on for the longest time that we needed a
socklen_t to quit AIX from complaining and breaking the build in
mod_cgid.
So here's a patch to create an apr_socklen_t type, with all uses of
socklen_t in APR changed over to it. 
Actually, it sort of clean up the handling of socklen_t, too...
If this gets committed, I'll submit the qiuck fix to mod_cgid.

Index: src/lib/apr/acconfig.h
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/acconfig.h,v
retrieving revision 1.34
diff -u -d -b -r1.34 acconfig.h
--- acconfig.h	2000/07/07 06:07:43	1.34
+++ acconfig.h	2000/09/20 18:03:10
@@ -41,10 +41,6 @@
 /* Make sure we have ssize_t defined to be something */
 #undef ssize_t
 
-#if !defined(HAVE_SOCKLEN_T)
-typedef int socklen_t;
-#endif
-
 /* switch this on if we have a BeOS version below BONE */
 #if BEOS && !HAVE_BONE_VERSION
 #define BEOS_R5 1
Index: src/lib/apr/configure.in
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/configure.in,v
retrieving revision 1.149
diff -u -d -b -r1.149 configure.in
--- configure.in	2000/09/17 21:42:09	1.149
+++ configure.in	2000/09/20 18:03:10
@@ -296,7 +296,7 @@
 AC_CHECK_HEADERS(sys/select.h)
 AC_CHECK_HEADERS(sys/sendfile.h)
 AC_CHECK_HEADERS(sys/signal.h)
-AC_CHECK_HEADERS(sys/socket.h)
+AC_CHECK_HEADERS(sys/socket.h, sys_socketh="1", sys_socketh="0")
 AC_CHECK_HEADERS(sys/stat.h)
 AC_CHECK_HEADERS(sys/types.h, sys_typesh="1", sys_typesh="0")
 AC_CHECK_HEADERS(sys/wait.h, sys_waith="1", sys_waith="0")
@@ -312,6 +312,7 @@
 AC_SUBST(netinet_inh)
 AC_SUBST(stdargh)
 AC_SUBST(stdioh)
+AC_SUBST(sys_socketh)
 AC_SUBST(sys_typesh)
 AC_SUBST(sys_uioh)
 AC_SUBST(signalh)
@@ -377,6 +378,11 @@
 else
     ssize_t_value="apr_int32_t"
 fi
+if test "$ac_cv_socklen_t" = "yes"; then
+    socklen_t_value="socklen_t"
+else
+    socklen_t_value="int"
+fi
 
 AC_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
 
@@ -415,6 +421,7 @@
 AC_SUBST(off_t_value)
 AC_SUBST(size_t_value)
 AC_SUBST(ssize_t_value)
+AC_SUBST(socklen_t_value)
 AC_SUBST(ssize_t_fmt) 
 AC_SUBST(off_t_fmt) 
 
Index: src/lib/apr/include/apr.h.in
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/include/apr.h.in,v
retrieving revision 1.41
diff -u -d -b -r1.41 apr.h.in
--- apr.h.in	2000/09/17 21:42:10	1.41
+++ apr.h.in	2000/09/20 18:03:11
@@ -32,6 +32,7 @@
 #define APR_HAVE_PTHREAD_H      @pthreadh@
 #define APR_HAVE_STDARG_H       @stdargh@
 #define APR_HAVE_STDIO_H        @stdioh@
+#define APR_HAVE_SYS_SOCKET_H   @sys_socketh@
 #define APR_HAVE_SYS_TYPES_H    @sys_typesh@
 #define APR_HAVE_SYS_UIO_H      @sys_uioh@
 #define APR_HAVE_SIGNAL_H       @signalh@
@@ -78,6 +79,10 @@
 #include <sys/types.h>
 #endif
 
+#if APR_HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
 /*  APR Feature Macros */
 #define APR_HAS_SHARED_MEMORY     @sharedmem@
 #define APR_HAS_THREADS           @threads@
@@ -113,6 +118,7 @@
 typedef  @size_t_value@          apr_size_t;
 typedef  @ssize_t_value@         apr_ssize_t;
 typedef  @off_t_value@           apr_off_t;
+typedef  @socklen_t_value@       apr_socklen_t;
 
 /* Definitions that APR programs need to work properly. */
 
Index: src/lib/apr/network_io/unix/networkio.h
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/network_io/unix/networkio.h,v
retrieving revision 1.31
diff -u -d -b -r1.31 networkio.h
--- networkio.h	2000/08/02 05:26:29	1.31
+++ networkio.h	2000/09/20 18:03:11
@@ -121,7 +121,7 @@
     int socketdes;
     struct sockaddr_in *local_addr;
     struct sockaddr_in *remote_addr;
-    socklen_t addr_len;
+    apr_socklen_t addr_len;
     apr_interval_time_t timeout; 
 #ifndef HAVE_POLL
     int connected;
Index: src/lib/apr/network_io/unix/sendrecv.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/network_io/unix/sendrecv.c,v
retrieving revision 1.39
diff -u -d -b -r1.39 sendrecv.c
--- sendrecv.c	2000/08/06 06:07:22	1.39
+++ sendrecv.c	2000/09/20 18:03:11
@@ -224,7 +224,7 @@
     /* Linux only for now */
 
     int nodelay_off = 0, corkflag = 1, rv, delayflag;
-    socklen_t delaylen = sizeof(delayflag);
+    apr_socklen_t delaylen = sizeof(delayflag);
 
     /* XXX it would be cheaper to use an apr_socket_t flag here */
     rv = getsockopt(sock->socketdes, SOL_TCP, TCP_NODELAY,
Index: src/lib/apr/network_io/unix/sockaddr.c
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/network_io/unix/sockaddr.c,v
retrieving revision 1.15
diff -u -d -b -r1.15 sockaddr.c
--- sockaddr.c	2000/08/02 05:26:29	1.15
+++ sockaddr.c	2000/09/20 18:03:11
@@ -73,7 +73,7 @@
 
 static apr_status_t get_local_addr(apr_socket_t *sock)
 {
-    socklen_t namelen = sizeof(*sock->local_addr);
+    apr_socklen_t namelen = sizeof(*sock->local_addr);
 
     if (getsockname(sock->socketdes, (struct sockaddr *)sock->local_addr, 
                     &namelen) < 0) {

Victor
-- 
Victor J. Orlikowski
======================
v.j.orlikowski@gte.net
vjo@raleigh.ibm.com
vjo@us.ibm.com


Mime
View raw message