X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=lttng-syscalls.c;h=1fc86c8eed5a84502d05b0efd893b052975d06ca;hb=7c92789f2e3f8b1d17e92ec9ade72fdab159c0f2;hp=5501997c48fdd73f730fc59e9ac7ecd84dc6fe50;hpb=74f7b56a78514d321aaf8b3fffae174999070f71;p=lttng-modules.git diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 5501997c..1fc86c8e 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include @@ -1230,16 +1232,70 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel, filter = channel->sc_filter; for (bit = 0; bit < ARRAY_SIZE(sc_table); bit++) { - bt_bitfield_write_be(tmp_mask, char, bit, 1, - filter ? test_bit(bit, filter->sc) : 1); + bool state; + + if (channel->sc_table) { + if (filter) + state = test_bit(bit, filter->sc); + else + state = 1; + } else { + state = 0; + } + bt_bitfield_write_be(tmp_mask, char, bit, 1, state); } for (; bit < sc_tables_len; bit++) { - bt_bitfield_write_be(tmp_mask, char, bit, 1, - filter ? test_bit(bit - ARRAY_SIZE(sc_table), - filter->sc_compat) : 1); + bool state; + + if (channel->compat_sc_table) { + if (filter) + state = test_bit(bit - ARRAY_SIZE(sc_table), + filter->sc_compat); + else + state = 1; + } else { + state = 0; + } + bt_bitfield_write_be(tmp_mask, char, bit, 1, state); } if (copy_to_user(usyscall_mask->mask, tmp_mask, bitmask_len)) ret = -EFAULT; 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; +}