1 /* Test of <sys/socket.h> substitute.
2 Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2007. */
21 #include <sys/socket.h>
23 /* POSIX mandates that AF_UNSPEC shall be 0. */
24 static_assert (AF_UNSPEC
== 0);
26 /* Check that the 'socklen_t' type is defined. */
29 /* Check that the 'size_t' and 'ssize_t' types are defined. */
33 /* Check that 'struct iovec' is defined. */
36 /* Check that a minimal set of 'struct msghdr' is defined. */
43 /* POSIX requires that 'socklen_t' is an integer type with a width of at
45 static_assert (32 <= TYPE_WIDTH (socklen_t
));
47 /* POSIX requires that sa_family_t is an unsigned integer type. */
48 static_assert (! TYPE_SIGNED (sa_family_t
));
54 struct sockaddr_storage x
;
57 /* Check some errno values. */
70 /* Check that each supported address family has a distinct value. */
87 /* Check that the shutdown type macros are defined to distinct values. */
103 return (x
.ss_family
- i
+ msg
.msg_namelen
+ msg
.msg_iov
->iov_len