add ere backref regression test
[libc-test] / src / api / sys_socket.c
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:;}
5 static void f()
6 {
7 T(size_t)
8 T(ssize_t)
9 T(socklen_t)
10 T(sa_family_t)
11 {
12 struct sockaddr x;
13 F(sa_family_t,sa_family)
14 F(char, sa_data[0])
15 }
16 {
17 struct sockaddr_storage x;
18 F(sa_family_t, ss_family)
19 }
20 {
21 struct msghdr x;
22 F(void*,msg_name)
23 F(socklen_t,msg_namelen)
24 F(struct iovec*,msg_iov)
25 F(int,msg_iovlen)
26 F(void*,msg_control)
27 F(socklen_t,msg_controllen)
28 F(int,msg_flags)
29 }
30 {
31 struct iovec x;
32 F(void *,iov_base)
33 F(size_t,iov_len)
34 }
35 {
36 struct cmsghdr x;
37 F(socklen_t,cmsg_len)
38 F(int,cmsg_level)
39 F(int,cmsg_type)
40 }
41 C(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 {
52 struct linger x;
53 F(int,l_onoff)
54 F(int,l_linger)
55 }
56 C(SOCK_DGRAM)
57 C(SOCK_RAW)
58 C(SOCK_SEQPACKET)
59 C(SOCK_STREAM)
60 C(SOL_SOCKET)
61 C(SO_ACCEPTCONN)
62 C(SO_BROADCAST)
63 C(SO_DEBUG)
64 C(SO_DONTROUTE)
65 C(SO_ERROR)
66 C(SO_KEEPALIVE)
67 C(SO_LINGER)
68 C(SO_OOBINLINE)
69 C(SO_RCVBUF)
70 C(SO_RCVLOWAT)
71 C(SO_RCVTIMEO)
72 C(SO_REUSEADDR)
73 C(SO_SNDBUF)
74 C(SO_SNDLOWAT)
75 C(SO_SNDTIMEO)
76 C(SO_TYPE)
77 C(SOMAXCONN)
78 C(MSG_CTRUNC)
79 C(MSG_DONTROUTE)
80 C(MSG_EOR)
81 C(MSG_OOB)
82 C(MSG_NOSIGNAL)
83 C(MSG_PEEK)
84 C(MSG_TRUNC)
85 C(MSG_WAITALL)
86 C(AF_INET)
87 C(AF_INET6)
88 C(AF_UNIX)
89 C(AF_UNSPEC)
90 C(SHUT_RD)
91 C(SHUT_RDWR)
92 C(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 }