X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=lttng-abi.c;h=3572e58ef8f64e948680c63d05cf1c23280d2821;hb=f4b27072a77b43af2fea72d6700bd64eb59a39f1;hp=ede2ae79bd7b15c45ec4ef3864a048cc85f2e006;hpb=33a39a3cd074931ab3a2eaff6eb8807091cf8172;p=lttng-modules.git diff --git a/lttng-abi.c b/lttng-abi.c index ede2ae79..3572e58e 100644 --- a/lttng-abi.c +++ b/lttng-abi.c @@ -130,19 +130,56 @@ int lttng_abi_tracepoint_list(void) if (ret < 0) goto open_error; fd_install(file_fd, tracepoint_list_file); + return file_fd; + +open_error: + fput(tracepoint_list_file); +file_error: + put_unused_fd(file_fd); +fd_error: + return ret; +} + +#ifndef CONFIG_HAVE_SYSCALL_TRACEPOINTS +static inline +int lttng_abi_syscall_list(void) +{ + return -ENOSYS; +} +#else +static +int lttng_abi_syscall_list(void) +{ + struct file *syscall_list_file; + int file_fd, ret; + + file_fd = lttng_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); return file_fd; open_error: - fput(tracepoint_list_file); + fput(syscall_list_file); file_error: put_unused_fd(file_fd); fd_error: return ret; } +#endif static void lttng_abi_tracer_version(struct lttng_kernel_tracer_version *v) @@ -195,6 +232,8 @@ long lttng_abi_add_context(struct file *file, return lttng_add_procname_to_ctx(ctx); case LTTNG_KERNEL_CONTEXT_HOSTNAME: return lttng_add_hostname_to_ctx(ctx); + case LTTNG_KERNEL_CONTEXT_CPU_ID: + return lttng_add_cpu_id_to_ctx(ctx); default: return -EINVAL; } @@ -575,9 +614,11 @@ unsigned int lttng_metadata_ring_buffer_poll(struct file *filp, if (finalized) mask |= POLLHUP; + mutex_lock(&stream->metadata_cache->lock); if (stream->metadata_cache->metadata_written > stream->metadata_out) mask |= POLLIN; + mutex_unlock(&stream->metadata_cache->lock); } return mask; @@ -875,7 +916,6 @@ int lttng_abi_open_metadata_stream(struct file *channel_file) metadata_stream->priv = buf; stream_priv = metadata_stream; metadata_stream->transport = channel->transport; - mutex_init(&metadata_stream->lock); /* * Since life-time of metadata cache differs from that of @@ -1238,8 +1278,8 @@ int lttng_metadata_channel_release(struct inode *inode, struct file *file) struct lttng_channel *channel = file->private_data; if (channel) { - lttng_metadata_channel_destroy(channel); fput(channel->session->file); + lttng_metadata_channel_destroy(channel); } return 0; @@ -1323,6 +1363,18 @@ long lttng_event_ioctl(struct file *file, unsigned int cmd, unsigned long arg) WARN_ON_ONCE(1); return -ENOSYS; } + case LTTNG_KERNEL_FILTER: + switch (*evtype) { + case LTTNG_TYPE_EVENT: + return -EINVAL; + case LTTNG_TYPE_ENABLER: + { + enabler = file->private_data; + return lttng_enabler_attach_bytecode(enabler, + (struct lttng_kernel_filter_bytecode __user *) arg); + } + + } default: return -ENOIOCTLCMD; }