+void syscall_exit_event_probe(void *__data, struct pt_regs *regs, long ret)
+{
+ struct lttng_channel *chan = __data;
+ struct hlist_head *action_list, *unknown_action_list;
+ const struct trace_syscall_entry *table, *entry;
+ size_t table_len;
+ long id;
+
+ id = syscall_get_nr(current, regs);
+
+ 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_exit) && !test_bit(id, filter->sc_compat_exit))) {
+ /* System call filtered out. */
+ return;
+ }
+ table = compat_sc_exit_table;
+ table_len = ARRAY_SIZE(compat_sc_exit_table);
+ unknown_action_list = &chan->compat_sc_exit_unknown;
+ } else {
+ struct lttng_syscall_filter *filter = chan->sc_filter;
+
+ if (id < 0 || id >= NR_syscalls
+ || (!READ_ONCE(chan->syscall_all_exit) && !test_bit(id, filter->sc_exit))) {
+ /* System call filtered out. */
+ return;
+ }
+ table = sc_exit_table;
+ table_len = ARRAY_SIZE(sc_exit_table);
+ unknown_action_list = &chan->sc_exit_unknown;
+ }
+ if (unlikely(id < 0 || id >= table_len)) {
+ syscall_exit_event_unknown(unknown_action_list, regs, id, ret);
+ return;
+ }
+
+ entry = &table[id];
+ if (!entry->event_func) {
+ syscall_exit_event_unknown(unknown_action_list, regs, id, ret);
+ return;
+ }
+
+ if (unlikely(in_compat_syscall())) {
+ action_list = &chan->compat_sc_exit_table[id];
+ } else {
+ action_list = &chan->sc_exit_table[id];
+ }
+ if (unlikely(hlist_empty(action_list)))
+ return;
+
+ syscall_exit_event_call_func(action_list, entry->event_func, entry->nrargs,
+ regs, ret);
+}
+
+static
+void syscall_exit_event_notifier_probe(void *__data, struct pt_regs *regs,
+ long ret)
+{
+ struct lttng_event_notifier_group *group = __data;
+ const struct trace_syscall_entry *table, *entry;
+ struct hlist_head *dispatch_list, *unknown_dispatch_list;
+ size_t table_len;
+ long id;
+
+ id = syscall_get_nr(current, regs);
+
+ if (unlikely(in_compat_syscall())) {
+ struct lttng_syscall_filter *filter = group->sc_filter;
+
+ if (id < 0 || id >= NR_compat_syscalls
+ || (!READ_ONCE(group->syscall_all_exit) &&
+ !test_bit(id, filter->sc_compat_exit))) {
+ /* System call filtered out. */
+ return;
+ }
+ table = compat_sc_exit_table;
+ table_len = ARRAY_SIZE(compat_sc_exit_table);
+ unknown_dispatch_list = &group->event_notifier_exit_compat_unknown_syscall_dispatch;
+ } else {
+ struct lttng_syscall_filter *filter = group->sc_filter;
+
+ if (id < 0 || id >= NR_syscalls
+ || (!READ_ONCE(group->syscall_all_exit) &&
+ !test_bit(id, filter->sc_exit))) {
+ /* System call filtered out. */
+ return;
+ }
+ table = sc_exit_table;
+ table_len = ARRAY_SIZE(sc_exit_table);
+ unknown_dispatch_list = &group->event_notifier_exit_unknown_syscall_dispatch;
+ }
+ /* Check if the syscall id is out of bound. */
+ if (unlikely(id < 0 || id >= table_len)) {
+ syscall_exit_event_unknown(unknown_dispatch_list,
+ regs, id, ret);
+ return;
+ }
+
+ entry = &table[id];
+ if (!entry->event_func) {
+ syscall_entry_event_unknown(unknown_dispatch_list,
+ regs, id);
+ return;
+ }
+
+ if (unlikely(in_compat_syscall())) {
+ dispatch_list = &group->event_notifier_exit_compat_syscall_dispatch[id];
+ } else {
+ dispatch_list = &group->event_notifier_exit_syscall_dispatch[id];
+ }
+ if (unlikely(hlist_empty(dispatch_list)))
+ return;
+
+ syscall_exit_event_call_func(dispatch_list,
+ entry->event_func, entry->nrargs, regs, ret);
+}