POSIX specification:
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_socket.h.html
Portability problems fixed by Gnulib:
<sys/types.h> to be included first.
struct iovec on some platforms:
OpenBSD 4.4.
SHUT_RD, SHUT_WR,
SHUT_RDWR macros on some platforms, despite having the shutdown
functions:
emx+gcc.
struct sockaddr_storage type does not have a member ss_family
on some platforms:
AIX 7.1.
CMSG_SPACE and CMSG_LEN macros are not provided on some
platforms:
OpenVMS.
SO_REUSEPORT macro on some
platforms:
Minix 3.1.8, Solaris 10, Cygwin, mingw, MSVC 14.
Portability problems not fixed by Gnulib:
msg_control and
msg_controllen members of struct msghdr on some
platforms. This can be detected by the absence of the
CMSG_FIRSTHDR macro:
gnulib replacement header, old BSD
SOCK_NONBLOCK
on some platforms:
macOS 15, AIX 7.3, Solaris 10, mingw, MSVC 14.
SOCK_CLOEXEC and
MSG_CMSG_CLOEXEC on some platforms:
macOS 15, AIX 7.3, Solaris 10, mingw, MSVC 14.
MSG_CMSG_CLOEXEC
on some platforms:
Solaris 11 OmniOS.
SOCK_CLOFORK and
MSG_CMSG_CLOFORK, no known platform supports them.
SO_DOMAIN on some platforms:
macOS 15, NetBSD 10.0, AIX 7.3, Cygwin 3.5, mingw, MSVC 14.
SO_PROTOCOL on some platforms:
macOS 15, NetBSD 10.0, AIX 7.3, Solaris 11.4, Cygwin 3.5, mingw, MSVC 14.
MSG_NOSIGNAL
on some platforms:
Solaris 10, mingw, MSVC 14.
MSG_EOR on some platforms:
mingw, MSVC 14.
MSG_CTRUNC and
MSG_TRUNC on some platforms:
mingw.
MSG_WAITALL on some platforms:
MSVC 14.
struct cmsghdr and
the constant SCM_RIGHTS on some platforms:
mingw, MSVC 14.
SOCK_CLOFORK
on some platforms:
glibc 2.42, musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Solaris 11.3, Cygwin, mingw, MSVC, Android.
MSG_CMSG_CLOFORK
on some platforms:
glibc 2.42, musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Solaris 11.4, Cygwin, mingw, MSVC, Android.