+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_call_func(action_list, entry->event_func, entry->nrargs,
+ regs, ret);
+}
+