]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
remove socketpair compat.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 25 Jul 2008 09:33:14 +0000 (09:33 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 25 Jul 2008 09:33:14 +0000 (09:33 +0000)
git-svn-id: file:///svn/unbound/trunk@1167 be551aaa-1e26-0410-a405-d3ace91eadb9

compat/socketpair.c [deleted file]
config.h.in
configure
configure.ac
doc/Changelog

diff --git a/compat/socketpair.c b/compat/socketpair.c
deleted file mode 100644 (file)
index 337cd3e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* socketpair.c - windows mingw32 replacement for socketpair.
- * creates a pipe that works like a socketpair a bit
- * Taken from libevent-1.4.3.stable WIN32-Code/misc.c
- * License: BSD.
- */
-#include "config.h"
-#include <stdio.h>
-#include <windows.h>
-
-int
-socketpair(int d, int type, int protocol, int *sv)
-{
-       static int count;
-       char buf[64];
-       HANDLE fd;
-       DWORD dwMode;
-       (void)d; (void)type; (void)protocol;
-       sprintf(buf, "\\\\.\\pipe\\levent-%d", count++);
-       /* Create a duplex pipe which will behave like a socket pair */
-       fd = CreateNamedPipe(buf, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_NOWAIT, 
-               PIPE_UNLIMITED_INSTANCES, 4096, 4096, 0, NULL);
-       if (fd == INVALID_HANDLE_VALUE)
-               return (-1);
-       sv[0] = (int)fd;
-
-       fd = CreateFile(buf, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-       if (fd == INVALID_HANDLE_VALUE)
-               return (-1);
-       dwMode = PIPE_NOWAIT;
-       SetNamedPipeHandleState(fd, &dwMode, NULL, NULL);
-       sv[1] = (int)fd;
-
-       return (0);
-}
index 4b801b101a402032e2ee0bea791717b61a303882..268ce1917820eb5a7f5aa53b4ba731ec1824d658 100644 (file)
 /* Define to 1 if you have the `snprintf' function. */
 #undef HAVE_SNPRINTF
 
-/* Define to 1 if you have the `socketpair' function. */
-#undef HAVE_SOCKETPAIR
-
 /* Using Solaris threads */
 #undef HAVE_SOLARIS_THREADS
 
@@ -552,9 +549,6 @@ struct sockaddr_storage;
 #ifndef HAVE_SRANDOM
 #define srandom(x) srand(x) /* on win32, for tests only (bad random) */
 #endif /* HAVE_SRANDOM */
-#ifndef HAVE_SOCKETPAIR
-int socketpair(int d, int type, int protocol, int *sv);
-#endif
 
 /* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
 #ifdef HAVE_WINSOCK2_H
index b777bbd73c9215b510b282516f036a91b28fadab..e1f1971bbcd4d80938f3f84636972efc92574d16 100755 (executable)
--- a/configure
+++ b/configure
@@ -24000,11 +24000,13 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <stdio.h>
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
 int
 main ()
 {
-return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
   ;
   return 0;
 }
@@ -24044,11 +24046,13 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #define _LARGEFILE_SOURCE 1
-#include <stdio.h>
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
 int
 main ()
 {
-return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
   ;
   return 0;
 }
@@ -25598,107 +25602,6 @@ done
 
 
 
-for ac_func in socketpair
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-else
-  case " $LIBOBJS " in
-  *" $ac_func.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext"
- ;;
-esac
-
-fi
-done
-
-
 # check this after all other compilation checks, since the linking of the lib
 # may break checks after this.
 
index 99b82936ed0ef511648bbc27d36e3a739af025cc..6fd28978e9eeae6c0834e91d1d6ec82145ece3bb 100644 (file)
@@ -823,7 +823,6 @@ AC_REPLACE_FUNCS(snprintf)
 AC_REPLACE_FUNCS(strlcpy)
 AC_REPLACE_FUNCS(memmove)
 AC_REPLACE_FUNCS(gmtime_r)
-AC_REPLACE_FUNCS(socketpair) dnl for mingw32
 
 # check this after all other compilation checks, since the linking of the lib
 # may break checks after this.
@@ -1024,9 +1023,6 @@ struct sockaddr_storage;
 #ifndef HAVE_SRANDOM
 #define srandom(x) srand(x) /* on win32, for tests only (bad random) */
 #endif /* HAVE_SRANDOM */
-#ifndef HAVE_SOCKETPAIR
-int socketpair(int d, int type, int protocol, int *sv);
-#endif
 
 /* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
 #ifdef HAVE_WINSOCK2_H
index 57176714bd110d82cf870c5e76bbde2ecb313d65..711a64c9a20ca782d5ab50d447ac7fd183c44d66 100644 (file)
@@ -2,6 +2,8 @@
        - added original copyright statement of OpenBSD arc4random code.
        - created tube signaling solution on windows, as a pipe replacement.
          this makes background asynchronous resolution work on windows.
+       - removed very insecure socketpair compat code. It also did not
+         work with event_waiting. Solved by pipe replacement.
 
 22 July 2008: Wouter
        - moved pipe actions to util/tube.c. easier porting and shared code.