#include <wrapper/tracepoint.h>
#include <wrapper/file.h>
#include <wrapper/rcu.h>
+#include <wrapper/syscall.h>
#include <lttng-events.h>
#ifndef CONFIG_COMPAT
# endif
#endif
+/* in_compat_syscall appears in kernel 4.6. */
+#ifndef in_compat_syscall
+ #define in_compat_syscall() is_compat_task()
+#endif
+
enum sc_type {
SC_TYPE_ENTRY,
SC_TYPE_EXIT,
#define LTTNG_PACKAGE_BUILD
#define CREATE_TRACE_POINTS
#define TP_MODULE_NOINIT
-#define TRACE_INCLUDE_PATH ../instrumentation/syscalls/headers
+#define TRACE_INCLUDE_PATH instrumentation/syscalls/headers
#define PARAMS(args...) args
LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(syscall_entry_##_name, PARAMS(_fields))
#define SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(_template, _name) \
LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(syscall_entry_##_template, syscall_entry_##_name)
+/* Enumerations only defined at first inclusion. */
+#define SC_LTTNG_TRACEPOINT_ENUM(_name, _values) \
+ LTTNG_TRACEPOINT_ENUM(_name, PARAMS(_values))
#undef TRACE_SYSTEM
#define TRACE_SYSTEM syscall_entry_integers
#define TRACE_INCLUDE_FILE syscalls_integers
#include <instrumentation/syscalls/headers/syscalls_pointers.h>
#undef TRACE_INCLUDE_FILE
#undef TRACE_SYSTEM
+#undef SC_LTTNG_TRACEPOINT_ENUM
#undef SC_LTTNG_TRACEPOINT_EVENT_CODE
#undef SC_LTTNG_TRACEPOINT_EVENT
#undef SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS
/* Hijack probe callback for compat system call enter */
#define TP_PROBE_CB(_template) &syscall_entry_probe
+#define LTTNG_SC_COMPAT
#define SC_LTTNG_TRACEPOINT_EVENT(_name, _proto, _args, _fields) \
LTTNG_TRACEPOINT_EVENT(compat_syscall_entry_##_name, PARAMS(_proto), PARAMS(_args), \
PARAMS(_fields))
#define SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(_template, _name) \
LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(compat_syscall_entry_##_template, \
compat_syscall_entry_##_name)
+/* Enumerations only defined at inital inclusion (not here). */
+#define SC_LTTNG_TRACEPOINT_ENUM(_name, _values)
#define TRACE_SYSTEM compat_syscall_entry_integers
#define TRACE_INCLUDE_FILE compat_syscalls_integers
#include <instrumentation/syscalls/headers/compat_syscalls_integers.h>
#include <instrumentation/syscalls/headers/compat_syscalls_pointers.h>
#undef TRACE_INCLUDE_FILE
#undef TRACE_SYSTEM
+#undef SC_LTTNG_TRACEPOINT_ENUM
#undef SC_LTTNG_TRACEPOINT_EVENT_CODE
#undef SC_LTTNG_TRACEPOINT_EVENT
#undef SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS
#undef TP_PROBE_CB
#undef _TRACE_SYSCALLS_INTEGERS_H
#undef _TRACE_SYSCALLS_POINTERS_H
+#undef LTTNG_SC_COMPAT
#undef SC_ENTER
#define SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(_template, _name) \
LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(syscall_exit_##_template, \
syscall_exit_##_name)
+/* Enumerations only defined at inital inclusion (not here). */
+#define SC_LTTNG_TRACEPOINT_ENUM(_name, _values)
#define TRACE_SYSTEM syscall_exit_integers
#define TRACE_INCLUDE_FILE syscalls_integers
#include <instrumentation/syscalls/headers/syscalls_integers.h>
#include <instrumentation/syscalls/headers/syscalls_pointers.h>
#undef TRACE_INCLUDE_FILE
#undef TRACE_SYSTEM
+#undef SC_LTTNG_TRACEPOINT_ENUM
#undef SC_LTTNG_TRACEPOINT_EVENT_CODE
#undef SC_LTTNG_TRACEPOINT_EVENT
#undef SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS
/* Hijack probe callback for compat system call exit */
#define TP_PROBE_CB(_template) &syscall_exit_probe
+#define LTTNG_SC_COMPAT
#define SC_LTTNG_TRACEPOINT_EVENT(_name, _proto, _args, _fields) \
LTTNG_TRACEPOINT_EVENT(compat_syscall_exit_##_name, PARAMS(_proto), PARAMS(_args), \
PARAMS(_fields))
#define SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(_template, _name) \
LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(compat_syscall_exit_##_template, \
compat_syscall_exit_##_name)
+/* Enumerations only defined at inital inclusion (not here). */
+#define SC_LTTNG_TRACEPOINT_ENUM(_name, _values)
#define TRACE_SYSTEM compat_syscall_exit_integers
#define TRACE_INCLUDE_FILE compat_syscalls_integers
#include <instrumentation/syscalls/headers/compat_syscalls_integers.h>
#include <instrumentation/syscalls/headers/compat_syscalls_pointers.h>
#undef TRACE_INCLUDE_FILE
#undef TRACE_SYSTEM
+#undef SC_LTTNG_TRACEPOINT_ENUM
#undef SC_LTTNG_TRACEPOINT_EVENT_CODE
#undef SC_LTTNG_TRACEPOINT_EVENT
#undef SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS
#undef TP_PROBE_CB
#undef _TRACE_SYSCALLS_INTEGERS_H
#undef _TRACE_SYSCALLS_POINTERS_H
+#undef LTTNG_SC_COMPAT
#undef SC_EXIT
static void syscall_entry_unknown(struct lttng_event *event,
struct pt_regs *regs, unsigned int id)
{
- unsigned long args[UNKNOWN_SYSCALL_NRARGS];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, UNKNOWN_SYSCALL_NRARGS, args);
- if (unlikely(is_compat_task()))
+ lttng_syscall_get_arguments(current, regs, args);
+ if (unlikely(in_compat_syscall()))
__event_probe__compat_syscall_entry_unknown(event, id, args);
else
__event_probe__syscall_entry_unknown(event, id, args);
const struct trace_syscall_entry *table, *entry;
size_t table_len;
- if (unlikely(is_compat_task())) {
+ if (unlikely(in_compat_syscall())) {
struct lttng_syscall_filter *filter;
filter = lttng_rcu_dereference(chan->sc_filter);
syscall_entry_unknown(unknown_event, regs, id);
return;
}
- if (unlikely(is_compat_task()))
+ if (unlikely(in_compat_syscall()))
event = chan->compat_sc_table[id];
else
event = chan->sc_table[id];
case 1:
{
void (*fptr)(void *__data, unsigned long arg0) = entry->func;
- unsigned long args[1];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, entry->nrargs, args);
+ lttng_syscall_get_arguments(current, regs, args);
fptr(event, args[0]);
break;
}
void (*fptr)(void *__data,
unsigned long arg0,
unsigned long arg1) = entry->func;
- unsigned long args[2];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, entry->nrargs, args);
+ lttng_syscall_get_arguments(current, regs, args);
fptr(event, args[0], args[1]);
break;
}
unsigned long arg0,
unsigned long arg1,
unsigned long arg2) = entry->func;
- unsigned long args[3];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, entry->nrargs, args);
+ lttng_syscall_get_arguments(current, regs, args);
fptr(event, args[0], args[1], args[2]);
break;
}
unsigned long arg1,
unsigned long arg2,
unsigned long arg3) = entry->func;
- unsigned long args[4];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, entry->nrargs, args);
+ lttng_syscall_get_arguments(current, regs, args);
fptr(event, args[0], args[1], args[2], args[3]);
break;
}
unsigned long arg2,
unsigned long arg3,
unsigned long arg4) = entry->func;
- unsigned long args[5];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, entry->nrargs, args);
+ lttng_syscall_get_arguments(current, regs, args);
fptr(event, args[0], args[1], args[2], args[3], args[4]);
break;
}
unsigned long arg3,
unsigned long arg4,
unsigned long arg5) = entry->func;
- unsigned long args[6];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, entry->nrargs, args);
+ lttng_syscall_get_arguments(current, regs, args);
fptr(event, args[0], args[1], args[2],
args[3], args[4], args[5]);
break;
static void syscall_exit_unknown(struct lttng_event *event,
struct pt_regs *regs, int id, long ret)
{
- unsigned long args[UNKNOWN_SYSCALL_NRARGS];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, UNKNOWN_SYSCALL_NRARGS, args);
- if (unlikely(is_compat_task()))
+ lttng_syscall_get_arguments(current, regs, args);
+ if (unlikely(in_compat_syscall()))
__event_probe__compat_syscall_exit_unknown(event, id, ret,
args);
else
long id;
id = syscall_get_nr(current, regs);
- if (unlikely(is_compat_task())) {
+ if (unlikely(in_compat_syscall())) {
struct lttng_syscall_filter *filter;
filter = lttng_rcu_dereference(chan->sc_filter);
syscall_exit_unknown(unknown_event, regs, id, ret);
return;
}
- if (unlikely(is_compat_task()))
+ if (unlikely(in_compat_syscall()))
event = chan->compat_sc_exit_table[id];
else
event = chan->sc_exit_table[id];
void (*fptr)(void *__data,
long ret,
unsigned long arg0) = entry->func;
- unsigned long args[1];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, entry->nrargs, args);
+ lttng_syscall_get_arguments(current, regs, args);
fptr(event, ret, args[0]);
break;
}
long ret,
unsigned long arg0,
unsigned long arg1) = entry->func;
- unsigned long args[2];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, entry->nrargs, args);
+ lttng_syscall_get_arguments(current, regs, args);
fptr(event, ret, args[0], args[1]);
break;
}
unsigned long arg0,
unsigned long arg1,
unsigned long arg2) = entry->func;
- unsigned long args[3];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, entry->nrargs, args);
+ lttng_syscall_get_arguments(current, regs, args);
fptr(event, ret, args[0], args[1], args[2]);
break;
}
unsigned long arg1,
unsigned long arg2,
unsigned long arg3) = entry->func;
- unsigned long args[4];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, entry->nrargs, args);
+ lttng_syscall_get_arguments(current, regs, args);
fptr(event, ret, args[0], args[1], args[2], args[3]);
break;
}
unsigned long arg2,
unsigned long arg3,
unsigned long arg4) = entry->func;
- unsigned long args[5];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, entry->nrargs, args);
+ lttng_syscall_get_arguments(current, regs, args);
fptr(event, ret, args[0], args[1], args[2], args[3], args[4]);
break;
}
unsigned long arg3,
unsigned long arg4,
unsigned long arg5) = entry->func;
- unsigned long args[6];
+ unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- syscall_get_arguments(current, regs, 0, entry->nrargs, args);
+ lttng_syscall_get_arguments(current, regs, args);
fptr(event, ret, args[0], args[1], args[2],
args[3], args[4], args[5]);
break;
filter = channel->sc_filter;
for (bit = 0; bit < ARRAY_SIZE(sc_table); bit++) {
- bool state;
+ char state;
if (channel->sc_table) {
if (filter)
bt_bitfield_write_be(tmp_mask, char, bit, 1, state);
}
for (; bit < sc_tables_len; bit++) {
- bool state;
+ char state;
if (channel->compat_sc_table) {
if (filter)