__event_probe__syscall_entry_unknown(event, id, args);
}
-void syscall_entry_event_probe(void *__data, struct pt_regs *regs, long id)
+static __always_inline
+void syscall_entry_call_func(void *func, unsigned int nrargs, void *data,
+ struct pt_regs *regs)
{
- struct lttng_channel *chan = __data;
- struct lttng_event *event, *unknown_event;
- const struct trace_syscall_entry *table, *entry;
- size_t table_len;
-
- if (unlikely(in_compat_syscall())) {
- struct lttng_syscall_filter *filter = chan->sc_filter;
-
- if (id < 0 || id >= NR_compat_syscalls
- || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
- /* System call filtered out. */
- return;
- }
- table = compat_sc_table;
- table_len = ARRAY_SIZE(compat_sc_table);
- unknown_event = chan->sc_compat_unknown;
- } else {
- struct lttng_syscall_filter *filter = chan->sc_filter;
-
- if (id < 0 || id >= NR_syscalls
- || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
- /* System call filtered out. */
- return;
- }
- table = sc_table;
- table_len = ARRAY_SIZE(sc_table);
- unknown_event = chan->sc_unknown;
- }
- if (unlikely(id < 0 || id >= table_len)) {
- syscall_entry_event_unknown(unknown_event, regs, id);
- return;
- }
- if (unlikely(in_compat_syscall()))
- event = chan->compat_sc_table[id];
- else
- event = chan->sc_table[id];
- if (unlikely(!event)) {
- syscall_entry_event_unknown(unknown_event, regs, id);
- return;
- }
- entry = &table[id];
- WARN_ON_ONCE(!entry);
-
- switch (entry->nrargs) {
+ switch (nrargs) {
case 0:
{
- void (*fptr)(void *__data) = entry->event_func;
+ void (*fptr)(void *__data) = func;
- fptr(event);
+ fptr(data);
break;
}
case 1:
{
- void (*fptr)(void *__data, unsigned long arg0) = entry->event_func;
+ void (*fptr)(void *__data, unsigned long arg0) = func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- fptr(event, args[0]);
+ fptr(data, args[0]);
break;
}
case 2:
{
void (*fptr)(void *__data,
unsigned long arg0,
- unsigned long arg1) = entry->event_func;
+ unsigned long arg1) = func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- fptr(event, args[0], args[1]);
+ fptr(data, args[0], args[1]);
break;
}
case 3:
void (*fptr)(void *__data,
unsigned long arg0,
unsigned long arg1,
- unsigned long arg2) = entry->event_func;
+ unsigned long arg2) = func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- fptr(event, args[0], args[1], args[2]);
+ fptr(data, args[0], args[1], args[2]);
break;
}
case 4:
unsigned long arg0,
unsigned long arg1,
unsigned long arg2,
- unsigned long arg3) = entry->event_func;
+ unsigned long arg3) = func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- fptr(event, args[0], args[1], args[2], args[3]);
+ fptr(data, args[0], args[1], args[2], args[3]);
break;
}
case 5:
unsigned long arg1,
unsigned long arg2,
unsigned long arg3,
- unsigned long arg4) = entry->event_func;
+ unsigned long arg4) = func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- fptr(event, args[0], args[1], args[2], args[3], args[4]);
+ fptr(data, args[0], args[1], args[2], args[3], args[4]);
break;
}
case 6:
unsigned long arg2,
unsigned long arg3,
unsigned long arg4,
- unsigned long arg5) = entry->event_func;
+ unsigned long arg5) = func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- fptr(event, args[0], args[1], args[2],
+ fptr(data, args[0], args[1], args[2],
args[3], args[4], args[5]);
break;
}
}
}
+void syscall_entry_event_probe(void *__data, struct pt_regs *regs, long id)
+{
+ struct lttng_channel *chan = __data;
+ struct lttng_event *event, *unknown_event;
+ const struct trace_syscall_entry *table, *entry;
+ size_t table_len;
+
+ if (unlikely(in_compat_syscall())) {
+ struct lttng_syscall_filter *filter = chan->sc_filter;
+
+ if (id < 0 || id >= NR_compat_syscalls
+ || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
+ /* System call filtered out. */
+ return;
+ }
+ table = compat_sc_table;
+ table_len = ARRAY_SIZE(compat_sc_table);
+ unknown_event = chan->sc_compat_unknown;
+ } else {
+ struct lttng_syscall_filter *filter = chan->sc_filter;
+
+ if (id < 0 || id >= NR_syscalls
+ || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
+ /* System call filtered out. */
+ return;
+ }
+ table = sc_table;
+ table_len = ARRAY_SIZE(sc_table);
+ unknown_event = chan->sc_unknown;
+ }
+ if (unlikely(id < 0 || id >= table_len)) {
+ syscall_entry_event_unknown(unknown_event, regs, id);
+ return;
+ }
+ if (unlikely(in_compat_syscall()))
+ event = chan->compat_sc_table[id];
+ else
+ event = chan->sc_table[id];
+ if (unlikely(!event)) {
+ syscall_entry_event_unknown(unknown_event, regs, id);
+ return;
+ }
+ entry = &table[id];
+ WARN_ON_ONCE(!entry);
+ syscall_entry_call_func(entry->event_func, entry->nrargs, event, regs);
+}
+
static void syscall_exit_event_unknown(struct lttng_event *event,
struct pt_regs *regs, int id, long ret)
{