-static
-long lttng_metadata_cmd(int objd, unsigned int cmd, unsigned long arg,
- union ust_args *uargs, void *owner)
-{
- struct lttng_channel *channel = objd_private(objd);
- struct lttng_session *session = channel->session;
-
- switch (cmd) {
- case LTTNG_UST_STREAM:
- {
- struct lttng_ust_stream *stream;
- int ret;
-
- stream = (struct lttng_ust_stream *) arg;
- /* stream used as output */
- ret = lttng_abi_map_stream(objd, stream, uargs, owner);
- if (ret == 0) {
- session->metadata = channel;
- lttng_metadata_create_events(objd);
- }
- return ret;
- }
- case LTTNG_UST_FLUSH_BUFFER:
- {
- if (!session->metadata) {
- return -ENOENT;
- }
- return channel->ops->flush_buffer(channel->chan, channel->handle);
- }
- default:
- return -EINVAL;
- }
-}
-