summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/auto-aux/gethostbyaddr.c13
-rw-r--r--config/auto-aux/gethostbyname.c14
-rw-r--r--config/s-templ.h6
-rwxr-xr-xconfigure4
-rw-r--r--otherlibs/unix/gethost.c18
5 files changed, 18 insertions, 37 deletions
diff --git a/config/auto-aux/gethostbyaddr.c b/config/auto-aux/gethostbyaddr.c
index 5a10598ee..c5dd12971 100644
--- a/config/auto-aux/gethostbyaddr.c
+++ b/config/auto-aux/gethostbyaddr.c
@@ -13,6 +13,11 @@
/* $Id$ */
+#ifndef _REENTRANT
+/* This helps detection on Digital Unix... */
+#define _REENTRANT
+#endif
+
#include <sys/types.h>
#include <netdb.h>
@@ -41,14 +46,6 @@ int main(int argc, char ** argv)
int rc;
rc = gethostbyaddr_r(address, length, type, &h,
buffer, buflen, &hp, &h_errnop);
-#elif NUM_ARGS == 5
- char * address;
- int length;
- int type;
- struct hostent h;
- struct hostent_data hdata;
- int rc;
- rc = gethostbyaddr_r(address, length, type, &h, &hdata);
#endif
return 0;
}
diff --git a/config/auto-aux/gethostbyname.c b/config/auto-aux/gethostbyname.c
index fa475b16d..043b9d334 100644
--- a/config/auto-aux/gethostbyname.c
+++ b/config/auto-aux/gethostbyname.c
@@ -13,6 +13,11 @@
/* $Id$ */
+#ifndef _REENTRANT
+/* This helps detection on Digital Unix... */
+#define _REENTRANT
+#endif
+
#include <sys/types.h>
#include <netdb.h>
@@ -21,21 +26,16 @@ int main(int argc, char ** argv)
#if NUM_ARGS == 5
struct hostent *hp;
struct hostent h;
- char buffer[10];
+ char buffer[1000];
int h_errno;
hp = gethostbyname_r("www.caml.org", &h, buffer, 10, &h_errno);
#elif NUM_ARGS == 6
struct hostent *hp;
struct hostent h;
- char buffer[10];
+ char buffer[1000];
int h_errno;
int rc;
rc = gethostbyname_r("www.caml.org", &h, buffer, 10, &hp, &h_errno);
-#elif NUM_ARGS == 3
- struct hostent h;
- struct hostent_data hdata;
- int rc;
- rc = gethostbyname_r("www.caml.org", &h, &hdata);
#endif
return 0;
}
diff --git a/config/s-templ.h b/config/s-templ.h
index 9904b4759..8411ce41c 100644
--- a/config/s-templ.h
+++ b/config/s-templ.h
@@ -196,10 +196,12 @@
/* Define HAS_GETHOSTBYNAME_R if gethostbyname_r() is available.
The value of this symbol is the number of arguments of
- gethostbyname_r(): either 3, 5 or 6 depending on prototype. */
+ gethostbyname_r(): either 5 or 6 depending on prototype.
+ (5 is the Solaris version, 6 is the Linux version). */
#define HAS_GETHOSTBYADDR_R 8
/* Define HAS_GETHOSTBYADDR_R if gethostbyname_r() is available.
The value of this symbol is the number of arguments of
- gethostbyaddr_r(): either 5, 7 or 8 depending on prototype. */
+ gethostbyaddr_r(): either 7 or 8 depending on prototype.
+ (7 is the Solaris version, 8 is the Linux version). */
diff --git a/configure b/configure
index 788a5bb50..de670fb58 100755
--- a/configure
+++ b/configure
@@ -911,7 +911,7 @@ if sh ./hasgot -i sys/types.h -i sys/mman.h && sh ./hasgot mmap munmap; then
fi
nargs=none
-for i in 5 6 3; do
+for i in 5 6; do
if sh ./trycompile -DNUM_ARGS=${i} gethostbyname.c; then nargs=$i; break; fi
done
if test $nargs != "none"; then
@@ -920,7 +920,7 @@ if test $nargs != "none"; then
fi
nargs=none
-for i in 7 8 5; do
+for i in 7 8; do
if sh ./trycompile -DNUM_ARGS=${i} gethostbyaddr.c; then nargs=$i; break; fi
done
if test $nargs != "none"; then
diff --git a/otherlibs/unix/gethost.c b/otherlibs/unix/gethost.c
index c1584ea6c..167485088 100644
--- a/otherlibs/unix/gethost.c
+++ b/otherlibs/unix/gethost.c
@@ -94,14 +94,6 @@ CAMLprim value unix_gethostbyaddr(value a)
&h, buffer, sizeof(buffer), &hp, &h_errnop);
leave_blocking_section();
if (rc != 0) hp = NULL;
-#elif HAS_GETHOSTBYADDR_R == 5
- struct hostent h;
- struct hostent_data hdata;
- int rc;
- enter_blocking_section();
- rc = gethostbyaddr_r((char *) &adr, 4, AF_INET, &h, &hdata);
- leave_blocking_section();
- hp = rc == 0 ? &h : NULL;
#else
#ifdef GETHOSTBYADDR_IS_REENTRANT
enter_blocking_section();
@@ -146,16 +138,6 @@ CAMLprim value unix_gethostbyname(value name)
leave_blocking_section();
if (rc != 0) hp = NULL;
}
-#elif HAS_GETHOSTBYNAME_R == 3
- {
- struct hostent h;
- struct hostent_data hdata;
- int rc;
- enter_blocking_section();
- rc = gethostbyname_r(hostname, &h, &hdata);
- leave_blocking_section();
- hp = rc == 0 ? &h : NULL;
- }
#else
#ifdef GETHOSTBYNAME_IS_REENTRANT
enter_blocking_section();