Version 2.7.7
[lttng-modules.git] / lttng-syscalls.c
index f46fd91ae265e882a8a1c2b6d10558e02d5e0db7..70d2c323ce9207b191313488a87d80b464075b7b 100644 (file)
@@ -37,6 +37,7 @@
 #include "lib/bitfield.h"
 #include "wrapper/tracepoint.h"
 #include "wrapper/file.h"
+#include "wrapper/rcu.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,
@@ -76,6 +82,7 @@ struct oldold_utsname;
 struct old_utsname;
 struct sel_arg_struct;
 struct mmap_arg_struct;
+struct file_handle;
 
 #ifdef IA32_NR_syscalls
 #define NR_compat_syscalls IA32_NR_syscalls
@@ -352,7 +359,7 @@ static void syscall_entry_unknown(struct lttng_event *event,
        unsigned long args[UNKNOWN_SYSCALL_NRARGS];
 
        syscall_get_arguments(current, regs, 0, UNKNOWN_SYSCALL_NRARGS, args);
-       if (unlikely(is_compat_task()))
+       if (unlikely(in_compat_syscall()))
                __event_probe__compat_syscall_entry_unknown(event, id, args);
        else
                __event_probe__syscall_entry_unknown(event, id, args);
@@ -365,10 +372,10 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
        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 = rcu_dereference(chan->sc_filter);
+               filter = lttng_rcu_dereference(chan->sc_filter);
                if (filter) {
                        if (id < 0 || id >= NR_compat_syscalls
                                || !test_bit(id, filter->sc_compat)) {
@@ -382,7 +389,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
        } else {
                struct lttng_syscall_filter *filter;
 
-               filter = rcu_dereference(chan->sc_filter);
+               filter = lttng_rcu_dereference(chan->sc_filter);
                if (filter) {
                        if (id < 0 || id >= NR_syscalls
                                || !test_bit(id, filter->sc)) {
@@ -398,7 +405,7 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
                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];
@@ -503,7 +510,7 @@ static void syscall_exit_unknown(struct lttng_event *event,
        unsigned long args[UNKNOWN_SYSCALL_NRARGS];
 
        syscall_get_arguments(current, regs, 0, UNKNOWN_SYSCALL_NRARGS, args);
-       if (unlikely(is_compat_task()))
+       if (unlikely(in_compat_syscall()))
                __event_probe__compat_syscall_exit_unknown(event, id, ret,
                        args);
        else
@@ -519,10 +526,10 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
        long id;
 
        id = syscall_get_nr(current, regs);
-       if (unlikely(is_compat_task())) {
+       if (unlikely(in_compat_syscall())) {
                struct lttng_syscall_filter *filter;
 
-               filter = rcu_dereference(chan->sc_filter);
+               filter = lttng_rcu_dereference(chan->sc_filter);
                if (filter) {
                        if (id < 0 || id >= NR_compat_syscalls
                                || !test_bit(id, filter->sc_compat)) {
@@ -536,7 +543,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
        } else {
                struct lttng_syscall_filter *filter;
 
-               filter = rcu_dereference(chan->sc_filter);
+               filter = lttng_rcu_dereference(chan->sc_filter);
                if (filter) {
                        if (id < 0 || id >= NR_syscalls
                                || !test_bit(id, filter->sc)) {
@@ -552,7 +559,7 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
                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];
@@ -1288,10 +1295,6 @@ int lttng_abi_syscall_list(void)
        if (ret < 0)
                goto open_error;
        fd_install(file_fd, syscall_list_file);
-       if (file_fd < 0) {
-               ret = file_fd;
-               goto fd_error;
-       }
        return file_fd;
 
 open_error:
This page took 0.024875 seconds and 4 git commands to generate.