1#include <sys/socket.h>
2#define T(t) (t*)0;
3#define F(t,n) {t *y = &x.n;}
4#define C(n) switch(n){case n:;}
5static void f()
6{
7T(size_t)
8T(ssize_t)
9T(socklen_t)
10T(sa_family_t)
11{
12struct sockaddr x;
13F(sa_family_t,sa_family)
14F(char, sa_data[0])
15}
16{
17struct sockaddr_storage x;
18F(sa_family_t, ss_family)
19}
20{
21struct msghdr x;
22F(void*,msg_name)
23F(socklen_t,msg_namelen)
24F(struct iovec*,msg_iov)
25F(int,msg_iovlen)
26F(void*,msg_control)
27F(socklen_t,msg_controllen)
28F(int,msg_flags)
29}
30{
31struct iovec x;
32F(void *,iov_base)
33F(size_t,iov_len)
34}
35{
36struct cmsghdr x;
37F(socklen_t,cmsg_len)
38F(int,cmsg_level)
39F(int,cmsg_type)
40}
41C(SCM_RIGHTS)
42#ifndef CMSG_DATA
43#error no CMSG_DATA
44#endif
45#ifndef CMSG_NXTHDR
46#error no CMSG_NXTHDR
47#endif
48#ifndef CMSG_FIRSTHDR
49#error CMSG_FIRSTTHDR
50#endif
51{
52struct linger x;
53F(int,l_onoff)
54F(int,l_linger)
55}
56C(SOCK_DGRAM)
57C(SOCK_RAW)
58C(SOCK_SEQPACKET)
59C(SOCK_STREAM)
60C(SOL_SOCKET)
61C(SO_ACCEPTCONN)
62C(SO_BROADCAST)
63C(SO_DEBUG)
64C(SO_DONTROUTE)
65C(SO_ERROR)
66C(SO_KEEPALIVE)
67C(SO_LINGER)
68C(SO_OOBINLINE)
69C(SO_RCVBUF)
70C(SO_RCVLOWAT)
71C(SO_RCVTIMEO)
72C(SO_REUSEADDR)
73C(SO_SNDBUF)
74C(SO_SNDLOWAT)
75C(SO_SNDTIMEO)
76C(SO_TYPE)
77C(SOMAXCONN)
78C(MSG_CTRUNC)
79C(MSG_DONTROUTE)
80C(MSG_EOR)
81C(MSG_OOB)
82C(MSG_NOSIGNAL)
83C(MSG_PEEK)
84C(MSG_TRUNC)
85C(MSG_WAITALL)
86C(AF_INET)
87C(AF_INET6)
88C(AF_UNIX)
89C(AF_UNSPEC)
90C(SHUT_RD)
91C(SHUT_RDWR)
92C(SHUT_WR)
93{int(*p)(int,struct sockaddr*restrict,socklen_t*restrict) = accept;}
94{int(*p)(int,const struct sockaddr*,socklen_t) = bind;}
95{int(*p)(int,const struct sockaddr*,socklen_t) = connect;}
96{int(*p)(int,struct sockaddr*restrict,socklen_t*restrict) = getpeername;}
97{int(*p)(int,struct sockaddr*restrict,socklen_t*restrict) = getsockname;}
98{int(*p)(int,int,int,void*restrict,socklen_t*restrict) = getsockopt;}
99{int(*p)(int,int) = listen;}
100{ssize_t(*p)(int,void*,size_t,int) = recv;}
101{ssize_t(*p)(int,void*restrict,size_t,int,struct sockaddr*restrict,socklen_t*restrict) = recvfrom;}
102{ssize_t(*p)(int,struct msghdr*,int) = recvmsg;}
103{ssize_t(*p)(int,const void*,size_t,int) = send;}
104{ssize_t(*p)(int,const struct msghdr*,int) = sendmsg;}
105{ssize_t(*p)(int,const void*,size_t,int,const struct sockaddr*,socklen_t) = sendto;}
106{int(*p)(int,int,int,const void*,socklen_t) = setsockopt;}
107{int(*p)(int,int) = shutdown;}
108{int(*p)(int) = sockatmark;}
109{int(*p)(int,int,int) = socket;}
110{int(*p)(int,int,int,int[]) = socketpair;}
111}
112