summaryrefslogtreecommitdiff
path: root/gl
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2014-03-06 18:33:31 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2014-03-06 18:33:31 +0100
commit32557a59a152613c1b795d8853497e4634410e27 (patch)
tree537657b0a424e6775d4bb0c9e69fc579313a606c /gl
parente18ff9c093edf2512aa4c17988c2c2172faf9e3d (diff)
downloadgnutls-32557a59a152613c1b795d8853497e4634410e27.tar.gz
removed all networking code from libgl
Diffstat (limited to 'gl')
-rw-r--r--gl/Makefile.am21
-rw-r--r--gl/bind.c49
-rw-r--r--gl/connect.c56
-rw-r--r--gl/m4/arpa_inet_h.m457
-rw-r--r--gl/m4/gnulib-cache.m44
-rw-r--r--gl/m4/gnulib-comp.m452
-rw-r--r--gl/m4/inet_pton.m468
-rw-r--r--gl/m4/socketlib.m486
-rw-r--r--gl/m4/sockets.m417
-rw-r--r--gl/stdint.in.h3
-rw-r--r--gl/sys_types.in.h2
-rw-r--r--gl/tests/Makefile.am105
-rw-r--r--gl/tests/test-arpa_inet.c27
-rw-r--r--gl/tests/test-bind.c58
-rw-r--r--gl/tests/test-connect.c60
-rw-r--r--gl/tests/test-inet_pton.c58
-rw-r--r--gl/tests/test-sockets.c46
-rw-r--r--gl/tests/w32sock.h136
-rw-r--r--gl/w32sock.h136
19 files changed, 5 insertions, 1036 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am
index a3d5d25df6..dd42ba7f39 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 bind byteswap c-ctype connect extensions func gendocs gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings
+# Reproduce by: gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 byteswap c-ctype extensions func gendocs gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings
AUTOMAKE_OPTIONS = 1.9.6 gnits
@@ -51,7 +51,6 @@ libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
EXTRA_libgnu_la_SOURCES =
libgnu_la_LDFLAGS = $(AM_LDFLAGS)
libgnu_la_LDFLAGS += -no-undefined
-libgnu_la_LDFLAGS += $(LIBSOCKET)
libgnu_la_LDFLAGS += $(LTLIBICONV)
libgnu_la_LDFLAGS += $(LTLIBINTL)
@@ -104,15 +103,6 @@ libgnu_la_SOURCES += base64.h base64.c
## end gnulib module base64
-## begin gnulib module bind
-
-
-EXTRA_DIST += bind.c w32sock.h
-
-EXTRA_libgnu_la_SOURCES += bind.c
-
-## end gnulib module bind
-
## begin gnulib module byteswap
BUILT_SOURCES += $(BYTESWAP_H)
@@ -142,15 +132,6 @@ libgnu_la_SOURCES += c-ctype.h c-ctype.c
## end gnulib module c-ctype
-## begin gnulib module connect
-
-
-EXTRA_DIST += connect.c w32sock.h
-
-EXTRA_libgnu_la_SOURCES += connect.c
-
-## end gnulib module connect
-
## begin gnulib module errno
BUILT_SOURCES += $(ERRNO_H)
diff --git a/gl/bind.c b/gl/bind.c
deleted file mode 100644
index e3619cab90..0000000000
--- a/gl/bind.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* bind.c --- wrappers for Windows bind function
-
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#undef bind
-
-int
-rpl_bind (int fd, const struct sockaddr *sockaddr, socklen_t len)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
-
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- int r = bind (sock, sockaddr, len);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
- }
-}
diff --git a/gl/connect.c b/gl/connect.c
deleted file mode 100644
index 10919fc2b1..0000000000
--- a/gl/connect.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* connect.c --- wrappers for Windows connect function
-
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <config.h>
-
-#define WIN32_LEAN_AND_MEAN
-/* Get winsock2.h. */
-#include <sys/socket.h>
-
-/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
-
-#undef connect
-
-int
-rpl_connect (int fd, const struct sockaddr *sockaddr, socklen_t len)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
-
- if (sock == INVALID_SOCKET)
- {
- errno = EBADF;
- return -1;
- }
- else
- {
- int r = connect (sock, sockaddr, len);
- if (r < 0)
- {
- /* EINPROGRESS is not returned by WinSock 2.0; for backwards
- compatibility, connect(2) uses EWOULDBLOCK. */
- if (WSAGetLastError () == WSAEWOULDBLOCK)
- WSASetLastError (WSAEINPROGRESS);
-
- set_winsock_errno ();
- }
-
- return r;
- }
-}
diff --git a/gl/m4/arpa_inet_h.m4 b/gl/m4/arpa_inet_h.m4
deleted file mode 100644
index f01699a9d3..0000000000
--- a/gl/m4/arpa_inet_h.m4
+++ /dev/null
@@ -1,57 +0,0 @@
-# arpa_inet_h.m4 serial 13
-dnl Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl Written by Simon Josefsson and Bruno Haible
-
-AC_DEFUN([gl_HEADER_ARPA_INET],
-[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
- AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
-
- AC_CHECK_HEADERS_ONCE([arpa/inet.h])
- if test $ac_cv_header_arpa_inet_h = yes; then
- HAVE_ARPA_INET_H=1
- else
- HAVE_ARPA_INET_H=0
- fi
- AC_SUBST([HAVE_ARPA_INET_H])
- dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK.
- gl_CHECK_NEXT_HEADERS([arpa/inet.h])
-
- AC_REQUIRE([gl_FEATURES_H])
-
- dnl Check for declarations of anything we want to poison if the
- dnl corresponding gnulib module is not in use.
- gl_WARN_ON_USE_PREPARE([[
-/* On some systems, this header is not self-consistent. */
-#if !(defined __GLIBC__ || defined __UCLIBC__)
-# include <sys/socket.h>
-#endif
-#ifdef __TANDEM
-# include <netdb.h>
-#endif
-#include <arpa/inet.h>
- ]], [inet_ntop inet_pton])
-])
-
-AC_DEFUN([gl_ARPA_INET_MODULE_INDICATOR],
-[
- dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
- AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
- gl_MODULE_INDICATOR_SET_VARIABLE([$1])
-])
-
-AC_DEFUN([gl_ARPA_INET_H_DEFAULTS],
-[
- GNULIB_INET_NTOP=0; AC_SUBST([GNULIB_INET_NTOP])
- GNULIB_INET_PTON=0; AC_SUBST([GNULIB_INET_PTON])
- dnl Assume proper GNU behavior unless another module says otherwise.
- HAVE_DECL_INET_NTOP=1; AC_SUBST([HAVE_DECL_INET_NTOP])
- HAVE_DECL_INET_PTON=1; AC_SUBST([HAVE_DECL_INET_PTON])
- REPLACE_INET_NTOP=0; AC_SUBST([REPLACE_INET_NTOP])
- REPLACE_INET_PTON=0; AC_SUBST([REPLACE_INET_PTON])
-])
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4
index f3791069b4..b8047930e8 100644
--- a/gl/m4/gnulib-cache.m4
+++ b/gl/m4/gnulib-cache.m4
@@ -27,17 +27,15 @@
# Specification in the form of a command-line invocation:
-# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 bind byteswap c-ctype connect extensions func gendocs gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings
+# gnulib-tool --import --dir=. --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca base64 byteswap c-ctype extensions func gendocs gettext gettimeofday hash-pjw-bare havelib iconv intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r u64 unistd valgrind-tests vasprintf vsnprintf warnings
# Specification in the form of a few gnulib-tool.m4 macro invocations:
gl_LOCAL_DIR([gl/override])
gl_MODULES([
alloca
base64
- bind
byteswap
c-ctype
- connect
extensions
func
gendocs
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index a75a55b6d2..64dc2b3eed 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -42,20 +42,14 @@ AC_DEFUN([gl_EARLY],
# Code from module alloca:
# Code from module alloca-opt:
# Code from module alloca-opt-tests:
- # Code from module arpa_inet:
- # Code from module arpa_inet-tests:
# Code from module base64:
# Code from module base64-tests:
# Code from module binary-io:
# Code from module binary-io-tests:
- # Code from module bind:
- # Code from module bind-tests:
# Code from module byteswap:
# Code from module byteswap-tests:
# Code from module c-ctype:
# Code from module c-ctype-tests:
- # Code from module connect:
- # Code from module connect-tests:
# Code from module errno:
# Code from module errno-tests:
# Code from module extensions:
@@ -63,7 +57,6 @@ AC_DEFUN([gl_EARLY],
# Code from module extern-inline:
# Code from module fcntl-h:
# Code from module fcntl-h-tests:
- # Code from module fd-hook:
# Code from module fdopen:
# Code from module fdopen-tests:
# Code from module fgetc-tests:
@@ -96,8 +89,6 @@ AC_DEFUN([gl_EARLY],
# Code from module iconv:
# Code from module iconv-tests:
# Code from module include_next:
- # Code from module inet_pton:
- # Code from module inet_pton-tests:
# Code from module intprops:
# Code from module intprops-tests:
# Code from module inttypes:
@@ -133,9 +124,6 @@ AC_DEFUN([gl_EARLY],
# Code from module snippet/warn-on-use:
# Code from module snprintf:
# Code from module snprintf-tests:
- # Code from module socketlib:
- # Code from module sockets:
- # Code from module sockets-tests:
# Code from module socklen:
# Code from module ssize_t:
# Code from module stdalign:
@@ -218,17 +206,7 @@ changequote([, ])dnl
AC_SUBST([LTALLOCA])
gl_FUNC_ALLOCA
gl_FUNC_BASE64
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([bind])
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([bind])
gl_BYTESWAP
- AC_REQUIRE([gl_HEADER_SYS_SOCKET])
- if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([connect])
- fi
- gl_SYS_SOCKET_MODULE_INDICATOR([connect])
gl_HEADER_ERRNO_H
AC_REQUIRE([gl_EXTERN_INLINE])
gl_FLOAT_H
@@ -330,7 +308,6 @@ AC_SUBST([LTALLOCA])
gl_FUNC_SNPRINTF
gl_STDIO_MODULE_INDICATOR([snprintf])
gl_MODULE_INDICATOR([snprintf])
- gl_SOCKETLIB
gl_TYPE_SOCKLEN_T
gt_TYPE_SSIZE_T
gl_STDALIGN_H
@@ -448,8 +425,6 @@ changequote([, ])dnl
AC_SUBST([gltests_WITNESS])
gl_module_indicator_condition=$gltests_WITNESS
m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition])
- gl_HEADER_ARPA_INET
- AC_PROG_MKDIR_P
gl_FCNTL_H
gl_FUNC_FDOPEN
if test $REPLACE_FDOPEN = 1; then
@@ -464,20 +439,12 @@ changequote([, ])dnl
AC_LIBOBJ([getpagesize])
fi
gl_UNISTD_MODULE_INDICATOR([getpagesize])
- gl_FUNC_INET_PTON
- if test $HAVE_INET_PTON = 0 || test $REPLACE_INET_NTOP = 1; then
- AC_LIBOBJ([inet_pton])
- gl_PREREQ_INET_PTON
- fi
- gl_ARPA_INET_MODULE_INDICATOR([inet_pton])
- AC_C_BIGENDIAN
gl_INTTYPES_H
gl_INTTYPES_INCOMPLETE
dnl Check for prerequisites for memory fence checks.
gl_FUNC_MMAP_ANON
AC_CHECK_HEADERS_ONCE([sys/mman.h])
AC_CHECK_FUNCS_ONCE([mprotect])
- gl_SOCKETS
AC_REQUIRE([gt_TYPE_WCHAR_T])
AC_REQUIRE([gt_TYPE_WINT_T])
dnl Check for prerequisites for memory fence checks.
@@ -597,11 +564,9 @@ AC_DEFUN([gl_FILE_LIST], [
lib/asprintf.c
lib/base64.c
lib/base64.h
- lib/bind.c
lib/byteswap.in.h
lib/c-ctype.c
lib/c-ctype.h
- lib/connect.c
lib/errno.in.h
lib/float+.h
lib/float.c
@@ -669,14 +634,12 @@ AC_DEFUN([gl_FILE_LIST], [
lib/vasprintf.c
lib/verify.h
lib/vsnprintf.c
- lib/w32sock.h
lib/wchar.in.h
lib/xsize.c
lib/xsize.h
m4/00gnulib.m4
m4/absolute-header.m4
m4/alloca.m4
- m4/arpa_inet_h.m4
m4/base64.m4
m4/byteswap.m4
m4/codeset.m4
@@ -702,7 +665,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/gnulib-common.m4
m4/iconv.m4
m4/include_next.m4
- m4/inet_pton.m4
m4/intdiv0.m4
m4/intl.m4
m4/intldir.m4
@@ -744,8 +706,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/realloc.m4
m4/size_max.m4
m4/snprintf.m4
- m4/socketlib.m4
- m4/sockets.m4
m4/socklen.m4
m4/sockpfaf.m4
m4/ssize_t.m4
@@ -789,14 +749,11 @@ AC_DEFUN([gl_FILE_LIST], [
tests/macros.h
tests/signature.h
tests/test-alloca-opt.c
- tests/test-arpa_inet.c
tests/test-base64.c
tests/test-binary-io.c
tests/test-binary-io.sh
- tests/test-bind.c
tests/test-byteswap.c
tests/test-c-ctype.c
- tests/test-connect.c
tests/test-errno.c
tests/test-fcntl-h.c
tests/test-fdopen.c
@@ -819,7 +776,6 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-fwrite.c
tests/test-gettimeofday.c
tests/test-iconv.c
- tests/test-inet_pton.c
tests/test-init.sh
tests/test-intprops.c
tests/test-inttypes.c
@@ -828,7 +784,6 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-netinet_in.c
tests/test-read-file.c
tests/test-snprintf.c
- tests/test-sockets.c
tests/test-stdalign.c
tests/test-stdbool.c
tests/test-stddef.c
@@ -857,20 +812,13 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-vsnprintf.c
tests/test-wchar.c
tests/zerosize-ptr.h
- tests=lib/arpa_inet.in.h
tests=lib/binary-io.c
tests=lib/binary-io.h
tests=lib/fcntl.in.h
- tests=lib/fd-hook.c
- tests=lib/fd-hook.h
tests=lib/fdopen.c
tests=lib/fpucw.h
tests=lib/getpagesize.c
- tests=lib/inet_pton.c
tests=lib/inttypes.in.h
- tests=lib/sockets.c
- tests=lib/sockets.h
- tests=lib/w32sock.h
top/GNUmakefile
top/maint.mk
])
diff --git a/gl/m4/inet_pton.m4 b/gl/m4/inet_pton.m4
deleted file mode 100644
index 136ed24d05..0000000000
--- a/gl/m4/inet_pton.m4
+++ /dev/null
@@ -1,68 +0,0 @@
-# inet_pton.m4 serial 17
-dnl Copyright (C) 2006, 2008-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_INET_PTON],
-[
- AC_REQUIRE([gl_ARPA_INET_H_DEFAULTS])
-
- dnl Persuade Solaris <arpa/inet.h> to declare inet_pton.
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- AC_REQUIRE([AC_C_RESTRICT])
-
- dnl Most platforms that provide inet_pton define it in libc.
- dnl Solaris 8..10 provide inet_pton in libnsl instead.
- dnl Solaris 2.6..7 provide inet_pton in libresolv instead.
- dnl Native Windows provides it in -lws2_32 instead, with a declaration in
- dnl <ws2tcpip.h>, and it uses stdcall calling convention, not cdecl
- dnl (hence we cannot use AC_CHECK_FUNCS, AC_SEARCH_LIBS to find it).
- HAVE_INET_PTON=1
- INET_PTON_LIB=
- gl_PREREQ_SYS_H_WINSOCK2
- if test $HAVE_WINSOCK2_H = 1; then
- AC_CHECK_DECLS([inet_pton],,, [[#include <ws2tcpip.h>]])
- if test $ac_cv_have_decl_inet_pton = yes; then
- dnl It needs to be overridden, because the stdcall calling convention
- dnl is not compliant with POSIX.
- REPLACE_INET_PTON=1
- INET_PTON_LIB="-lws2_32"
- else
- HAVE_DECL_INET_PTON=0
- HAVE_INET_PTON=0
- fi
- else
- gl_save_LIBS=$LIBS
- AC_SEARCH_LIBS([inet_pton], [nsl resolv], [],
- [AC_CHECK_FUNCS([inet_pton])
- if test $ac_cv_func_inet_pton = no; then
- HAVE_INET_PTON=0
- fi
- ])
- LIBS=$gl_save_LIBS
-
- if test "$ac_cv_search_inet_pton" != "no" \
- && test "$ac_cv_search_inet_pton" != "none required"; then
- INET_PTON_LIB="$ac_cv_search_inet_pton"
- fi
-
- AC_CHECK_HEADERS_ONCE([netdb.h])
- AC_CHECK_DECLS([inet_pton],,,
- [[#include <arpa/inet.h>
- #if HAVE_NETDB_H
- # include <netdb.h>
- #endif
- ]])
- if test $ac_cv_have_decl_inet_pton = no; then
- HAVE_DECL_INET_PTON=0
- fi
- fi
- AC_SUBST([INET_PTON_LIB])
-])
-
-# Prerequisites of lib/inet_pton.c.
-AC_DEFUN([gl_PREREQ_INET_PTON], [
- AC_REQUIRE([gl_SOCKET_FAMILIES])
-])
diff --git a/gl/m4/socketlib.m4 b/gl/m4/socketlib.m4
deleted file mode 100644
index 041498baf7..0000000000
--- a/gl/m4/socketlib.m4
+++ /dev/null
@@ -1,86 +0,0 @@
-# socketlib.m4 serial 1
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl gl_SOCKETLIB
-dnl Determines the library to use for socket functions.
-dnl Sets and AC_SUBSTs LIBSOCKET.
-
-AC_DEFUN([gl_SOCKETLIB],
-[
- gl_PREREQ_SYS_H_WINSOCK2 dnl for HAVE_WINSOCK2_H
- LIBSOCKET=
- if test $HAVE_WINSOCK2_H = 1; then
- dnl Native Windows API (not Cygwin).
- AC_CACHE_CHECK([if we need to call WSAStartup in winsock2.h and -lws2_32],
- [gl_cv_func_wsastartup], [
- gl_save_LIBS="$LIBS"
- LIBS="$LIBS -lws2_32"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
-#ifdef HAVE_WINSOCK2_H
-# include <winsock2.h>
-#endif]], [[
- WORD wVersionRequested = MAKEWORD(1, 1);
- WSADATA wsaData;
- int err = WSAStartup(wVersionRequested, &wsaData);
- WSACleanup ();]])],
- gl_cv_func_wsastartup=yes, gl_cv_func_wsastartup=no)
- LIBS="$gl_save_LIBS"
- ])
- if test "$gl_cv_func_wsastartup" = "yes"; then
- AC_DEFINE([WINDOWS_SOCKETS], [1], [Define if WSAStartup is needed.])
- LIBSOCKET='-lws2_32'
- fi
- else
- dnl Unix API.
- dnl Solaris has most socket functions in libsocket.
- dnl Haiku has most socket functions in libnetwork.
- dnl BeOS has most socket functions in libnet.
- AC_CACHE_CHECK([for library containing setsockopt], [gl_cv_lib_socket], [
- gl_cv_lib_socket=
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [],
- [gl_save_LIBS="$LIBS"
- LIBS="$gl_save_LIBS -lsocket"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [gl_cv_lib_socket="-lsocket"])
- if test -z "$gl_cv_lib_socket"; then
- LIBS="$gl_save_LIBS -lnetwork"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [gl_cv_lib_socket="-lnetwork"])
- if test -z "$gl_cv_lib_socket"; then
- LIBS="$gl_save_LIBS -lnet"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern
-#ifdef __cplusplus
-"C"
-#endif
-char setsockopt();]], [[setsockopt();]])],
- [gl_cv_lib_socket="-lnet"])
- fi
- fi
- LIBS="$gl_save_LIBS"
- ])
- if test -z "$gl_cv_lib_socket"; then
- gl_cv_lib_socket="none needed"
- fi
- ])
- if test "$gl_cv_lib_socket" != "none needed"; then
- LIBSOCKET="$gl_cv_lib_socket"
- fi
- fi
- AC_SUBST([LIBSOCKET])
-])
diff --git a/gl/m4/sockets.m4 b/gl/m4/sockets.m4
deleted file mode 100644
index da6ff74278..0000000000
--- a/gl/m4/sockets.m4
+++ /dev/null
@@ -1,17 +0,0 @@
-# sockets.m4 serial 7
-dnl Copyright (C) 2008-2014 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_SOCKETS],
-[
- AC_REQUIRE([AC_C_INLINE])
- AC_REQUIRE([gl_SOCKETLIB])
- gl_PREREQ_SOCKETS
-])
-
-# Prerequisites of lib/sockets.c.
-AC_DEFUN([gl_PREREQ_SOCKETS], [
- :
-])
diff --git a/gl/stdint.in.h b/gl/stdint.in.h
index 18b661a149..ef4cf91ea5 100644
--- a/gl/stdint.in.h
+++ b/gl/stdint.in.h
@@ -38,8 +38,7 @@
other system header files; just include the system's <stdint.h>.
Ideally we should test __BIONIC__ here, but it is only defined after
<sys/cdefs.h> has been included; hence test __ANDROID__ instead. */
-#if defined __ANDROID__ \
- && defined _SYS_TYPES_H_ && !defined __need_size_t
+#if defined __ANDROID__ && defined _GL_INCLUDING_SYS_TYPES_H
# @INCLUDE_NEXT@ @NEXT_STDINT_H@
#else
diff --git a/gl/sys_types.in.h b/gl/sys_types.in.h
index 6896277c75..40c8d57b04 100644
--- a/gl/sys_types.in.h
+++ b/gl/sys_types.in.h
@@ -23,7 +23,9 @@
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
/* The include_next requires a split double-inclusion guard. */
+# define _GL_INCLUDING_SYS_TYPES_H
#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
+# undef _GL_INCLUDING_SYS_TYPES_H
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
#define _@GUARD_PREFIX@_SYS_TYPES_H
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am
index cfe3486819..3cbf0dc3e0 100644
--- a/gl/tests/Makefile.am
+++ b/gl/tests/Makefile.am
@@ -67,50 +67,6 @@ EXTRA_DIST += test-alloca-opt.c
## end gnulib module alloca-opt-tests
-## begin gnulib module arpa_inet
-
-BUILT_SOURCES += arpa/inet.h
-
-# We need the following in order to create <arpa/inet.h> when the system
-# doesn't have one.
-arpa/inet.h: arpa_inet.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
- $(AM_V_at)$(MKDIR_P) arpa
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
- sed -e 's|@''GUARD_PREFIX''@|GL|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
- -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \
- -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \
- -e 's/@''GNULIB_INET_NTOP''@/$(GNULIB_INET_NTOP)/g' \
- -e 's/@''GNULIB_INET_PTON''@/$(GNULIB_INET_PTON)/g' \
- -e 's|@''HAVE_DECL_INET_NTOP''@|$(HAVE_DECL_INET_NTOP)|g' \
- -e 's|@''HAVE_DECL_INET_PTON''@|$(HAVE_DECL_INET_PTON)|g' \
- -e 's|@''REPLACE_INET_NTOP''@|$(REPLACE_INET_NTOP)|g' \
- -e 's|@''REPLACE_INET_PTON''@|$(REPLACE_INET_PTON)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
- < $(srcdir)/arpa_inet.in.h; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += arpa/inet.h arpa/inet.h-t
-MOSTLYCLEANDIRS += arpa
-
-EXTRA_DIST += arpa_inet.in.h
-
-## end gnulib module arpa_inet
-
-## begin gnulib module arpa_inet-tests
-
-TESTS += test-arpa_inet
-check_PROGRAMS += test-arpa_inet
-EXTRA_DIST += test-arpa_inet.c
-
-## end gnulib module arpa_inet-tests
-
## begin gnulib module base64-tests
TESTS += test-base64
@@ -134,15 +90,6 @@ EXTRA_DIST += test-binary-io.sh test-binary-io.c macros.h
## end gnulib module binary-io-tests
-## begin gnulib module bind-tests
-
-TESTS += test-bind
-check_PROGRAMS += test-bind
-test_bind_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB)
-EXTRA_DIST += test-bind.c signature.h macros.h
-
-## end gnulib module bind-tests
-
## begin gnulib module byteswap-tests
TESTS += test-byteswap
@@ -160,15 +107,6 @@ EXTRA_DIST += test-c-ctype.c macros.h
## end gnulib module c-ctype-tests
-## begin gnulib module connect-tests
-
-TESTS += test-connect
-check_PROGRAMS += test-connect
-test_connect_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB)
-EXTRA_DIST += test-connect.c signature.h macros.h
-
-## end gnulib module connect-tests
-
## begin gnulib module errno-tests
TESTS += test-errno
@@ -221,14 +159,6 @@ EXTRA_DIST += test-fcntl-h.c
## end gnulib module fcntl-h-tests
-## begin gnulib module fd-hook
-
-libtests_a_SOURCES += fd-hook.c
-
-EXTRA_DIST += fd-hook.h
-
-## end gnulib module fd-hook
-
## begin gnulib module fdopen
@@ -355,24 +285,6 @@ EXTRA_DIST += test-iconv.c signature.h macros.h
## end gnulib module iconv-tests
-## begin gnulib module inet_pton
-
-
-EXTRA_DIST += inet_pton.c
-
-EXTRA_libtests_a_SOURCES += inet_pton.c
-
-## end gnulib module inet_pton
-
-## begin gnulib module inet_pton-tests
-
-TESTS += test-inet_pton
-check_PROGRAMS += test-inet_pton
-test_inet_pton_LDADD = $(LDADD) @INET_PTON_LIB@
-EXTRA_DIST += test-inet_pton.c signature.h macros.h
-
-## end gnulib module inet_pton-tests
-
## begin gnulib module intprops-tests
TESTS += test-intprops
@@ -556,23 +468,6 @@ EXTRA_DIST += test-snprintf.c signature.h macros.h
## end gnulib module snprintf-tests
-## begin gnulib module sockets
-
-libtests_a_SOURCES += sockets.h sockets.c
-
-EXTRA_DIST += w32sock.h
-
-## end gnulib module sockets
-
-## begin gnulib module sockets-tests
-
-TESTS += test-sockets
-check_PROGRAMS += test-sockets
-test_sockets_LDADD = $(LDADD) @LIBSOCKET@
-EXTRA_DIST += test-sockets.c
-
-## end gnulib module sockets-tests
-
## begin gnulib module stdalign-tests
TESTS += test-stdalign
diff --git a/gl/tests/test-arpa_inet.c b/gl/tests/test-arpa_inet.c
deleted file mode 100644
index df67608b2c..0000000000
--- a/gl/tests/test-arpa_inet.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Test of <arpa/inet.h> substitute.
- Copyright (C) 2007, 2009-2014 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
-
-#include <config.h>
-
-#include <arpa/inet.h>
-
-int
-main (void)
-{
- return 0;
-}
diff --git a/gl/tests/test-bind.c b/gl/tests/test-bind.c
deleted file mode 100644
index 4eeb59e2a4..0000000000
--- a/gl/tests/test-bind.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Test binding a server socket to a port.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include <sys/socket.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (bind, int, (int, const struct sockaddr *, socklen_t));
-
-#include <errno.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-
-#include "sockets.h"
-#include "macros.h"
-
-int
-main (void)
-{
- (void) gl_sockets_startup (SOCKETS_1_1);
-
- /* Test behaviour for invalid file descriptors. */
- {
- struct sockaddr_in addr;
-
- addr.sin_family = AF_INET;
- inet_pton (AF_INET, "127.0.0.1", &addr.sin_addr);
- addr.sin_port = htons (80);
- {
- errno = 0;
- ASSERT (bind (-1, (const struct sockaddr *) &addr, sizeof (addr)) == -1);
- ASSERT (errno == EBADF);
- }
- {
- close (99);
- errno = 0;
- ASSERT (bind (99, (const struct sockaddr *) &addr, sizeof (addr)) == -1);
- ASSERT (errno == EBADF);
- }
- }
-
- return 0;
-}
diff --git a/gl/tests/test-connect.c b/gl/tests/test-connect.c
deleted file mode 100644
index 6142429a99..0000000000
--- a/gl/tests/test-connect.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Test connecting a client socket.
- Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include <sys/socket.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (connect, int, (int, const struct sockaddr *, socklen_t));
-
-#include <errno.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-
-#include "sockets.h"
-#include "macros.h"
-
-int
-main (void)
-{
- (void) gl_sockets_startup (SOCKETS_1_1);
-
- /* Test behaviour for invalid file descriptors. */
- {
- struct sockaddr_in addr;
-
- addr.sin_family = AF_INET;
- inet_pton (AF_INET, "127.0.0.1", &addr.sin_addr);
- addr.sin_port = htons (80);
- {
- errno = 0;
- ASSERT (connect (-1, (const struct sockaddr *) &addr, sizeof (addr))
- == -1);
- ASSERT (errno == EBADF);
- }
- {
- close (99);
- errno = 0;
- ASSERT (connect (99, (const struct sockaddr *) &addr, sizeof (addr))
- == -1);
- ASSERT (errno == EBADF);
- }
- }
-
- return 0;
-}
diff --git a/gl/tests/test-inet_pton.c b/gl/tests/test-inet_pton.c
deleted file mode 100644
index e85da225fb..0000000000
--- a/gl/tests/test-inet_pton.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Test of inet_pton function.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Bruno Haible <bruno@clisp.org>, 2009. */
-
-#include <config.h>
-
-#include <arpa/inet.h>
-
-#include "signature.h"
-SIGNATURE_CHECK (inet_pton, int, (int, const char *, void *));
-
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-#include "macros.h"
-
-int
-main (void)
-{
-#if defined AF_INET /* HAVE_IPV4 */
- {
- /* This machine was for a long time known as
- ma2s2.mathematik.uni-karlsruhe.de. */
- const char printable[] = "129.13.115.2";
- struct in_addr internal;
- int ret;
-
- ret = inet_pton (AF_INET, printable, &internal);
- ASSERT (ret == 1);
- /* Verify that internal is filled in network byte order. */
- ASSERT (((unsigned char *) &internal)[0] == 0x81);
- ASSERT (((unsigned char *) &internal)[1] == 0x0D);
- ASSERT (((unsigned char *) &internal)[2] == 0x73);
- ASSERT (((unsigned char *) &internal)[3] == 0x02);
-# ifdef WORDS_BIGENDIAN
- ASSERT (internal.s_addr == 0x810D7302);
-# else
- ASSERT (internal.s_addr == 0x02730D81);
-# endif
- }
-#endif
-
- return 0;
-}
diff --git a/gl/tests/test-sockets.c b/gl/tests/test-sockets.c
deleted file mode 100644
index 35f1bf2840..0000000000
--- a/gl/tests/test-sockets.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2008-2014 Free Software Foundation, Inc.
- * Written by Simon Josefsson.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#include <config.h>
-
-#include <stdio.h>
-
-#include "sockets.h"
-
-int
-main (void)
-{
- int err;
-
- err = gl_sockets_startup (SOCKETS_1_1);
- if (err != 0)
- {
- printf ("wsastartup failed %d\n", err);
- return 1;
- }
-
- err = gl_sockets_cleanup ();
- if (err != 0)
- {
- printf ("wsacleanup failed %d\n", err);
- return 1;
- }
-
- (void) gl_fd_to_handle (0);
-
- return 0;
-}
diff --git a/gl/tests/w32sock.h b/gl/tests/w32sock.h
deleted file mode 100644
index b921b1bca8..0000000000
--- a/gl/tests/w32sock.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* w32sock.h --- internal auxiliary functions for Windows socket functions
-
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <errno.h>
-
-/* Get O_RDWR and O_BINARY. */
-#include <fcntl.h>
-
-/* Get _open_osfhandle(). */
-#include <io.h>
-
-/* Get _get_osfhandle(). */
-#include "msvc-nothrow.h"
-
-#define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd)))
-#define SOCKET_TO_FD(fh) (_open_osfhandle ((intptr_t) (fh), O_RDWR | O_BINARY))
-
-static inline void
-set_winsock_errno (void)
-{
- int err = WSAGetLastError ();
-
- /* Map some WSAE* errors to the runtime library's error codes. */
- switch (err)
- {
- case WSA_INVALID_HANDLE:
- errno = EBADF;
- break;
- case WSA_NOT_ENOUGH_MEMORY:
- errno = ENOMEM;
- break;
- case WSA_INVALID_PARAMETER:
- errno = EINVAL;
- break;
- case WSAENAMETOOLONG:
- errno = ENAMETOOLONG;
- break;
- case WSAENOTEMPTY:
- errno = ENOTEMPTY;
- break;
- case WSAEWOULDBLOCK:
- errno = EWOULDBLOCK;
- break;
- case WSAEINPROGRESS:
- errno = EINPROGRESS;
- break;
- case WSAEALREADY:
- errno = EALREADY;
- break;
- case WSAENOTSOCK:
- errno = ENOTSOCK;
- break;
- case WSAEDESTADDRREQ:
- errno = EDESTADDRREQ;
- break;
- case WSAEMSGSIZE:
- errno = EMSGSIZE;
- break;
- case WSAEPROTOTYPE:
- errno = EPROTOTYPE;
- break;
- case WSAENOPROTOOPT:
- errno = ENOPROTOOPT;
- break;
- case WSAEPROTONOSUPPORT:
- errno = EPROTONOSUPPORT;
- break;
- case WSAEOPNOTSUPP:
- errno = EOPNOTSUPP;
- break;
- case WSAEAFNOSUPPORT:
- errno = EAFNOSUPPORT;
- break;
- case WSAEADDRINUSE:
- errno = EADDRINUSE;
- break;
- case WSAEADDRNOTAVAIL:
- errno = EADDRNOTAVAIL;
- break;
- case WSAENETDOWN:
- errno = ENETDOWN;
- break;
- case WSAENETUNREACH:
- errno = ENETUNREACH;
- break;
- case WSAENETRESET:
- errno = ENETRESET;
- break;
- case WSAECONNABORTED:
- errno = ECONNABORTED;
- break;
- case WSAECONNRESET:
- errno = ECONNRESET;
- break;
- case WSAENOBUFS:
- errno = ENOBUFS;
- break;
- case WSAEISCONN:
- errno = EISCONN;
- break;
- case WSAENOTCONN:
- errno = ENOTCONN;
- break;
- case WSAETIMEDOUT:
- errno = ETIMEDOUT;
- break;
- case WSAECONNREFUSED:
- errno = ECONNREFUSED;
- break;
- case WSAELOOP:
- errno = ELOOP;
- break;
- case WSAEHOSTUNREACH:
- errno = EHOSTUNREACH;
- break;
- default:
- errno = (err > 10000 && err < 10025) ? err - 10000 : err;
- break;
- }
-}
diff --git a/gl/w32sock.h b/gl/w32sock.h
deleted file mode 100644
index 3d2bf5b30c..0000000000
--- a/gl/w32sock.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* w32sock.h --- internal auxiliary functions for Windows socket functions
-
- Copyright (C) 2008-2014 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* Written by Paolo Bonzini */
-
-#include <errno.h>
-
-/* Get O_RDWR and O_BINARY. */
-#include <fcntl.h>
-
-/* Get _open_osfhandle(). */
-#include <io.h>
-
-/* Get _get_osfhandle(). */
-#include "msvc-nothrow.h"
-
-#define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd)))
-#define SOCKET_TO_FD(fh) (_open_osfhandle ((intptr_t) (fh), O_RDWR | O_BINARY))
-
-static inline void
-set_winsock_errno (void)
-{
- int err = WSAGetLastError ();
-
- /* Map some WSAE* errors to the runtime library's error codes. */
- switch (err)
- {
- case WSA_INVALID_HANDLE:
- errno = EBADF;
- break;
- case WSA_NOT_ENOUGH_MEMORY:
- errno = ENOMEM;
- break;
- case WSA_INVALID_PARAMETER:
- errno = EINVAL;
- break;
- case WSAENAMETOOLONG:
- errno = ENAMETOOLONG;
- break;
- case WSAENOTEMPTY:
- errno = ENOTEMPTY;
- break;
- case WSAEWOULDBLOCK:
- errno = EWOULDBLOCK;
- break;
- case WSAEINPROGRESS:
- errno = EINPROGRESS;
- break;
- case WSAEALREADY:
- errno = EALREADY;
- break;
- case WSAENOTSOCK:
- errno = ENOTSOCK;
- break;
- case WSAEDESTADDRREQ:
- errno = EDESTADDRREQ;
- break;
- case WSAEMSGSIZE:
- errno = EMSGSIZE;
- break;
- case WSAEPROTOTYPE:
- errno = EPROTOTYPE;
- break;
- case WSAENOPROTOOPT:
- errno = ENOPROTOOPT;
- break;
- case WSAEPROTONOSUPPORT:
- errno = EPROTONOSUPPORT;
- break;
- case WSAEOPNOTSUPP:
- errno = EOPNOTSUPP;
- break;
- case WSAEAFNOSUPPORT:
- errno = EAFNOSUPPORT;
- break;
- case WSAEADDRINUSE:
- errno = EADDRINUSE;
- break;
- case WSAEADDRNOTAVAIL:
- errno = EADDRNOTAVAIL;
- break;
- case WSAENETDOWN:
- errno = ENETDOWN;
- break;
- case WSAENETUNREACH:
- errno = ENETUNREACH;
- break;
- case WSAENETRESET:
- errno = ENETRESET;
- break;
- case WSAECONNABORTED:
- errno = ECONNABORTED;
- break;
- case WSAECONNRESET:
- errno = ECONNRESET;
- break;
- case WSAENOBUFS:
- errno = ENOBUFS;
- break;
- case WSAEISCONN:
- errno = EISCONN;
- break;
- case WSAENOTCONN:
- errno = ENOTCONN;
- break;
- case WSAETIMEDOUT:
- errno = ETIMEDOUT;
- break;
- case WSAECONNREFUSED:
- errno = ECONNREFUSED;
- break;
- case WSAELOOP:
- errno = ELOOP;
- break;
- case WSAEHOSTUNREACH:
- errno = EHOSTUNREACH;
- break;
- default:
- errno = (err > 10000 && err < 10025) ? err - 10000 : err;
- break;
- }
-}