errno-h: document Haiku errors can’t be -1
[gnulib.git] / lib / sys_un.in.h
bloba32444a2534f178858487199c01b6ff08d2488f1
1 /* sys/un.h - definitions for UNIX domain sockets
3 Copyright 2024-2025 Free Software Foundation, Inc.
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18 /* Written by Collin Funk. */
20 #ifndef _@GUARD_PREFIX@_SYS_UN_H
22 #if __GNUC__ >= 3
23 @PRAGMA_SYSTEM_HEADER@
24 #endif
25 @PRAGMA_COLUMNS@
27 #if @HAVE_SYS_UN_H@
29 /* On glibc, in C++ mode with clang, <stddef.h> and <string.h> need to be
30 included before <sys/un.h>, because otherwise <sys/un.h> includes them inside
31 an 'extern "C" { ... }' block, which leads to compilation errors in gnulib's
32 <string.h> override. */
33 # if defined __cplusplus
34 # include <stddef.h>
35 # include <string.h>
36 # endif
38 /* The include_next requires a split double-inclusion guard. */
39 # @INCLUDE_NEXT@ @NEXT_SYS_UN_H@
41 #endif
43 #ifndef _@GUARD_PREFIX@_SYS_UN_H
44 #define _@GUARD_PREFIX@_SYS_UN_H 1
46 #if !@HAVE_SYS_UN_H@
48 /* A platform that lacks <sys/un.h>. */
50 /* Windows requires <winsock2.h> to be included before <afunix.h>. */
51 # if @HAVE_WINSOCK2_H@
52 # include <winsock2.h>
53 # endif
54 # if @HAVE_AFUNIX_H@
55 # include <afunix.h>
56 # endif
58 /* If a platform does not support AF_UNIX sockets 'struct sockaddr_un' will
59 not be defined. You may use HAVE_UNIXSOCKET after including <config.h>. */
61 #endif
63 #if !@HAVE_SA_FAMILY_T_IN_SYS_UN_H@
64 # if @HAVE_SA_FAMILY_T@
65 /* A platform that has <sys/un.h> but which — unlike <sys/socket.h> — does not
66 define the 'sa_family_t' type. */
67 # include <sys/socket.h>
68 # else
69 /* A platform which does not define the 'sa_family_t' type at all.
70 Define it here in the same way as in <sys/socket.h>. */
71 # if !GNULIB_defined_sa_family_t
72 /* On OS/2 kLIBC, sa_family_t is unsigned char unless TCPV40HDRS is defined. */
73 # if !defined __KLIBC__ || defined TCPV40HDRS
74 typedef unsigned short sa_family_t;
75 # else
76 typedef unsigned char sa_family_t;
77 # endif
78 # define GNULIB_defined_sa_family_t 1
79 # endif
80 # endif
81 #endif
83 #endif /* _@GUARD_PREFIX@_SYS_UN_H */
84 #endif /* _@GUARD_PREFIX@_SYS_UN_H */