From 7c92789f2e3f8b1d17e92ec9ade72fdab159c0f2 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 12 Nov 2014 14:29:47 -0500 Subject: [PATCH] Fix: build for architectures without HAVE_SYSCALL_TRACEPOINTS Signed-off-by: Mathieu Desnoyers --- lttng-abi.c | 37 ------------------------------------- lttng-events.h | 13 ++++++++++--- lttng-syscalls.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 40 deletions(-) diff --git a/lttng-abi.c b/lttng-abi.c index b83ed3d2..381a7390 100644 --- a/lttng-abi.c +++ b/lttng-abi.c @@ -143,43 +143,6 @@ fd_error: return ret; } -static -int lttng_abi_syscall_list(void) -{ - struct file *syscall_list_file; - int file_fd, ret; - - file_fd = get_unused_fd(); - if (file_fd < 0) { - ret = file_fd; - goto fd_error; - } - - syscall_list_file = anon_inode_getfile("[lttng_syscall_list]", - <tng_syscall_list_fops, - NULL, O_RDWR); - if (IS_ERR(syscall_list_file)) { - ret = PTR_ERR(syscall_list_file); - goto file_error; - } - ret = lttng_syscall_list_fops.open(NULL, syscall_list_file); - 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: - fput(syscall_list_file); -file_error: - put_unused_fd(file_fd); -fd_error: - return ret; -} - static void lttng_abi_tracer_version(struct lttng_kernel_tracer_version *v) { diff --git a/lttng-events.h b/lttng-events.h index a537673a..e5cd0eea 100644 --- a/lttng-events.h +++ b/lttng-events.h @@ -407,6 +407,7 @@ int lttng_syscall_filter_disable(struct lttng_channel *chan, const char *name); long lttng_channel_syscall_mask(struct lttng_channel *channel, struct lttng_kernel_syscall_mask __user *usyscall_mask); +int lttng_abi_syscall_list(void); #else static inline int lttng_syscalls_register(struct lttng_channel *chan, void *filter) { @@ -418,26 +419,32 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan) return 0; } -static +static inline int lttng_syscall_filter_enable(struct lttng_channel *chan, const char *name) { return -ENOSYS; } -static +static inline int lttng_syscall_filter_disable(struct lttng_channel *chan, const char *name) { return -ENOSYS; } -static +static inline long lttng_channel_syscall_mask(struct lttng_channel *channel, struct lttng_kernel_syscall_mask __user *usyscall_mask) { return -ENOSYS; } + +static inline +int lttng_abi_syscall_list(void) +{ + return -ENOSYS; +} #endif struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx); diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 622da6e2..1fc86c8e 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include @@ -1261,3 +1263,39 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel, kfree(tmp_mask); return ret; } + +int lttng_abi_syscall_list(void) +{ + struct file *syscall_list_file; + int file_fd, ret; + + file_fd = get_unused_fd(); + if (file_fd < 0) { + ret = file_fd; + goto fd_error; + } + + syscall_list_file = anon_inode_getfile("[lttng_syscall_list]", + <tng_syscall_list_fops, + NULL, O_RDWR); + if (IS_ERR(syscall_list_file)) { + ret = PTR_ERR(syscall_list_file); + goto file_error; + } + ret = lttng_syscall_list_fops.open(NULL, syscall_list_file); + 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: + fput(syscall_list_file); +file_error: + put_unused_fd(file_fd); +fd_error: + return ret; +} -- 2.34.1