* lib/close.c: Add _gl_close_fd_maybe_socket from winsock.c.
* lib/accept.c: New file, based on winsock.c.
* lib/bind.c: New file, based on winsock.c.
* lib/connect.c: New file, based on winsock.c.
* lib/getpeername.c: New file, based on winsock.c.
* lib/getsockname.c: New file, based on winsock.c.
* lib/getsockopt.c: New file, based on winsock.c.
* lib/ioctl.c: New file, based on winsock.c.
* lib/listen.c: New file, based on winsock.c.
* lib/recv.c: New file, based on winsock.c.
* lib/recvfrom.c: New file, based on winsock.c.
* lib/send.c: New file, based on winsock.c.
* lib/sendto.c: New file, based on winsock.c.
* lib/setsockopt.c: New file, based on winsock.c.
* lib/shutdown.c: New file, based on winsock.c.
* lib/socket.c: New file, based on winsock.c.
* lib/w32sock.h: New file, based on winsock.c.
* lib/winsock.c: Remove file.
* modules/accept: Likewise.
* modules/bind: Likewise.
* modules/connect: Likewise.
* modules/getpeername: Likewise.
* modules/getsockname: Likewise.
* modules/getsockopt: Likewise.
* modules/ioctl: Likewise.
* modules/listen: Likewise.
* modules/recv: Likewise.
* modules/recvfrom: Likewise.
* modules/send: Likewise.
* modules/sendto: Likewise.
* modules/setsockopt: Likewise.
* modules/shutdown: Likewise.
* modules/socket: Use socket.c instead of winsock.c.
* modules/sys_socket: Remove (unneeded?) dependency on winsock.c.
* doc/posix-functions/accept.texi: Doc fix.
* doc/posix-functions/bind.texi: Doc fix.
* doc/posix-functions/close.texi: Doc fix.
* doc/posix-functions/connect.texi: Doc fix.
* doc/posix-functions/getpeername.texi: Doc fix.
* doc/posix-functions/getsockname.texi: Doc fix.
* doc/posix-functions/getsockopt.texi: Doc fix.
* doc/posix-functions/ioctl.texi: Doc fix.
* doc/posix-functions/listen.texi: Doc fix.
* doc/posix-functions/recv.texi: Doc fix.
* doc/posix-functions/recvfrom.texi: Doc fix.
* doc/posix-functions/send.texi: Doc fix.
* doc/posix-functions/sendto.texi: Doc fix.
* doc/posix-functions/setsockopt.texi: Doc fix.
* doc/posix-functions/shutdown.texi: Doc fix.
* doc/posix-functions/socket.texi: Doc fix.
+2008-10-21 Simon Josefsson <simon@josefsson.org>
+
+ * lib/close.c: Add _gl_close_fd_maybe_socket from winsock.c.
+ * lib/accept.c: New file, based on winsock.c.
+ * lib/bind.c: New file, based on winsock.c.
+ * lib/connect.c: New file, based on winsock.c.
+ * lib/getpeername.c: New file, based on winsock.c.
+ * lib/getsockname.c: New file, based on winsock.c.
+ * lib/getsockopt.c: New file, based on winsock.c.
+ * lib/ioctl.c: New file, based on winsock.c.
+ * lib/listen.c: New file, based on winsock.c.
+ * lib/recv.c: New file, based on winsock.c.
+ * lib/recvfrom.c: New file, based on winsock.c.
+ * lib/send.c: New file, based on winsock.c.
+ * lib/sendto.c: New file, based on winsock.c.
+ * lib/setsockopt.c: New file, based on winsock.c.
+ * lib/shutdown.c: New file, based on winsock.c.
+ * lib/socket.c: New file, based on winsock.c.
+ * lib/w32sock.h: New file, based on winsock.c.
+ * lib/winsock.c: Remove file.
+ * modules/accept: Likewise.
+ * modules/bind: Likewise.
+ * modules/connect: Likewise.
+ * modules/getpeername: Likewise.
+ * modules/getsockname: Likewise.
+ * modules/getsockopt: Likewise.
+ * modules/ioctl: Likewise.
+ * modules/listen: Likewise.
+ * modules/recv: Likewise.
+ * modules/recvfrom: Likewise.
+ * modules/send: Likewise.
+ * modules/sendto: Likewise.
+ * modules/setsockopt: Likewise.
+ * modules/shutdown: Likewise.
+ * modules/socket: Use socket.c instead of winsock.c.
+ * modules/sys_socket: Remove (unneeded?) dependency on winsock.c.
+ * doc/posix-functions/accept.texi: Doc fix.
+ * doc/posix-functions/bind.texi: Doc fix.
+ * doc/posix-functions/close.texi: Doc fix.
+ * doc/posix-functions/connect.texi: Doc fix.
+ * doc/posix-functions/getpeername.texi: Doc fix.
+ * doc/posix-functions/getsockname.texi: Doc fix.
+ * doc/posix-functions/getsockopt.texi: Doc fix.
+ * doc/posix-functions/ioctl.texi: Doc fix.
+ * doc/posix-functions/listen.texi: Doc fix.
+ * doc/posix-functions/recv.texi: Doc fix.
+ * doc/posix-functions/recvfrom.texi: Doc fix.
+ * doc/posix-functions/send.texi: Doc fix.
+ * doc/posix-functions/sendto.texi: Doc fix.
+ * doc/posix-functions/setsockopt.texi: Doc fix.
+ * doc/posix-functions/shutdown.texi: Doc fix.
+ * doc/posix-functions/socket.texi: Doc fix.
+
2008-10-20 Bruno Haible <bruno@clisp.org>
Take into account the role of SIGABRT_COMPAT on Windows 2008.
@code{write}, and @code{close}; you have to use @code{recv}, @code{send},
@code{closesocket} in these cases instead.
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for @code{accept}
+are not placed in @code{errno}, and @code{WSAGetLastError} must be
+used instead.
@end itemize
Portability problems not fixed by Gnulib:
Portability problems fixed by Gnulib:
@itemize
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for @code{bind}
+are not placed in @code{errno}, and @code{WSAGetLastError} must be
+used instead.
@end itemize
Portability problems not fixed by Gnulib:
On Windows platforms (excluding Cygwin), @code{socket} and @code{accept}
do not return file descriptors that can be closed by @code{close}.
Instead, @code{closesocket} must be used.
+@item
+On Windows platforms (excluding Cygwin), error codes for @code{close}
+are not placed in @code{errno}, and @code{WSAGetLastError} must be
+used instead.
@end itemize
Portability problems not fixed by Gnulib:
Portability problems fixed by Gnulib:
@itemize
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for
+@code{connect} are not placed in @code{errno}, and
+@code{WSAGetLastError} must be used instead.
@end itemize
Portability problems not fixed by Gnulib:
Portability problems fixed by Gnulib:
@itemize
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for
+@code{getpeername} are not placed in @code{errno}, and
+@code{WSAGetLastError} must be used instead.
@end itemize
Portability problems not fixed by Gnulib:
Portability problems fixed by Gnulib:
@itemize
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for
+@code{getsockname} are not placed in @code{errno}, and
+@code{WSAGetLastError} must be used instead.
@end itemize
Portability problems not fixed by Gnulib:
Portability problems fixed by Gnulib:
@itemize
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for
+@code{getsockopt} are not placed in @code{errno}, and
+@code{WSAGetLastError} must be used instead.
@end itemize
Portability problems not fixed by Gnulib:
Portability problems fixed by Gnulib:
@itemize
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for @code{ioctl}
+are not placed in @code{errno}, and @code{WSAGetLastError} must be
+used instead.
@item
@code{ioctl} is called @code{ioctlsocket} under mingw
@end itemize
Portability problems fixed by Gnulib:
@itemize
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for @code{listen}
+are not placed in @code{errno}, and @code{WSAGetLastError} must be
+used instead.
@end itemize
Portability problems not fixed by Gnulib:
Portability problems fixed by Gnulib:
@itemize
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for @code{recv}
+are not placed in @code{errno}, and @code{WSAGetLastError} must be
+used instead.
@end itemize
Portability problems not fixed by Gnulib:
Portability problems fixed by Gnulib:
@itemize
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for
+@code{recvfrom} are not placed in @code{errno}, and
+@code{WSAGetLastError} must be used instead.
@end itemize
Portability problems not fixed by Gnulib:
Portability problems fixed by Gnulib:
@itemize
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for @code{send}
+are not placed in @code{errno}, and @code{WSAGetLastError} must be
+used instead.
@end itemize
Portability problems not fixed by Gnulib:
Portability problems fixed by Gnulib:
@itemize
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for @code{sendto}
+are not placed in @code{errno}, and @code{WSAGetLastError} must be
+used instead.
@end itemize
Portability problems not fixed by Gnulib:
Portability problems fixed by Gnulib:
@itemize
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for
+@code{setsockopt} are not placed in @code{errno}, and
+@code{WSAGetLastError} must be used instead.
@end itemize
Portability problems not fixed by Gnulib:
Portability problems fixed by Gnulib:
@itemize
@item
-On Windows platforms (excluding Cygwin), error codes for @code{shutdown} are
-not placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for
+@code{shutdown} are not placed in @code{errno}, and
+@code{WSAGetLastError} must be used instead.
@end itemize
Portability problems not fixed by Gnulib:
@code{write}, and @code{close}; you have to use @code{recv}, @code{send},
@code{closesocket} in these cases instead.
@item
-On Windows platforms (excluding Cygwin), error codes for @code{accept} are not
-placed in @code{errno}, and @code{WSAGetLastError} must be used instead.
+On Windows platforms (excluding Cygwin), error codes for @code{socket}
+are not placed in @code{errno}, and @code{WSAGetLastError} must be
+used instead.
@end itemize
Portability problems not fixed by Gnulib:
--- /dev/null
+/* accept.c --- wrappers for Windows accept function
+
+ Copyright (C) 2008 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 <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 accept
+
+int
+rpl_accept (int fd, struct sockaddr *addr, int *addrlen)
+{
+ SOCKET fh = accept (FD_TO_SOCKET (fd), addr, addrlen);
+ if (fh == INVALID_SOCKET)
+ {
+ set_winsock_errno ();
+ return -1;
+ }
+ else
+ return SOCKET_TO_FD (fh);
+}
--- /dev/null
+/* bind.c --- wrappers for Windows bind function
+
+ Copyright (C) 2008 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 <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, struct sockaddr *sockaddr, int len)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = bind (sock, sockaddr, len);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
#include <unistd.h>
#if GNULIB_SYS_SOCKET
+# define WIN32_LEAN_AND_MEAN
# include <sys/socket.h>
#endif
+#if HAVE__GL_CLOSE_FD_MAYBE_SOCKET
+
+/* Get set_winsock_errno, FD_TO_SOCKET etc. */
+#include "w32sock.h"
+
+int
+_gl_close_fd_maybe_socket (int fd)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ WSANETWORKEVENTS ev;
+
+ ev.lNetworkEvents = 0xDEADBEEF;
+ WSAEnumNetworkEvents (sock, NULL, &ev);
+ if (ev.lNetworkEvents != 0xDEADBEEF)
+ {
+ /* FIXME: other applications, like squid, use an undocumented
+ _free_osfhnd free function. But this is not enough: The 'osfile'
+ flags for fd also needs to be cleared, but it is hard to access it.
+ Instead, here we just close twice the file descriptor. */
+ if (closesocket (sock))
+ {
+ set_winsock_errno ();
+ return -1;
+ }
+ else
+ {
+ /* This call frees the file descriptor and does a
+ CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails. */
+ _close (fd);
+ return 0;
+ }
+ }
+ else
+ return _close (fd);
+}
+#endif
/* Override close() to call into other gnulib modules. */
--- /dev/null
+/* connect.c --- wrappers for Windows connect function
+
+ Copyright (C) 2008 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 <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, struct sockaddr *sockaddr, int len)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ 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;
+}
--- /dev/null
+/* getpeername.c --- wrappers for Windows getpeername function
+
+ Copyright (C) 2008 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 <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 getpeername
+
+int
+rpl_getpeername (int fd, struct sockaddr *addr, int *addrlen)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = getpeername (sock, addr, addrlen);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
--- /dev/null
+/* getsockname.c --- wrappers for Windows getsockname function
+
+ Copyright (C) 2008 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 <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 getsockname
+
+int
+rpl_getsockname (int fd, struct sockaddr *addr, int *addrlen)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = getsockname (sock, addr, addrlen);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
--- /dev/null
+/* getsockopt.c --- wrappers for Windows getsockopt function
+
+ Copyright (C) 2008 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 <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 getsockopt
+
+int
+rpl_getsockopt (int fd, int level, int optname, void *optval, int *optlen)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = getsockopt (sock, level, optname, optval, optlen);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
--- /dev/null
+/* ioctl.c --- wrappers for Windows ioctl function
+
+ Copyright (C) 2008 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 <config.h>
+
+#include <stdarg.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 ioctl
+
+int
+rpl_ioctl (int fd, int req, ...)
+{
+ void *buf;
+ va_list args;
+ SOCKET sock;
+ int r;
+
+ va_start (args, req);
+ buf = va_arg (args, void *);
+ va_end (args);
+
+ sock = FD_TO_SOCKET (fd);
+ r = ioctlsocket (sock, req, buf);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
--- /dev/null
+/* listen.c --- wrappers for Windows listen function
+
+ Copyright (C) 2008 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 <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 listen
+
+int
+rpl_listen (int fd, int backlog)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = listen (sock, backlog);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
--- /dev/null
+/* recv.c --- wrappers for Windows recv function
+
+ Copyright (C) 2008 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 <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 recv
+
+int
+rpl_recv (int fd, void *buf, int len, int flags)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = recv (sock, buf, len, flags);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
--- /dev/null
+/* recvfrom.c --- wrappers for Windows recvfrom function
+
+ Copyright (C) 2008 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 <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 recvfrom
+
+int
+rpl_recvfrom (int fd, void *buf, int len, int flags, struct sockaddr *from,
+ int *fromlen)
+{
+ int frombufsize = *fromlen;
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = recvfrom (sock, buf, len, flags, from, fromlen);
+
+ if (r < 0)
+ set_winsock_errno ();
+
+ /* Winsock recvfrom() only returns a valid 'from' when the socket is
+ connectionless. POSIX gives a valid 'from' for all types of sockets. */
+ else if (*fromlen == frombufsize)
+ rpl_getpeername (fd, from, fromlen);
+
+ return r;
+}
--- /dev/null
+/* send.c --- wrappers for Windows send function
+
+ Copyright (C) 2008 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 <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 send
+
+int
+rpl_send (int fd, const void *buf, int len, int flags)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = send (sock, buf, len, flags);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
--- /dev/null
+/* sendto.c --- wrappers for Windows sendto function
+
+ Copyright (C) 2008 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 <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 sendto
+
+int
+rpl_sendto (int fd, const void *buf, int len, int flags,
+ struct sockaddr *to, int tolen)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = sendto (sock, buf, len, flags, to, tolen);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
--- /dev/null
+/* setsockopt.c --- wrappers for Windows setsockopt function
+
+ Copyright (C) 2008 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 <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 setsockopt
+
+int
+rpl_setsockopt (int fd, int level, int optname, const void *optval, int optlen)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = setsockopt (sock, level, optname, optval, optlen);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
--- /dev/null
+/* shutdown.c --- wrappers for Windows shutdown function
+
+ Copyright (C) 2008 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 <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 shutdown
+
+int
+rpl_shutdown (int fd, int how)
+{
+ SOCKET sock = FD_TO_SOCKET (fd);
+ int r = shutdown (sock, how);
+ if (r < 0)
+ set_winsock_errno ();
+
+ return r;
+}
--- /dev/null
+/* socket.c --- wrappers for Windows socket function
+
+ Copyright (C) 2008 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 <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 socket
+
+int
+rpl_socket (int domain, int type, int protocol)
+{
+ /* We have to use WSASocket() to create non-overlapped IO sockets.
+ Overlapped IO sockets cannot be used with read/write. */
+ SOCKET fh = WSASocket (domain, type, protocol, NULL, 0, 0);
+
+ if (fh == INVALID_SOCKET)
+ {
+ set_winsock_errno ();
+ return -1;
+ }
+ else
+ return SOCKET_TO_FD (fh);
+}
--- /dev/null
+/* w32sock.h --- internal auxilliary functions for Windows socket functions
+
+ Copyright (C) 2008 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 _get_osfhandle() and _open_osfhandle(). */
+#include <io.h>
+
+#define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd)))
+#define SOCKET_TO_FD(fh) (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY))
+
+static inline void
+set_winsock_errno (void)
+{
+ int err = WSAGetLastError ();
+ WSASetLastError (0);
+
+ /* 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 WSAEWOULDBLOCK:
+ errno = EWOULDBLOCK;
+ break;
+ case WSAENAMETOOLONG:
+ errno = ENAMETOOLONG;
+ break;
+ case WSAENOTEMPTY:
+ errno = ENOTEMPTY;
+ break;
+ default:
+ errno = (err > 10000 && err < 10025) ? err - 10000 : err;
+ break;
+ }
+}
+++ /dev/null
-/* winsock.c --- wrappers for Windows socket functions
-
- Copyright (C) 2008 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 <config.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <io.h>
-#include <sys/socket.h>
-#if GNULIB_IOCTL
-#include <sys/ioctl.h>
-#endif
-
-#undef socket
-#undef connect
-#undef accept
-#undef bind
-#undef getpeername
-#undef getsockname
-#undef getsockopt
-#undef listen
-#undef recv
-#undef send
-#undef recvfrom
-#undef sendto
-#undef setsockopt
-#undef shutdown
-
-#define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd)))
-#define SOCKET_TO_FD(fh) (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY))
-
-
-static inline void
-set_winsock_errno (void)
-{
- int err = WSAGetLastError ();
- WSASetLastError (0);
-
- /* 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 WSAEWOULDBLOCK:
- errno = EWOULDBLOCK;
- break;
- case WSAENAMETOOLONG:
- errno = ENAMETOOLONG;
- break;
- case WSAENOTEMPTY:
- errno = ENOTEMPTY;
- break;
- default:
- errno = (err > 10000 && err < 10025) ? err - 10000 : err;
- break;
- }
-}
-
-
-/* Hook for gnulib module close. */
-
-#if HAVE__GL_CLOSE_FD_MAYBE_SOCKET
-int
-_gl_close_fd_maybe_socket (int fd)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
- WSANETWORKEVENTS ev;
-
- ev.lNetworkEvents = 0xDEADBEEF;
- WSAEnumNetworkEvents (sock, NULL, &ev);
- if (ev.lNetworkEvents != 0xDEADBEEF)
- {
- /* FIXME: other applications, like squid, use an undocumented
- _free_osfhnd free function. But this is not enough: The 'osfile'
- flags for fd also needs to be cleared, but it is hard to access it.
- Instead, here we just close twice the file descriptor. */
- if (closesocket (sock))
- {
- set_winsock_errno ();
- return -1;
- }
- else
- {
- /* This call frees the file descriptor and does a
- CloseHandle ((HANDLE) _get_osfhandle (fd)), which fails. */
- _close (fd);
- return 0;
- }
- }
- else
- return _close (fd);
-}
-#endif
-
-
-/* Wrappers for WinSock functions. */
-
-#if GNULIB_SOCKET
-int
-rpl_socket (int domain, int type, int protocol)
-{
- /* We have to use WSASocket() to create non-overlapped IO sockets.
- Overlapped IO sockets cannot be used with read/write. */
- SOCKET fh = WSASocket (domain, type, protocol, NULL, 0, 0);
-
- if (fh == INVALID_SOCKET)
- {
- set_winsock_errno ();
- return -1;
- }
- else
- return SOCKET_TO_FD (fh);
-}
-#endif
-
-#if GNULIB_CONNECT
-int
-rpl_connect (int fd, struct sockaddr *sockaddr, int len)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
- 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;
-}
-#endif
-
-#if GNULIB_ACCEPT
-int
-rpl_accept (int fd, struct sockaddr *addr, int *addrlen)
-{
- SOCKET fh = accept (FD_TO_SOCKET (fd), addr, addrlen);
- if (fh == INVALID_SOCKET)
- {
- set_winsock_errno ();
- return -1;
- }
- else
- return SOCKET_TO_FD (fh);
-}
-#endif
-
-#if GNULIB_BIND
-int
-rpl_bind (int fd, struct sockaddr *sockaddr, int len)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
- int r = bind (sock, sockaddr, len);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
-}
-#endif
-
-#if GNULIB_GETPEERNAME
-int
-rpl_getpeername (int fd, struct sockaddr *addr, int *addrlen)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
- int r = getpeername (sock, addr, addrlen);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
-}
-#endif
-
-#if GNULIB_GETSOCKNAME
-int
-rpl_getsockname (int fd, struct sockaddr *addr, int *addrlen)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
- int r = getsockname (sock, addr, addrlen);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
-}
-#endif
-
-#if GNULIB_GETSOCKOPT
-int
-rpl_getsockopt (int fd, int level, int optname, void *optval, int *optlen)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
- int r = getsockopt (sock, level, optname, optval, optlen);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
-}
-#endif
-
-#if GNULIB_LISTEN
-int
-rpl_listen (int fd, int backlog)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
- int r = listen (sock, backlog);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
-}
-#endif
-
-#if GNULIB_IOCTL
-int
-rpl_ioctl (int fd, int req, ...)
-{
- void *buf;
- va_list args;
- SOCKET sock;
- int r;
-
- va_start (args, req);
- buf = va_arg (args, void *);
- va_end (args);
-
- sock = FD_TO_SOCKET (fd);
- r = ioctlsocket (sock, req, buf);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
-}
-#endif
-
-#if GNULIB_RECV
-int
-rpl_recv (int fd, void *buf, int len, int flags)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
- int r = recv (sock, buf, len, flags);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
-}
-#endif
-
-#if GNULIB_SEND
-int
-rpl_send (int fd, const void *buf, int len, int flags)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
- int r = send (sock, buf, len, flags);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
-}
-#endif
-
-#if GNULIB_RECVFROM
-int
-rpl_recvfrom (int fd, void *buf, int len, int flags, struct sockaddr *from,
- int *fromlen)
-{
- int frombufsize = *fromlen;
- SOCKET sock = FD_TO_SOCKET (fd);
- int r = recvfrom (sock, buf, len, flags, from, fromlen);
-
- if (r < 0)
- set_winsock_errno ();
-
- /* Winsock recvfrom() only returns a valid 'from' when the socket is
- connectionless. POSIX gives a valid 'from' for all types of sockets. */
- else if (*fromlen == frombufsize)
- rpl_getpeername (fd, from, fromlen);
-
- return r;
-}
-#endif
-
-#if GNULIB_SENDTO
-int
-rpl_sendto (int fd, const void *buf, int len, int flags,
- struct sockaddr *to, int tolen)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
- int r = sendto (sock, buf, len, flags, to, tolen);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
-}
-#endif
-
-#if GNULIB_SETSOCKOPT
-int
-rpl_setsockopt (int fd, int level, int optname, const void *optval, int optlen)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
- int r = setsockopt (sock, level, optname, optval, optlen);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
-}
-#endif
-
-#if GNULIB_SHUTDOWN
-int
-rpl_shutdown (int fd, int how)
-{
- SOCKET sock = FD_TO_SOCKET (fd);
- int r = shutdown (sock, how);
- if (r < 0)
- set_winsock_errno ();
-
- return r;
-}
-#endif
accept() function: accept a connection to a server socket.
Files:
-lib/winsock.c
+lib/accept.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([accept])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([accept])
bind() function: bind a server socket to a port.
Files:
-lib/winsock.c
+lib/bind.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([bind])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([bind])
connect() function: connect a client socket.
Files:
-lib/winsock.c
+lib/connect.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([connect])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([connect])
socket.
Files:
-lib/winsock.c
+lib/getpeername.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([getpeername])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([getpeername])
socket.
Files:
-lib/winsock.c
+lib/getsockname.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([getsockname])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([getsockname])
getsockopt() function: retrieve optional settings on a socket.
Files:
-lib/winsock.c
+lib/getsockopt.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([getsockopt])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([getsockopt])
ioctl() function: issue device specific requests on files, devices, or sockets.
Files:
-lib/winsock.c
+lib/ioctl.c
+lib/w32sock.h
Depends-on:
sys_ioctl
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([ioctl])
gl_REPLACE_SYS_IOCTL_H
fi
gl_SYS_IOCTL_MODULE_INDICATOR([ioctl])
listen() function: make a server socket ready for accepting connections.
Files:
-lib/winsock.c
+lib/listen.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([listen])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([listen])
recv() function: receive (read) data from a connected socket.
Files:
-lib/winsock.c
+lib/recv.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([recv])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([recv])
recvfrom() function: receive (read) data from a potentially unconnected socket.
Files:
-lib/winsock.c
+lib/recvfrom.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([recvfrom])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([recvfrom])
send() function: send (write) data to a connected socket.
Files:
-lib/winsock.c
+lib/send.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([send])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([send])
sendto() function: send (write) data to a potentially unconnected socket.
Files:
-lib/winsock.c
+lib/sendto.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([sendto])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([sendto])
setsockopt() function: specify optional settings on a socket.
Files:
-lib/winsock.c
+lib/setsockopt.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([setsockopt])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([setsockopt])
shutdown() function: initiate a graceful shutdown of a socket.
Files:
-lib/winsock.c
+lib/shutdown.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([shutdown])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([shutdown])
socket() function: create a socket.
Files:
-lib/winsock.c
+lib/socket.c
+lib/w32sock.h
Depends-on:
sys_socket
configure.ac:
AC_REQUIRE([gl_HEADER_SYS_SOCKET])
if test "$ac_cv_header_winsock2_h" = yes; then
- AC_LIBOBJ([winsock])
+ AC_LIBOBJ([socket])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([socket])
Files:
lib/sys_socket.in.h
-lib/winsock.c
m4/sys_socket_h.m4
m4/sockpfaf.m4
m4/unistd_h.m4