]>
git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blob - tools/perf/trace/beauty/socket_type.c
1 // SPDX-License-Identifier: GPL-2.0
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
)
25 flags
= type
& ~SOCK_TYPE_MASK
;
27 type
&= SOCK_TYPE_MASK
;
29 * Can't use a strarray, MIPS may override for ABI reasons.
32 #define P_SK_TYPE(n) case SOCK_##n: printed = scnprintf(bf, size, #n); break;
42 printed
= scnprintf(bf
, size
, "%#x", type
);
45 #define P_SK_FLAG(n) \
46 if (flags & SOCK_##n) { \
47 printed += scnprintf(bf + printed, size - printed, "|%s", #n); \
56 printed
+= scnprintf(bf
+ printed
, size
- printed
, "|%#x", flags
);
61 #define SCA_SK_TYPE syscall_arg__scnprintf_socket_type