Debian Codegraph @

testsuite/systemtap.syscall/socketpair.c

raw
1 /* COVERAGE: socketpair close */
2
3 #include <unistd.h>
4 #include <sys/types.h>
5 #include <sys/socket.h>
6 #include <netinet/ip.h>
7
8 int main()
9 {
10 int fds[2], fl, i;
11
12 socketpair(0, SOCK_STREAM, 0, fds);
13 //staptest// socketpair (PF_UNSPEC, SOCK_STREAM, 0, XXXX) = -NNNN (EAFNOSUPPORT)
14
15 socketpair(PF_INET, 75, IPPROTO_IP, fds);
16 //staptest// socketpair (PF_INET, 0x4b, IPPROTO_IP, XXXX) = -NNNN (EINVAL)
17
18 socketpair(PF_UNIX, SOCK_STREAM, 0, 0);
19 //staptest// socketpair (PF_LOCAL, SOCK_STREAM, 0, 0x0) = -NNNN (EFAULT)
20
21 socketpair(PF_INET, SOCK_DGRAM, IPPROTO_UDP, fds);
22 //staptest// socketpair (PF_INET, SOCK_DGRAM, IPPROTO_UDP, XXXX) = -NNNN (EOPNOTSUPP)
23
24 socketpair(PF_INET, SOCK_DGRAM, IPPROTO_TCP, fds);
25 //staptest// socketpair (PF_INET, SOCK_DGRAM, IPPROTO_TCP, XXXX) = -NNNN (EPROTONOSUPPORT)
26
27 socketpair(PF_INET, SOCK_STREAM, IPPROTO_TCP, fds);
28 //staptest// socketpair (PF_INET, SOCK_STREAM, IPPROTO_TCP, XXXX) = -NNNN (EOPNOTSUPP)
29
30 socketpair(PF_INET, SOCK_STREAM, IPPROTO_ICMP, fds);
31 //staptest// socketpair (PF_INET, SOCK_STREAM, IPPROTO_ICMP, XXXX) = -NNNN (EPROTONOSUPPORT)
32
33 socketpair(PF_UNIX, SOCK_DGRAM, 0, fds);
34 //staptest// socketpair (PF_LOCAL, SOCK_DGRAM, 0, XXXX) = 0
35
36 close(fds[0]);
37 //staptest// close (NNNN) = 0
38 close(fds[1]);
39 //staptest// close (NNNN) = 0
40
41 socketpair(PF_UNIX, SOCK_STREAM, 0, fds);
42 //staptest// socketpair (PF_LOCAL, SOCK_STREAM, 0, XXXX) = 0
43
44 close(fds[0]);
45 //staptest// close (NNNN) = 0
46 close(fds[1]);
47 //staptest// close (NNNN) = 0
48
49 #ifdef SOCK_CLOEXEC
50 socketpair(PF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds);
51 //staptest// socketpair (PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0, XXXX) = 0
52
53 close(fds[0]);
54 //staptest// close (NNNN) = 0
55 close(fds[1]);
56 //staptest// close (NNNN) = 0
57 #endif
58
59 #ifdef SOCK_NONBLOCK
60 socketpair(PF_UNIX, SOCK_STREAM|SOCK_NONBLOCK, 0, fds);
61 //staptest// socketpair (PF_LOCAL, SOCK_STREAM|SOCK_NONBLOCK, 0, XXXX) = 0
62
63 close(fds[0]);
64 //staptest// close (NNNN) = 0
65 close(fds[1]);
66 //staptest// close (NNNN) = 0
67 #endif
68
69 socketpair(-1, SOCK_STREAM, 0, fds);
70 //staptest// socketpair (0xffffffff, SOCK_STREAM, 0, XXXX) = -NNNN (EAFNOSUPPORT)
71
72 socketpair(PF_UNIX, -1, 0, fds);
73 #if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
74 //staptest// socketpair (PF_LOCAL, SOCK_CLOEXEC|SOCK_NONBLOCK|0xfff7f7ff, 0, XXXX) = -NNNN (EINVAL)
75 #else
76 //staptest// socketpair (PF_LOCAL, 0xffffffff, 0, XXXX) = -NNNN (EINVAL)
77 #endif
78
79 socketpair(PF_UNIX, SOCK_STREAM, -1, fds);
80 //staptest// socketpair (PF_LOCAL, SOCK_STREAM, -1, XXXX) = -NNNN (EPROTONOSUPPORT)
81
82 socketpair(PF_UNIX, SOCK_STREAM, 0, (int *)-1);
83 #ifdef __s390__
84 //staptest// socketpair (PF_LOCAL, SOCK_STREAM, 0, 0x[7]?[f]+) = -NNNN (EFAULT)
85 #else
86 //staptest// socketpair (PF_LOCAL, SOCK_STREAM, 0, 0x[f]+) = -NNNN (EFAULT)
87 #endif
88 }