1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _PERF_TRACE_BEAUTY_H
3 #define _PERF_TRACE_BEAUTY_H
5 #include <linux/kernel.h>
6 #include <linux/types.h>
15 #define DEFINE_STRARRAY(array) struct strarray strarray__##array = { \
16 .nr_entries = ARRAY_SIZE(array), \
20 #define DEFINE_STRARRAY_OFFSET(array, off) struct strarray strarray__##array = { \
22 .nr_entries = ARRAY_SIZE(array), \
26 size_t strarray__scnprintf(struct strarray
*sa
, char *bf
, size_t size
, const char *intfmt
, int val
);
31 size_t pid__scnprintf_fd(struct trace
*trace
, pid_t pid
, int fd
, char *bf
, size_t size
);
34 * @val: value of syscall argument being formatted
35 * @args: All the args, use syscall_args__val(arg, nth) to access one
36 * @thread: tid state (maps, pid, tid, etc)
37 * @trace: 'perf trace' internals: all threads, etc
38 * @parm: private area, may be an strarray, for instance
39 * @idx: syscall arg idx (is this the first?)
40 * @mask: a syscall arg may mask another arg, see syscall_arg__scnprintf_futex_op
46 struct thread
*thread
;
53 unsigned long syscall_arg__val(struct syscall_arg
*arg
, u8 idx
);
55 size_t syscall_arg__scnprintf_strarrays(char *bf
, size_t size
, struct syscall_arg
*arg
);
56 #define SCA_STRARRAYS syscall_arg__scnprintf_strarrays
58 size_t syscall_arg__scnprintf_fd(char *bf
, size_t size
, struct syscall_arg
*arg
);
59 #define SCA_FD syscall_arg__scnprintf_fd
61 size_t syscall_arg__scnprintf_hex(char *bf
, size_t size
, struct syscall_arg
*arg
);
62 #define SCA_HEX syscall_arg__scnprintf_hex
64 size_t syscall_arg__scnprintf_int(char *bf
, size_t size
, struct syscall_arg
*arg
);
65 #define SCA_INT syscall_arg__scnprintf_int
67 size_t syscall_arg__scnprintf_long(char *bf
, size_t size
, struct syscall_arg
*arg
);
68 #define SCA_LONG syscall_arg__scnprintf_long
70 size_t syscall_arg__scnprintf_pid(char *bf
, size_t size
, struct syscall_arg
*arg
);
71 #define SCA_PID syscall_arg__scnprintf_pid
73 size_t syscall_arg__scnprintf_clone_flags(char *bf
, size_t size
, struct syscall_arg
*arg
);
74 #define SCA_CLONE_FLAGS syscall_arg__scnprintf_clone_flags
76 size_t syscall_arg__scnprintf_fcntl_cmd(char *bf
, size_t size
, struct syscall_arg
*arg
);
77 #define SCA_FCNTL_CMD syscall_arg__scnprintf_fcntl_cmd
79 size_t syscall_arg__scnprintf_fcntl_arg(char *bf
, size_t size
, struct syscall_arg
*arg
);
80 #define SCA_FCNTL_ARG syscall_arg__scnprintf_fcntl_arg
82 size_t syscall_arg__scnprintf_flock(char *bf
, size_t size
, struct syscall_arg
*arg
);
83 #define SCA_FLOCK syscall_arg__scnprintf_flock
85 size_t syscall_arg__scnprintf_ioctl_cmd(char *bf
, size_t size
, struct syscall_arg
*arg
);
86 #define SCA_IOCTL_CMD syscall_arg__scnprintf_ioctl_cmd
88 size_t syscall_arg__scnprintf_kcmp_type(char *bf
, size_t size
, struct syscall_arg
*arg
);
89 #define SCA_KCMP_TYPE syscall_arg__scnprintf_kcmp_type
91 size_t syscall_arg__scnprintf_kcmp_idx(char *bf
, size_t size
, struct syscall_arg
*arg
);
92 #define SCA_KCMP_IDX syscall_arg__scnprintf_kcmp_idx
94 size_t syscall_arg__scnprintf_pkey_alloc_access_rights(char *bf
, size_t size
, struct syscall_arg
*arg
);
95 #define SCA_PKEY_ALLOC_ACCESS_RIGHTS syscall_arg__scnprintf_pkey_alloc_access_rights
97 size_t syscall_arg__scnprintf_open_flags(char *bf
, size_t size
, struct syscall_arg
*arg
);
98 #define SCA_OPEN_FLAGS syscall_arg__scnprintf_open_flags
100 size_t syscall_arg__scnprintf_prctl_option(char *bf
, size_t size
, struct syscall_arg
*arg
);
101 #define SCA_PRCTL_OPTION syscall_arg__scnprintf_prctl_option
103 size_t syscall_arg__scnprintf_prctl_arg2(char *bf
, size_t size
, struct syscall_arg
*arg
);
104 #define SCA_PRCTL_ARG2 syscall_arg__scnprintf_prctl_arg2
106 size_t syscall_arg__scnprintf_prctl_arg3(char *bf
, size_t size
, struct syscall_arg
*arg
);
107 #define SCA_PRCTL_ARG3 syscall_arg__scnprintf_prctl_arg3
109 size_t syscall_arg__scnprintf_socket_protocol(char *bf
, size_t size
, struct syscall_arg
*arg
);
110 #define SCA_SK_PROTO syscall_arg__scnprintf_socket_protocol
112 size_t syscall_arg__scnprintf_statx_flags(char *bf
, size_t size
, struct syscall_arg
*arg
);
113 #define SCA_STATX_FLAGS syscall_arg__scnprintf_statx_flags
115 size_t syscall_arg__scnprintf_statx_mask(char *bf
, size_t size
, struct syscall_arg
*arg
);
116 #define SCA_STATX_MASK syscall_arg__scnprintf_statx_mask
118 size_t open__scnprintf_flags(unsigned long flags
, char *bf
, size_t size
);
120 void syscall_arg__set_ret_scnprintf(struct syscall_arg
*arg
,
121 size_t (*ret_scnprintf
)(char *bf
, size_t size
, struct syscall_arg
*arg
));
123 const char *arch_syscalls__strerrno(const char *arch
, int err
);
125 #endif /* _PERF_TRACE_BEAUTY_H */