summaryrefslogtreecommitdiff
path: root/lib/sys_socket.in.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-07-07 03:34:18 +0200
committerBruno Haible <bruno@clisp.org>2011-07-07 03:34:18 +0200
commit844191ea0f97be425fea2a18c55a5b139da5d7e7 (patch)
tree603116fcf10f19fe433eb0273bc3a0a3cc78e5de /lib/sys_socket.in.h
parent77e666785ee842df490daf6a4e51c4b0645431e5 (diff)
downloadgnulib-844191ea0f97be425fea2a18c55a5b139da5d7e7.tar.gz
sys_select: Fix compilation error on mingw, introduced on 2011-06-30.
* lib/sys_select.in.h: Don't include <sys/socket.h>. Instead, include <winsock2.h>. (rpl_fd_isset, FD_ISSET): New definitions, copied from lib/sys_socket.in.h. (close, gethostname): Hide declarations from <winsock2.h>. (socket, connect, accept, bind, getpeername, getsockname, getsockopt, listen, recv, send, recvfrom, sendto, setsockopt, shutdown): Likewise. * lib/sys_socket.in.h (close, gethostname): Tweak indentation. (select): Don't override if gnulib's <sys/select.h> was already included. * lib/unistd.in.h (socket, connect, accept, bind, getpeername, getsockname, getsockopt, listen, recv, send, recvfrom, sendto, setsockopt, shutdown, select): Tweak indentation.
Diffstat (limited to 'lib/sys_socket.in.h')
-rw-r--r--lib/sys_socket.in.h56
1 files changed, 29 insertions, 27 deletions
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index 72d1150b72..c42497d049 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -194,6 +194,8 @@ struct msghdr {
#endif
+/* Fix some definitions from <winsock2.h>. */
+
#if @HAVE_WINSOCK2_H@
# if !GNULIB_defined_rpl_fd_isset
@@ -222,28 +224,38 @@ rpl_fd_isset (SOCKET fd, fd_set * set)
#endif
-/* Wrap everything else to use libc file descriptors for sockets. */
+/* Hide some function declarations from <winsock2.h>. */
-#if @HAVE_WINSOCK2_H@ && !defined _@GUARD_PREFIX@_UNISTD_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef close
-# define close close_used_without_including_unistd_h
-# else
- _GL_WARN_ON_USE (close,
- "close() used without including <unistd.h>");
+#if @HAVE_WINSOCK2_H@
+# if !defined _@GUARD_PREFIX@_UNISTD_H
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef close
+# define close close_used_without_including_unistd_h
+# else
+ _GL_WARN_ON_USE (close,
+ "close() used without including <unistd.h>");
+# endif
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef gethostname
+# define gethostname gethostname_used_without_including_unistd_h
+# else
+ _GL_WARN_ON_USE (gethostname,
+ "gethostname() used without including <unistd.h>");
+# endif
# endif
-#endif
-
-#if @HAVE_WINSOCK2_H@ && !defined _@GUARD_PREFIX@_UNISTD_H
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef gethostname
-# define gethostname gethostname_used_without_including_unistd_h
-# else
- _GL_WARN_ON_USE (gethostname,
- "gethostname() used without including <unistd.h>");
+# if !defined _@GUARD_PREFIX@_SYS_SELECT_H
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef select
+# define select select_used_without_including_sys_select_h
+# else
+ _GL_WARN_ON_USE (select,
+ "select() used without including <sys/select.h>");
+# endif
# endif
#endif
+/* Wrap everything else to use libc file descriptors for sockets. */
+
#if @GNULIB_SOCKET@
# if @HAVE_WINSOCK2_H@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -633,16 +645,6 @@ _GL_WARN_ON_USE (shutdown, "shutdown is not always POSIX compliant - "
# endif
#endif
-#if @HAVE_WINSOCK2_H@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef select
-# define select select_used_without_including_sys_select_h
-# else
- _GL_WARN_ON_USE (select,
- "select() used without including <sys/select.h>");
-# endif
-#endif
-
#if @GNULIB_ACCEPT4@
/* Accept a connection on a socket, with specific opening flags.
The flags are a bitmask, possibly including O_CLOEXEC (defined in <fcntl.h>)