File: socketpair.c

package info (click to toggle)
systemtap 4.8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 39,000 kB
  • sloc: cpp: 78,785; ansic: 62,419; xml: 49,443; exp: 42,735; sh: 11,254; python: 3,062; perl: 2,252; tcl: 1,305; makefile: 1,072; lisp: 105; awk: 101; asm: 91; java: 56; sed: 16
file content (88 lines) | stat: -rw-r--r-- 2,915 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/* COVERAGE: socketpair close */

#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/ip.h>

int main()
{
    int fds[2], fl, i;

    socketpair(0, SOCK_STREAM, 0, fds);
    //staptest// socketpair (PF_UNSPEC, SOCK_STREAM, 0, XXXX) = -NNNN (EAFNOSUPPORT)

    socketpair(PF_INET, 75, IPPROTO_IP, fds);
    //staptest// socketpair (PF_INET, 0x4b, IPPROTO_IP, XXXX) = -NNNN (EINVAL)

    socketpair(PF_UNIX, SOCK_STREAM, 0, 0);
    //staptest// socketpair (PF_LOCAL, SOCK_STREAM, 0, 0x0) = -NNNN (EFAULT)

    socketpair(PF_INET, SOCK_DGRAM, IPPROTO_UDP, fds);
    //staptest// socketpair (PF_INET, SOCK_DGRAM, IPPROTO_UDP, XXXX) = -NNNN (EOPNOTSUPP)

    socketpair(PF_INET, SOCK_DGRAM, IPPROTO_TCP, fds);
    //staptest// socketpair (PF_INET, SOCK_DGRAM, IPPROTO_TCP, XXXX) = -NNNN (EPROTONOSUPPORT)

    socketpair(PF_INET, SOCK_STREAM, IPPROTO_TCP, fds);
    //staptest// socketpair (PF_INET, SOCK_STREAM, IPPROTO_TCP, XXXX) = -NNNN (EOPNOTSUPP)

    socketpair(PF_INET, SOCK_STREAM, IPPROTO_ICMP, fds);
    //staptest// socketpair (PF_INET, SOCK_STREAM, IPPROTO_ICMP, XXXX) = -NNNN (EPROTONOSUPPORT)

    socketpair(PF_UNIX, SOCK_DGRAM, 0, fds);
    //staptest// socketpair (PF_LOCAL, SOCK_DGRAM, 0, XXXX) = 0

    close(fds[0]);
    //staptest// close (NNNN) = 0
    close(fds[1]);
    //staptest// close (NNNN) = 0

    socketpair(PF_UNIX, SOCK_STREAM, 0, fds);
    //staptest// socketpair (PF_LOCAL, SOCK_STREAM, 0, XXXX) = 0

    close(fds[0]);
    //staptest// close (NNNN) = 0
    close(fds[1]);
    //staptest// close (NNNN) = 0

#ifdef SOCK_CLOEXEC
    socketpair(PF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0, fds);
    //staptest// socketpair (PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0, XXXX) = 0

    close(fds[0]);
    //staptest// close (NNNN) = 0
    close(fds[1]);
    //staptest// close (NNNN) = 0
#endif

#ifdef SOCK_NONBLOCK
    socketpair(PF_UNIX, SOCK_STREAM|SOCK_NONBLOCK, 0, fds);
    //staptest// socketpair (PF_LOCAL, SOCK_STREAM|SOCK_NONBLOCK, 0, XXXX) = 0

    close(fds[0]);
    //staptest// close (NNNN) = 0
    close(fds[1]);
    //staptest// close (NNNN) = 0
#endif

    socketpair(-1, SOCK_STREAM, 0, fds);
    //staptest// socketpair (0xffffffff, SOCK_STREAM, 0, XXXX) = -NNNN (EAFNOSUPPORT)

    socketpair(PF_UNIX, -1, 0, fds);
#if defined(SOCK_CLOEXEC) && defined(SOCK_NONBLOCK)
    //staptest// socketpair (PF_LOCAL, SOCK_CLOEXEC|SOCK_NONBLOCK|0xfff7f7ff, 0, XXXX) = -NNNN (EINVAL)
#else
    //staptest// socketpair (PF_LOCAL, 0xffffffff, 0, XXXX) = -NNNN (EINVAL)
#endif

    socketpair(PF_UNIX, SOCK_STREAM, -1, fds);
    //staptest// socketpair (PF_LOCAL, SOCK_STREAM, -1, XXXX) = -NNNN (EPROTONOSUPPORT)

    socketpair(PF_UNIX, SOCK_STREAM, 0, (int *)-1);
#ifdef __s390__
    //staptest// socketpair (PF_LOCAL, SOCK_STREAM, 0, 0x[7]?[f]+) = -NNNN (EFAULT)
#else
    //staptest// socketpair (PF_LOCAL, SOCK_STREAM, 0, 0x[f]+) = -NNNN (EFAULT)
#endif
}