blob: dc8ac27d27c1fa987a7c1bcc9ed543f06fd6800d [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Frederic Weisbecker47788c52009-04-08 20:40:59 +02002#ifndef _TRACE_SYSCALL_H
3#define _TRACE_SYSCALL_H
4
Jason Barona871bd32009-08-10 16:52:31 -04005#include <linux/tracepoint.h>
Jason Baronfb34a082009-08-10 16:52:47 -04006#include <linux/unistd.h>
Steven Rostedt (Red Hat)af658dc2015-04-29 14:36:05 -04007#include <linux/trace_events.h>
Oleg Nesterov4af42062014-04-13 20:58:54 +02008#include <linux/thread_info.h>
Jason Barona871bd32009-08-10 16:52:31 -04009
Frederic Weisbecker47788c52009-04-08 20:40:59 +020010#include <asm/ptrace.h>
11
Jason Barona871bd32009-08-10 16:52:31 -040012
Frederic Weisbecker47788c52009-04-08 20:40:59 +020013/*
14 * A syscall entry in the ftrace syscalls array.
15 *
16 * @name: name of the syscall
Lai Jiangshanc252f652009-12-01 16:23:47 +080017 * @syscall_nr: number of the syscall
Frederic Weisbecker47788c52009-04-08 20:40:59 +020018 * @nb_args: number of parameters it takes
19 * @types: list of types as strings
20 * @args: list of args as strings (args[i] matches types[i])
Tom Zanussi44a6a4e2013-06-29 00:08:05 -050021 * @enter_fields: list of fields for syscall_enter trace event
Li Zefan540b7b82009-08-19 15:54:51 +080022 * @enter_event: associated syscall_enter trace event
23 * @exit_event: associated syscall_exit trace event
Frederic Weisbecker47788c52009-04-08 20:40:59 +020024 */
25struct syscall_metadata {
26 const char *name;
Lai Jiangshanc252f652009-12-01 16:23:47 +080027 int syscall_nr;
Frederic Weisbecker47788c52009-04-08 20:40:59 +020028 int nb_args;
29 const char **types;
30 const char **args;
Steven Rostedt2e33af02010-04-22 10:35:55 -040031 struct list_head enter_fields;
Li Zefan540b7b82009-08-19 15:54:51 +080032
Steven Rostedt (Red Hat)2425bcb2015-05-05 11:45:27 -040033 struct trace_event_call *enter_event;
34 struct trace_event_call *exit_event;
Frederic Weisbecker47788c52009-04-08 20:40:59 +020035};
36
Oleg Nesterov4af42062014-04-13 20:58:54 +020037#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
38static inline void syscall_tracepoint_update(struct task_struct *p)
39{
40 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
41 set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
42 else
43 clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
44}
45#else
46static inline void syscall_tracepoint_update(struct task_struct *p)
47{
48}
49#endif
50
Frederic Weisbecker47788c52009-04-08 20:40:59 +020051#endif /* _TRACE_SYSCALL_H */