- * lttng_rb_cmd - lttng ring buffer control through object descriptors
- *
- * @objd: the object descriptor
- * @cmd: the command
- * @arg: command arg
- * @uargs: UST arguments (internal)
- *
- * This object descriptor implements lttng commands:
- * (None for now. Access is done directly though shm.)
- */
-static
-long lttng_rb_cmd(int objd, unsigned int cmd, unsigned long arg,
- union ust_args *uargs)
-{
- switch (cmd) {
- default:
- return -EINVAL;
- }
-}
-
-static
-int lttng_rb_release(int objd)
-{
- struct stream_priv_data *priv = objd_private(objd);
- struct lttng_ust_lib_ring_buffer *buf;
- struct ltt_channel *channel;
-
- if (priv) {
- buf = priv->buf;
- channel = priv->ltt_chan;
- free(priv);
- /*
- * If we are at ABI exit, we don't want to close the
- * buffer opened for read: it is being shared between
- * the parent and child (right after fork), and we don't
- * want the child to close it for the parent. For a real
- * exit, we don't care about marking it as closed, as
- * the consumer daemon (if there is one) will do fine
- * even if we don't mark it as "closed" for reading on
- * our side.
- * We only mark it as closed if it is being explicitely
- * released by the session daemon with an explicit
- * release command.
- */
- if (!lttng_ust_abi_close_in_progress)
- channel->ops->buffer_read_close(buf, channel->handle);
-
- return lttng_ust_objd_unref(channel->objd);
- }
- return 0;
-}
-
-static const struct lttng_ust_objd_ops lib_ring_buffer_objd_ops = {
- .release = lttng_rb_release,
- .cmd = lttng_rb_cmd,
-};
-
-/**
- * lttng_event_cmd - lttng control through object descriptors
- *
- * @objd: the object descriptor
- * @cmd: the command
- * @arg: command arg
- * @uargs: UST arguments (internal)
- *
- * This object descriptor implements lttng commands:
- * LTTNG_UST_CONTEXT
- * Prepend a context field to each record of this event
- * LTTNG_UST_ENABLE
- * Enable recording for this event (weak enable)
- * LTTNG_UST_DISABLE
- * Disable recording for this event (strong disable)
- */
-static
-long lttng_event_cmd(int objd, unsigned int cmd, unsigned long arg,
- union ust_args *uargs)
-{
- struct ltt_event *event = objd_private(objd);
-
- switch (cmd) {
- case LTTNG_UST_CONTEXT:
- return lttng_abi_add_context(objd,
- (struct lttng_ust_context *) arg,
- &event->ctx, event->chan->session);
- case LTTNG_UST_ENABLE:
- return ltt_event_enable(event);
- case LTTNG_UST_DISABLE:
- return ltt_event_disable(event);
- default:
- return -EINVAL;
- }
-}
-
-static
-int lttng_event_release(int objd)
-{
- struct ltt_event *event = objd_private(objd);
-
- if (event)
- return lttng_ust_objd_unref(event->chan->objd);
- return 0;
-}
-
-/* TODO: filter control ioctl */
-static const struct lttng_ust_objd_ops lttng_event_ops = {
- .release = lttng_event_release,
- .cmd = lttng_event_cmd,
-};
-
-/**
- * lttng_wildcard_cmd - lttng control through object descriptors