You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/05/04 05:43:51 UTC
cvs commit: apache-2.0/src/lib/apr/network_io/unix sockets.c
trawick 00/05/03 20:43:50
Modified: src/lib/apr aclocal.m4 configure.in threads.m4
src/lib/apr/network_io/unix sockets.c
Log:
Add support to APR configuration to recognize several non-standard
characteristics of OS/390, at least two of which are shared with
some other platforms:
1) whether or not the character set is an EBCDIC variant
2) whether or not gethostbyname() supports numeric address strings
(e.g., gethostbyname("127.0.0.1"))
3) whether or not pthread_getspecific() has two arguments (for most
platforms it has one argument)
The Unix ap_connect() now has logic to handle numeric address
strings when gethostbyname() can't handle them.
Revision Changes Path
1.13 +61 -0 apache-2.0/src/lib/apr/aclocal.m4
Index: aclocal.m4
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/aclocal.m4,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- aclocal.m4 2000/05/03 00:00:54 1.12
+++ aclocal.m4 2000/05/04 03:43:47 1.13
@@ -161,6 +161,49 @@
undefine([AC_CV_NAME])dnl
])
+dnl
+dnl check for gethostbyname() which handles numeric address strings
+dnl
+
+AC_DEFUN(APR_CHECK_GETHOSTBYNAME_NAS,[
+ AC_CACHE_CHECK(for gethostbyname() which handles numeric address strings, ac_cv_gethostbyname_nas,[
+ AC_TRY_RUN( [
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+void main(void) {
+ struct hostent *he = gethostbyname("127.0.0.1");
+ if (he == NULL) {
+ exit(1);
+ }
+ else {
+ exit(0);
+ }
+}
+],[
+ ac_cv_gethostbyname_nas="yes"
+],[
+ ac_cv_gethostbyname_nas="no"
+],[
+ ac_cv_gethostbyname_nas="yes"
+])])
+if test "$ac_cv_gethostbyname_nas" = "yes"; then
+ AC_DEFINE(GETHOSTBYNAME_HANDLES_NAS, 1, [Define if gethostbyname() handles nnn.nnn.nnn.nnn])
+fi
+])
+
dnl
dnl check for socklen_t, fall back to unsigned int
dnl
@@ -195,6 +238,24 @@
AC_DEFUN(AC_PROG_RANLIB_NC,
[AC_CHECK_PROG(RANLIB, ranlib, ranlib, true)])
+
+AC_DEFUN(APR_EBCDIC,[
+ AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[
+ AC_TRY_RUN( [
+int main(void) {
+ return (unsigned char)'A' != (unsigned char)0xC1;
+}
+],[
+ ac_cv_ebcdic="yes"
+],[
+ ac_cv_ebcdic="no"
+],[
+ ac_cv_ebcdic="no"
+])])
+ if test "$ac_cv_ebcdic" = "yes"; then
+ AC_DEFINE(CHARSET_EBCDIC,, [Define if system uses EBCDIC])
+ fi
+])
sinclude(threads.m4)
sinclude(hints.m4)
1.88 +8 -2 apache-2.0/src/lib/apr/configure.in
Index: configure.in
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/configure.in,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- configure.in 2000/05/03 15:49:45 1.87
+++ configure.in 2000/05/04 03:43:48 1.88
@@ -50,6 +50,8 @@
# This macro needs to be here in case we are on an AIX box.
AC_AIX
+APR_EBCDIC
+
# Use /bin/sh if it exists, otherwise go looking for sh in the path
if test ".$SH" = . -a -f /bin/sh; then
SH="/bin/sh"
@@ -353,6 +355,8 @@
fi
fi
+APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS
+
ac_cv_define_READDIR_IS_THREAD_SAFE=no
AC_CHECK_LIB(c_r, readdir, AC_DEFINE(READDIR_IS_THREAD_SAFE))
@@ -495,7 +499,7 @@
AC_SUBST(anonymous_shm)
AC_SUBST(filebased_shm)
AC_SUBST(keybased_shm)
-
+
dnl #----------------------------- Checking for /dev/random
AC_MSG_CHECKING(for /dev/random)
@@ -529,7 +533,7 @@
fi
dnl #----------------------------- Checking for Networking Support
-echo $ac_n "${nl}Checking for Networking support..."
+echo $ac_n "${nl}Checking for Networking support...${nl}"
AC_MSG_CHECKING(looking for in_addr in netinet/in.h)
AC_TRY_COMPILE([
#include <netinet/in.h>
@@ -542,6 +546,8 @@
AC_MSG_RESULT([$msg])
AC_SUBST(have_in_addr)
+
+APR_CHECK_GETHOSTBYNAME_NAS
dnl #----------------------------- Prepare mm directory for VPATH support
if test -n "$USE_MM" && test -n "$USE_VPATH"; then
1.7 +21 -0 apache-2.0/src/lib/apr/threads.m4
Index: threads.m4
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/threads.m4,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- threads.m4 2000/04/30 18:01:21 1.6
+++ threads.m4 2000/05/04 03:43:48 1.7
@@ -33,6 +33,27 @@
CPPFLAGS="$CPPFLAGS $PTHREAD_FLAGS"
fi
])dnl
+
+AC_DEFUN(APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS, [
+AC_CACHE_CHECK(whether pthread_getspecific takes two arguments, ac_cv_pthread_getspecific_two_args,[
+AC_TRY_COMPILE([
+#include <pthread.h>
+],[
+pthread_key_t key;
+void *tmp;
+pthread_getspecific(key,&tmp);
+],[
+ ac_cv_pthread_getspecific_two_args=yes
+],[
+ ac_cv_pthread_getspecific_two_args=no
+])
+])
+
+if test "$ac_cv_pthread_getspecific_two_args" = "yes"; then
+ AC_DEFINE(PTHREAD_GETSPECIFIC_TAKES_TWO_ARGS, 1, [Define if pthread_getspecific() has two args])
+fi
+
+])dnl
dnl
dnl PTHREADS_CHECK_COMPILE
dnl
1.42 +11 -0 apache-2.0/src/lib/apr/network_io/unix/sockets.c
Index: sockets.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockets.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- sockets.c 2000/04/30 21:17:57 1.41
+++ sockets.c 2000/05/04 03:43:49 1.42
@@ -170,6 +170,14 @@
struct hostent *hp;
if (hostname != NULL) {
+#ifndef GETHOSTBYNAME_HANDLES_NAS
+ if (*hostname >= '0' && *hostname <= '9' &&
+ strspn(hostname, "0123456789.") == strlen(hostname)) {
+ sock->remote_addr->sin_addr.s_addr = inet_addr(hostname);
+ sock->addr_len = sizeof(*sock->remote_addr);
+ }
+ else {
+#endif
hp = gethostbyname(hostname);
if ((sock->socketdes < 0) || (!sock->remote_addr)) {
@@ -182,6 +190,9 @@
memcpy((char *)&sock->remote_addr->sin_addr, hp->h_addr_list[0], hp->h_length);
sock->addr_len = sizeof(*sock->remote_addr);
+#ifndef GETHOSTBYNAME_HANDLES_NAS
+ }
+#endif
}
if ((connect(sock->socketdes, (const struct sockaddr *)sock->remote_addr, sock->addr_len) < 0) &&