From 0454c4fa43dd7675f050ad07d8fd03459c07c869 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Wed, 21 Aug 2024 09:23:02 +0200 Subject: [PATCH] Fixed SO_PROTOCOL on new Illumos --- CHANGES | 4 ++++ xio-socket.h | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 2bcf3ef..87b6e5c 100644 --- a/CHANGES +++ b/CHANGES @@ -72,6 +72,10 @@ Porting: in sys/stropts.h Thanks to Andy Fiddaman for sending a patch. + On latest Illumos, compilation failed due to new unexpected SO_PROTOCOL + implementation. + Thanks to Andy Fiddaman for sending a patch. + Building: Makefile.in: procan.o build requires srcdir prefix for explicit source file. diff --git a/xio-socket.h b/xio-socket.h index c4ce864..2064ed3 100644 --- a/xio-socket.h +++ b/xio-socket.h @@ -6,14 +6,19 @@ #define __xio_socket_h_included 1 /* SO_PROTOTYPE is defined on Solaris, HP-UX - SO_PROTOCOL in Linux, is the better name, but came much later */ + SO_PROTOCOL in Linux, is the better name, but came much later, now + standardised in POSIX 2024 + illumos defines both, with SO_PROTOCOL as an alias of SO_PROTOTYPE */ #ifdef SO_PROTOCOL -# undef SO_PROTOTYPE +# ifndef SO_PROTOTYPE # define SO_PROTOTYPE SO_PROTOCOL +# endif #else # ifdef SO_PROTOTYPE # define SO_PROTOCOL SO_PROTOTYPE # else +/* Even when SO_PROTOCOL is not available for setsockopt() Socat uses it + internally as option for 3rd arg of socket() e.a. */ # define SO_PROTOCOL 0x9999 # define SO_PROTOTYPE SO_PROTOCOL # endif