#include <lttng-abi-old.h>
#include <lttng-events.h>
#include <lttng-tracer.h>
+#include <lttng-tp-mempool.h>
#include <lib/ringbuffer/frontend_types.h>
/*
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;
}
*/
return -ENOSYS;
}
+ case RING_BUFFER_FLUSH_EMPTY: /* Fall-through. */
case RING_BUFFER_FLUSH:
{
struct lttng_metadata_stream *stream = filp->private_data;
*/
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;
}
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;
}
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)
/* 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
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);
return 0;
error:
+ lttng_tp_mempool_destroy();
lttng_clock_unref();
return ret;
}
/* 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);