#include <linux/uaccess.h>
#include <linux/slab.h>
#include <linux/err.h>
-#include "wrapper/vmalloc.h" /* for wrapper_vmalloc_sync_all() */
-#include "wrapper/ringbuffer/vfs.h"
-#include "wrapper/ringbuffer/backend.h"
-#include "wrapper/ringbuffer/frontend.h"
-#include "wrapper/poll.h"
-#include "wrapper/file.h"
-#include "wrapper/kref.h"
-#include "lttng-abi.h"
-#include "lttng-abi-old.h"
-#include "lttng-events.h"
-#include "lttng-tracer.h"
-#include "lib/ringbuffer/frontend_types.h"
+#include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_all() */
+#include <wrapper/ringbuffer/vfs.h>
+#include <wrapper/ringbuffer/backend.h>
+#include <wrapper/ringbuffer/frontend.h>
+#include <wrapper/poll.h>
+#include <wrapper/file.h>
+#include <wrapper/kref.h>
+#include <lttng-abi.h>
+#include <lttng-abi-old.h>
+#include <lttng-events.h>
+#include <lttng-tracer.h>
+#include <lib/ringbuffer/frontend_types.h>
/*
* This is LTTng's own personal way to create a system call as an external
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