| 1 |
/* COVERAGE: getsockopt */ |
| 2 |
|
| 3 |
#include <stdio.h> |
| 4 |
#include <unistd.h> |
| 5 |
#include <sys/types.h> |
| 6 |
#include <sys/stat.h> |
| 7 |
#include <fcntl.h> |
| 8 |
#include <sys/socket.h> |
| 9 |
#include <netinet/in.h> |
| 10 |
#include <sys/mman.h> |
| 11 |
|
| 12 |
int main() |
| 13 |
{ |
| 14 |
mlockall(MCL_CURRENT); |
| 15 |
|
| 16 |
int sock_stream; |
| 17 |
int fd_null; |
| 18 |
struct sockaddr_in sin0, sin1; |
| 19 |
socklen_t sinlen; |
| 20 |
int optval; |
| 21 |
socklen_t optlen; |
| 22 |
|
| 23 |
/* initialize local sockaddr */ |
| 24 |
sin0.sin_family = AF_INET; |
| 25 |
sin0.sin_port = 0; |
| 26 |
sin0.sin_addr.s_addr = INADDR_ANY; |
| 27 |
sinlen = sizeof(sin1); |
| 28 |
optlen = sizeof(optval); |
| 29 |
|
| 30 |
sock_stream = socket(PF_INET, SOCK_STREAM, 0); |
| 31 |
//staptest// socket (PF_INET, SOCK_STREAM, IPPROTO_IP) = NNNN |
| 32 |
|
| 33 |
bind(sock_stream, (struct sockaddr *)&sin0, sizeof(sin0)); |
| 34 |
//staptest// bind (NNNN, {AF_INET, 0.0.0.0, 0}, 16) = 0 |
| 35 |
|
| 36 |
fd_null = open("/dev/null", O_WRONLY); |
| 37 |
//staptest// [[[[open (!!!!openat (AT_FDCWD, ]]]]"/dev/null", O_WRONLY) = NNNN |
| 38 |
|
| 39 |
getsockopt(-1, SOL_SOCKET, SO_OOBINLINE, &optval, &optlen); |
| 40 |
//staptest// getsockopt (-1, SOL_SOCKET, SO_OOBINLINE, XXXX, XXXX) = -NNNN (EBADF) |
| 41 |
|
| 42 |
getsockopt(fd_null, SOL_SOCKET, SO_OOBINLINE, &optval, &optlen); |
| 43 |
//staptest// getsockopt (NNNN, SOL_SOCKET, SO_OOBINLINE, XXXX, XXXX) = -NNNN (ENOTSOCK) |
| 44 |
|
| 45 |
getsockopt(sock_stream, SOL_SOCKET, SO_OOBINLINE, (void *)-1, &optlen); |
| 46 |
#ifdef __s390__ |
| 47 |
//staptest// getsockopt (NNNN, SOL_SOCKET, SO_OOBINLINE, 0x[7]?[f]+, XXXX) = -NNNN (EFAULT) |
| 48 |
#else |
| 49 |
//staptest// getsockopt (NNNN, SOL_SOCKET, SO_OOBINLINE, 0x[f]+, XXXX) = -NNNN (EFAULT) |
| 50 |
#endif |
| 51 |
|
| 52 |
getsockopt(sock_stream, SOL_SOCKET, SO_OOBINLINE, &optval, (socklen_t *)-1); |
| 53 |
#ifdef __s390__ |
| 54 |
//staptest// getsockopt (NNNN, SOL_SOCKET, SO_OOBINLINE, XXXX, 0x[7]?[f]+) = -NNNN (EFAULT) |
| 55 |
#else |
| 56 |
//staptest// getsockopt (NNNN, SOL_SOCKET, SO_OOBINLINE, XXXX, 0x[f]+) = -NNNN (EFAULT) |
| 57 |
#endif |
| 58 |
|
| 59 |
getsockopt(sock_stream, 500, SO_OOBINLINE, &optval, &optlen); |
| 60 |
//staptest// getsockopt (NNNN, 0x1f4, SO_OOBINLINE, XXXX, XXXX) = -NNNN (EOPNOTSUPP) |
| 61 |
|
| 62 |
getsockopt(sock_stream, -1, SO_OOBINLINE, &optval, &optlen); |
| 63 |
//staptest// getsockopt (NNNN, 0x[f]+, SO_OOBINLINE, XXXX, XXXX) = -NNNN (EOPNOTSUPP) |
| 64 |
|
| 65 |
getsockopt(sock_stream, IPPROTO_UDP, SO_OOBINLINE, &optval, &optlen); |
| 66 |
//staptest// getsockopt (NNNN, SOL_UDP, SO_OOBINLINE, XXXX, XXXX) = -NNNN (EOPNOTSUPP) |
| 67 |
|
| 68 |
getsockopt(sock_stream, IPPROTO_IP, -1, &optval, &optlen); |
| 69 |
//staptest// getsockopt (NNNN, SOL_IP, 0x[f]+, XXXX, XXXX) = -NNNN (ENOPROTOOPT) |
| 70 |
|
| 71 |
getsockopt(sock_stream, SOL_SOCKET, SO_OOBINLINE, &optval, &optlen); |
| 72 |
//staptest// getsockopt (NNNN, SOL_SOCKET, SO_OOBINLINE, XXXX, XXXX) = 0 |
| 73 |
|
| 74 |
close(sock_stream); |
| 75 |
//staptest// close (NNNN) = 0 |
| 76 |
|
| 77 |
close(fd_null); |
| 78 |
//staptest// close (NNNN) = 0 |
| 79 |
|
| 80 |
return 0; |
| 81 |
} |