mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
remove socketpair compat.
git-svn-id: file:///svn/unbound/trunk@1167 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
75ac5e0fe0
commit
fe106d38b2
5 changed files with 10 additions and 149 deletions
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
@ -148,9 +148,6 @@
|
||||||
/* Define to 1 if you have the `snprintf' function. */
|
/* Define to 1 if you have the `snprintf' function. */
|
||||||
#undef HAVE_SNPRINTF
|
#undef HAVE_SNPRINTF
|
||||||
|
|
||||||
/* Define to 1 if you have the `socketpair' function. */
|
|
||||||
#undef HAVE_SOCKETPAIR
|
|
||||||
|
|
||||||
/* Using Solaris threads */
|
/* Using Solaris threads */
|
||||||
#undef HAVE_SOLARIS_THREADS
|
#undef HAVE_SOLARIS_THREADS
|
||||||
|
|
||||||
|
|
@ -552,9 +549,6 @@ struct sockaddr_storage;
|
||||||
#ifndef HAVE_SRANDOM
|
#ifndef HAVE_SRANDOM
|
||||||
#define srandom(x) srand(x) /* on win32, for tests only (bad random) */
|
#define srandom(x) srand(x) /* on win32, for tests only (bad random) */
|
||||||
#endif /* HAVE_SRANDOM */
|
#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 */
|
/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
|
|
|
||||||
109
configure
vendored
109
configure
vendored
|
|
@ -24000,11 +24000,13 @@ _ACEOF
|
||||||
cat confdefs.h >>conftest.$ac_ext
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
cat >>conftest.$ac_ext <<_ACEOF
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
#include <sys/types.h> /* for off_t */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
int
|
int
|
||||||
main ()
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -24044,11 +24046,13 @@ cat confdefs.h >>conftest.$ac_ext
|
||||||
cat >>conftest.$ac_ext <<_ACEOF
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
#define _LARGEFILE_SOURCE 1
|
#define _LARGEFILE_SOURCE 1
|
||||||
|
#include <sys/types.h> /* for off_t */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
int
|
int
|
||||||
main ()
|
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;
|
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
|
# check this after all other compilation checks, since the linking of the lib
|
||||||
# may break checks after this.
|
# may break checks after this.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -823,7 +823,6 @@ AC_REPLACE_FUNCS(snprintf)
|
||||||
AC_REPLACE_FUNCS(strlcpy)
|
AC_REPLACE_FUNCS(strlcpy)
|
||||||
AC_REPLACE_FUNCS(memmove)
|
AC_REPLACE_FUNCS(memmove)
|
||||||
AC_REPLACE_FUNCS(gmtime_r)
|
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
|
# check this after all other compilation checks, since the linking of the lib
|
||||||
# may break checks after this.
|
# may break checks after this.
|
||||||
|
|
@ -1024,9 +1023,6 @@ struct sockaddr_storage;
|
||||||
#ifndef HAVE_SRANDOM
|
#ifndef HAVE_SRANDOM
|
||||||
#define srandom(x) srand(x) /* on win32, for tests only (bad random) */
|
#define srandom(x) srand(x) /* on win32, for tests only (bad random) */
|
||||||
#endif /* HAVE_SRANDOM */
|
#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 */
|
/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */
|
||||||
#ifdef HAVE_WINSOCK2_H
|
#ifdef HAVE_WINSOCK2_H
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
- added original copyright statement of OpenBSD arc4random code.
|
- added original copyright statement of OpenBSD arc4random code.
|
||||||
- created tube signaling solution on windows, as a pipe replacement.
|
- created tube signaling solution on windows, as a pipe replacement.
|
||||||
this makes background asynchronous resolution work on windows.
|
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
|
22 July 2008: Wouter
|
||||||
- moved pipe actions to util/tube.c. easier porting and shared code.
|
- moved pipe actions to util/tube.c. easier porting and shared code.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue