X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttng-abi.c;h=c45c10f42c747fa4d553d08d18900b5bca1a9e08;hb=99d62d55d8d587ade853db85a8dc1a7f01b4113e;hp=e046520e5f2a34357dbbffed484afc2ca978da9d;hpb=241ae9a8fb62c3ce467d244e280062c24e73eb7a;p=lttng-modules.git diff --git a/lttng-abi.c b/lttng-abi.c index e046520e..c45c10f4 100644 --- a/lttng-abi.c +++ b/lttng-abi.c @@ -55,6 +55,7 @@ #include #include #include +#include #include /* @@ -569,6 +570,8 @@ long lttng_session_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return lttng_session_list_tracker_pids(session); case LTTNG_KERNEL_SESSION_METADATA_REGEN: return lttng_session_metadata_regenerate(session); + case LTTNG_KERNEL_SESSION_STATEDUMP: + return lttng_session_statedump(session); default: return -ENOIOCTLCMD; } @@ -681,6 +684,7 @@ long lttng_metadata_ring_buffer_ioctl(struct file *filp, */ return -ENOSYS; } + case RING_BUFFER_FLUSH_EMPTY: /* Fall-through. */ case RING_BUFFER_FLUSH: { struct lttng_metadata_stream *stream = filp->private_data; @@ -757,6 +761,28 @@ long lttng_metadata_ring_buffer_compat_ioctl(struct file *filp, */ return -ENOSYS; } + case RING_BUFFER_FLUSH_EMPTY: /* Fall-through. */ + case RING_BUFFER_FLUSH: + { + struct lttng_metadata_stream *stream = filp->private_data; + struct lib_ring_buffer *buf = stream->priv; + struct channel *chan = buf->backend.chan; + + /* + * Before doing the actual ring buffer flush, write up to one + * packet of metadata in the ring buffer. + */ + ret = lttng_metadata_output_channel(stream, chan); + if (ret < 0) + 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; } @@ -774,12 +800,6 @@ 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; } @@ -957,8 +977,11 @@ int lttng_abi_open_metadata_stream(struct file *channel_file) goto notransport; } - if (!lttng_kref_get(&session->metadata_cache->refcount)) + if (!lttng_kref_get(&session->metadata_cache->refcount)) { + ret = -EOVERFLOW; goto kref_error; + } + ret = lttng_abi_create_stream_fd(channel_file, stream_priv, <tng_metadata_ring_buffer_file_operations); if (ret < 0) @@ -1017,6 +1040,7 @@ int lttng_abi_create_event(struct file *channel_file, /* The event holds a reference on the channel */ if (atomic_long_add_unless(&channel_file->f_count, 1, INT_MAX) == INT_MAX) { + ret = -EOVERFLOW; goto refcount_error; } if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT @@ -1699,6 +1723,12 @@ int __init lttng_abi_init(void) wrapper_vmalloc_sync_all(); lttng_clock_ref(); + + ret = lttng_tp_mempool_init(); + if (ret) { + goto error; + } + lttng_proc_dentry = proc_create_data("lttng", S_IRUSR | S_IWUSR, NULL, <tng_fops, NULL); @@ -1711,6 +1741,7 @@ int __init lttng_abi_init(void) return 0; error: + lttng_tp_mempool_destroy(); lttng_clock_unref(); return ret; } @@ -1718,6 +1749,7 @@ error: /* No __exit annotation because used by init error path too. */ void lttng_abi_exit(void) { + lttng_tp_mempool_destroy(); lttng_clock_unref(); if (lttng_proc_dentry) remove_proc_entry("lttng", NULL);