On 2025-06-23 02:42, Corinna Vinschen wrote:
Hi Brian,

On Jun 21 11:02, Brian Inglis wrote:
SO_REUSEPORT is defined in BSDs, Solaris, and Linux (since 3.9).
It is not available in Windows but S.O. articles suggest

S.O.?

-v, please?

Hi Corinna,

Stack Overflow (added dots to distinguish that abbrev from SockOpt).

If there's this articel, it might be a good idea to add a link to it
in the commit message.

Might have made the above abbrev more obvious:

https://stackoverflow.com/questions/13637121/so-reuseport-is-not-defined-on-windows-7#comment18710480_13638757

Other articles spend a lot of time discussing their opinions of whether there are subtle or drastic differences between SO_REUSEADDR and SO_REUSEPORT implmentations across available platforms, so don't add much to that.

[One generated answer suggested SO_EXCLUSIVEADDRUSE rather than SO_REUSEPORT, but gave the definition of both identically, except for the words "do not" in the former, suggesting that the so-called "language model" excluded semantics!]

--
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher  but when there is no more to cut
                                -- Antoine de Saint-Exupéry
From 6f703b770ddd29e5c174622ae1570761a8a52a92 Mon Sep 17 00:00:00 2001
Message-ID: 
<6f703b770ddd29e5c174622ae1570761a8a52a92.1750525279.git.brian.ing...@systematicsw.ab.ca>
From: Brian Inglis <[email protected]>
Bcc: Brian Inglis <[email protected]>
To: Cygwin Patches <[email protected]>
Date: Sat, 21 Jun 2025 10:56:29 -0600
Subject: [PATCH v2] Cygwin: winsup/cygwin/include/asm/socket.h: add SO_REUSEPORT
Organization: Systematic Software

SO_REUSEPORT is defined in BSDs, Solaris, and Linux (since 3.9).
It is not available in Windows but Stack Overflow articles suggest
SO_REUSEADDR|SO_BROADCAST works similarly on Windows, so define as such:
https://stackoverflow.com/questions/13637121/so-reuseport-is-not-defined-on-windows-7#comment18710480_13638757
Required to build nghttp2 1.66.

Signed-off-by: Brian Inglis <[email protected]>
---
 winsup/cygwin/include/asm/socket.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/winsup/cygwin/include/asm/socket.h 
b/winsup/cygwin/include/asm/socket.h
index 276df3a0b5fd..d65dc41a0d5d 100644
--- a/winsup/cygwin/include/asm/socket.h
+++ b/winsup/cygwin/include/asm/socket.h
@@ -72,5 +72,8 @@ details. */
 #define SO_ERROR        0x1007          /* get error status and clear */
 #define SO_TYPE         0x1008          /* get socket type */
 
+#define SO_REUSEPORT  (SO_REUSEADDR | SO_BROADCAST)
+                               /* allow local port reuse - synth on Windows */
+
 #endif /* _ASM_SOCKET_H */
 
-- 
2.45.1

Reply via email to