File: getsockopt.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 (81 lines) | stat: -rw-r--r-- 2,747 bytes parent folder | download | duplicates (2)
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
/* COVERAGE: getsockopt */

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/mman.h>

int main()
{
    mlockall(MCL_CURRENT);

    int sock_stream;
    int fd_null;
    struct sockaddr_in sin0, sin1;
    socklen_t sinlen;
    int optval;
    socklen_t optlen;

    /* initialize local sockaddr */
    sin0.sin_family = AF_INET;
    sin0.sin_port = 0;
    sin0.sin_addr.s_addr = INADDR_ANY;
    sinlen = sizeof(sin1);
    optlen = sizeof(optval);

    sock_stream = socket(PF_INET, SOCK_STREAM, 0);
    //staptest// socket (PF_INET, SOCK_STREAM, IPPROTO_IP) = NNNN

    bind(sock_stream, (struct sockaddr *)&sin0, sizeof(sin0));
    //staptest// bind (NNNN, {AF_INET, 0.0.0.0, 0}, 16) = 0

    fd_null = open("/dev/null", O_WRONLY);
    //staptest// [[[[open (!!!!openat (AT_FDCWD, ]]]]"/dev/null", O_WRONLY) = NNNN

    getsockopt(-1, SOL_SOCKET, SO_OOBINLINE, &optval, &optlen);
    //staptest// getsockopt (-1, SOL_SOCKET, SO_OOBINLINE, XXXX, XXXX) = -NNNN (EBADF)

    getsockopt(fd_null, SOL_SOCKET, SO_OOBINLINE, &optval, &optlen);
    //staptest// getsockopt (NNNN, SOL_SOCKET, SO_OOBINLINE, XXXX, XXXX) = -NNNN (ENOTSOCK)

    getsockopt(sock_stream, SOL_SOCKET, SO_OOBINLINE, (void *)-1, &optlen);
#ifdef __s390__
    //staptest// getsockopt (NNNN, SOL_SOCKET, SO_OOBINLINE, 0x[7]?[f]+, XXXX) = -NNNN (EFAULT)
#else
    //staptest// getsockopt (NNNN, SOL_SOCKET, SO_OOBINLINE, 0x[f]+, XXXX) = -NNNN (EFAULT)
#endif

    getsockopt(sock_stream, SOL_SOCKET, SO_OOBINLINE, &optval, (socklen_t *)-1);
#ifdef __s390__
    //staptest// getsockopt (NNNN, SOL_SOCKET, SO_OOBINLINE, XXXX, 0x[7]?[f]+) = -NNNN (EFAULT)
#else
    //staptest// getsockopt (NNNN, SOL_SOCKET, SO_OOBINLINE, XXXX, 0x[f]+) = -NNNN (EFAULT)
#endif

    getsockopt(sock_stream, 500, SO_OOBINLINE, &optval, &optlen);
    //staptest// getsockopt (NNNN, 0x1f4, SO_OOBINLINE, XXXX, XXXX) = -NNNN (EOPNOTSUPP)

    getsockopt(sock_stream, -1, SO_OOBINLINE, &optval, &optlen);
    //staptest// getsockopt (NNNN, 0x[f]+, SO_OOBINLINE, XXXX, XXXX) = -NNNN (EOPNOTSUPP)

    getsockopt(sock_stream, IPPROTO_UDP, SO_OOBINLINE, &optval, &optlen);
    //staptest// getsockopt (NNNN, SOL_UDP, SO_OOBINLINE, XXXX, XXXX) = -NNNN (EOPNOTSUPP)

    getsockopt(sock_stream, IPPROTO_IP, -1, &optval, &optlen);
    //staptest// getsockopt (NNNN, SOL_IP, 0x[f]+, XXXX, XXXX) = -NNNN (ENOPROTOOPT)

    getsockopt(sock_stream, SOL_SOCKET, SO_OOBINLINE, &optval, &optlen);
    //staptest// getsockopt (NNNN, SOL_SOCKET, SO_OOBINLINE, XXXX, XXXX) = 0

    close(sock_stream);
    //staptest// close (NNNN) = 0

    close(fd_null);
    //staptest// close (NNNN) = 0

    return 0;
}