X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=lttng-abi.c;h=b3de09264783cd69c7996eb53515182aa205768f;hb=fde8140de50e93c585d2b6357d066062b8d48f29;hp=586116dae39f6f5f50726191d90951d029bbea7e;hpb=5b3cf4f924befda843a7736daf84f8ecae5e86a4;p=lttng-modules.git diff --git a/lttng-abi.c b/lttng-abi.c index 586116da..b3de0926 100644 --- a/lttng-abi.c +++ b/lttng-abi.c @@ -69,6 +69,8 @@ static const struct file_operations lttng_metadata_fops; static const struct file_operations lttng_event_fops; static struct file_operations lttng_stream_ring_buffer_file_operations; +static int put_u64(uint64_t val, unsigned long arg); + /* * Teardown management: opened file descriptors keep a refcount on the module, * so it can only exit when all file descriptors are closed. @@ -130,10 +132,6 @@ int lttng_abi_tracepoint_list(void) if (ret < 0) goto open_error; fd_install(file_fd, tracepoint_list_file); - if (file_fd < 0) { - ret = file_fd; - goto fd_error; - } return file_fd; open_error: @@ -174,10 +172,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: @@ -242,6 +236,14 @@ long lttng_abi_add_context(struct file *file, return lttng_add_hostname_to_ctx(ctx); case LTTNG_KERNEL_CONTEXT_CPU_ID: return lttng_add_cpu_id_to_ctx(ctx); + case LTTNG_KERNEL_CONTEXT_INTERRUPTIBLE: + return lttng_add_interruptible_to_ctx(ctx); + case LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE: + return lttng_add_need_reschedule_to_ctx(ctx); + case LTTNG_KERNEL_CONTEXT_PREEMPTIBLE: + return lttng_add_preemptible_to_ctx(ctx); + case LTTNG_KERNEL_CONTEXT_MIGRATABLE: + return lttng_add_migratable_to_ctx(ctx); default: return -EINVAL; } @@ -559,6 +561,8 @@ long lttng_session_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return lttng_session_untrack_pid(session, (int) arg); case LTTNG_KERNEL_SESSION_LIST_TRACKER_PIDS: return lttng_session_list_tracker_pids(session); + case LTTNG_KERNEL_SESSION_METADATA_REGEN: + return lttng_session_metadata_regenerate(session); default: return -ENOIOCTLCMD; } @@ -686,6 +690,12 @@ long lttng_metadata_ring_buffer_ioctl(struct file *filp, goto err; break; } + case RING_BUFFER_GET_METADATA_VERSION: + { + struct lttng_metadata_stream *stream = filp->private_data; + + return put_u64(stream->version, arg); + } default: break; } @@ -758,6 +768,12 @@ long lttng_metadata_ring_buffer_compat_ioctl(struct file *filp, cmd, arg); break; } + case RING_BUFFER_GET_METADATA_VERSION: + { + struct lttng_metadata_stream *stream = filp->private_data; + + return put_u64(stream->version, arg); + } default: break; } @@ -1286,8 +1302,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; @@ -1517,6 +1533,15 @@ static long lttng_stream_ring_buffer_ioctl(struct file *filp, goto error; return put_u64(seq, arg); } + case LTTNG_RING_BUFFER_INSTANCE_ID: + { + uint64_t id; + + ret = ops->instance_id(config, buf, &id); + if (ret < 0) + goto error; + return put_u64(id, arg); + } default: return lib_ring_buffer_file_operations.unlocked_ioctl(filp, cmd, arg); @@ -1612,6 +1637,15 @@ static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp, goto error; return put_u64(seq, arg); } + case LTTNG_RING_BUFFER_COMPAT_INSTANCE_ID: + { + uint64_t id; + + ret = ops->instance_id(config, buf, &id); + if (ret < 0) + goto error; + return put_u64(id, arg); + } default: return lib_ring_buffer_file_operations.compat_ioctl(filp, cmd, arg); @@ -1650,6 +1684,7 @@ int __init lttng_abi_init(void) int ret = 0; wrapper_vmalloc_sync_all(); + lttng_clock_ref(); lttng_proc_dentry = proc_create_data("lttng", S_IRUSR | S_IWUSR, NULL, <tng_fops, NULL); @@ -1659,14 +1694,17 @@ int __init lttng_abi_init(void) goto error; } lttng_stream_override_ring_buffer_fops(); + return 0; error: + lttng_clock_unref(); return ret; } /* No __exit annotation because used by init error path too. */ void lttng_abi_exit(void) { + lttng_clock_unref(); if (lttng_proc_dentry) remove_proc_entry("lttng", NULL); }