Commit | Line | Data |
---|---|---|
a30e6259 ACM |
1 | #include <sys/types.h> |
2 | #include <sys/socket.h> | |
3 | ||
4 | #ifndef MSG_PROBE | |
5 | #define MSG_PROBE 0x10 | |
6 | #endif | |
7 | #ifndef MSG_WAITFORONE | |
8 | #define MSG_WAITFORONE 0x10000 | |
9 | #endif | |
10 | #ifndef MSG_SENDPAGE_NOTLAST | |
11 | #define MSG_SENDPAGE_NOTLAST 0x20000 | |
12 | #endif | |
13 | #ifndef MSG_FASTOPEN | |
14 | #define MSG_FASTOPEN 0x20000000 | |
15 | #endif | |
16 | #ifndef MSG_CMSG_CLOEXEC | |
17 | # define MSG_CMSG_CLOEXEC 0x40000000 | |
18 | #endif | |
19 | ||
20 | static size_t syscall_arg__scnprintf_msg_flags(char *bf, size_t size, | |
21 | struct syscall_arg *arg) | |
22 | { | |
23 | int printed = 0, flags = arg->val; | |
24 | ||
25 | if (flags == 0) | |
26 | return scnprintf(bf, size, "NONE"); | |
27 | #define P_MSG_FLAG(n) \ | |
28 | if (flags & MSG_##n) { \ | |
29 | printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \ | |
30 | flags &= ~MSG_##n; \ | |
31 | } | |
32 | ||
33 | P_MSG_FLAG(OOB); | |
34 | P_MSG_FLAG(PEEK); | |
35 | P_MSG_FLAG(DONTROUTE); | |
a30e6259 ACM |
36 | P_MSG_FLAG(CTRUNC); |
37 | P_MSG_FLAG(PROBE); | |
38 | P_MSG_FLAG(TRUNC); | |
39 | P_MSG_FLAG(DONTWAIT); | |
40 | P_MSG_FLAG(EOR); | |
41 | P_MSG_FLAG(WAITALL); | |
42 | P_MSG_FLAG(FIN); | |
43 | P_MSG_FLAG(SYN); | |
44 | P_MSG_FLAG(CONFIRM); | |
45 | P_MSG_FLAG(RST); | |
46 | P_MSG_FLAG(ERRQUEUE); | |
47 | P_MSG_FLAG(NOSIGNAL); | |
48 | P_MSG_FLAG(MORE); | |
49 | P_MSG_FLAG(WAITFORONE); | |
50 | P_MSG_FLAG(SENDPAGE_NOTLAST); | |
51 | P_MSG_FLAG(FASTOPEN); | |
52 | P_MSG_FLAG(CMSG_CLOEXEC); | |
53 | #undef P_MSG_FLAG | |
54 | ||
55 | if (flags) | |
56 | printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags); | |
57 | ||
58 | return printed; | |
59 | } | |
60 | ||
61 | #define SCA_MSG_FLAGS syscall_arg__scnprintf_msg_flags |