1 // SPDX-License-Identifier: LGPL-2.1
3 #include <sys/socket.h>
10 # define SOCK_CLOEXEC 02000000
14 # define SOCK_NONBLOCK 00004000
17 #ifndef SOCK_TYPE_MASK
18 #define SOCK_TYPE_MASK 0xf
21 static size_t syscall_arg__scnprintf_socket_type(char *bf, size_t size, struct syscall_arg *arg)
23 bool show_prefix = arg->show_string_prefix;
24 const char *prefix = "SOCK_";
27 flags = type & ~SOCK_TYPE_MASK;
29 type &= SOCK_TYPE_MASK;
31 * Can't use a strarray, MIPS may override for ABI reasons.
34 #define P_SK_TYPE(n) case SOCK_##n: printed = scnprintf(bf, size, "%s%s", show_prefix ? prefix : "", #n); break;
44 printed = scnprintf(bf, size, "%#x", type);
47 #define P_SK_FLAG(n) \
48 if (flags & SOCK_##n) { \
49 printed += scnprintf(bf + printed, size - printed, "|%s", #n); \
58 printed += scnprintf(bf + printed, size - printed, "|%#x", flags);
63 #define SCA_SK_TYPE syscall_arg__scnprintf_socket_type