Reported by Tom G. Christensen <tgc@jupiterrise.com>.
* lib/sys_socket.in.h (SO_REUSEPORT): New macro.
* doc/posix-headers/sys_socket.texi: Mention the issue.
* tests/test-poll.c (SO_REUSEPORT): Remove.
* tests/test-select.h: Include <sys/socket.h>.
(SO_REUSEPORT): Remove.
* modules/select-tests (Depends-on): Add 'sys_socket'.
+2018-04-24 Bruno Haible <bruno@clisp.org>
+
+ sys_socket: Make SO_REUSEPORT available across platforms.
+ Reported by Tom G. Christensen <tgc@jupiterrise.com>.
+ * lib/sys_socket.in.h (SO_REUSEPORT): New macro.
+ * doc/posix-headers/sys_socket.texi: Mention the issue.
+ * tests/test-poll.c (SO_REUSEPORT): Remove.
+ * tests/test-select.h: Include <sys/socket.h>.
+ (SO_REUSEPORT): Remove.
+ * modules/select-tests (Depends-on): Add 'sys_socket'.
+
2018-04-21 Benno Schulenberg <bensberg@telfort.nl> (tiny change)
localcharset: short-circuit the search for an alias on a Mac
The @code{CMSG_SPACE} and @code{CMSG_LEN} macros are not provided on some
platforms:
OpenVMS.
+@item
+This header file does not define the @code{SO_REUSEPORT} macro on some
+platforms:
+Minix 3.1.8, Solaris 10, Cygwin, mingw, MSVC 14.
@end itemize
Portability problems not fixed by Gnulib:
#endif
+/* Ensure SO_REUSEPORT is defined. */
+/* For the subtle differences between SO_REUSEPORT and SO_REUSEADDR, see
+ https://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t
+ and https://lwn.net/Articles/542629/
+ */
+#ifndef SO_REUSEPORT
+# define SO_REUSEPORT SO_REUSEADDR
+#endif
+
/* Fix some definitions from <winsock2.h>. */
#if @HAVE_WINSOCK2_H@
Depends-on:
stdbool
+sys_socket
netinet_in
arpa_inet
unistd
#include <sys/wait.h>
#endif
-#ifndef SO_REUSEPORT
-#define SO_REUSEPORT SO_REUSEADDR
-#endif
-
#define TEST_PORT 12345
#include <stdio.h>
#include <string.h>
+#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
# include <sys/wait.h>
#endif
-#ifndef SO_REUSEPORT
-# define SO_REUSEPORT SO_REUSEADDR
-#endif
-
#define TEST_PORT 12345