+/**
+ * lttng_event_ioctl - lttng syscall through ioctl
+ *
+ * @file: the file
+ * @cmd: the command
+ * @arg: command arg
+ *
+ * This ioctl implements lttng commands:
+ * LTTNG_KERNEL_STREAM
+ * Returns an event stream file descriptor or failure.
+ * (typically, one event stream records events from one CPU)
+ * LTTNG_KERNEL_EVENT
+ * Returns an event file descriptor or failure.
+ * LTTNG_KERNEL_CONTEXT
+ * Prepend a context field to each record of this event
+ */
+static
+long lttng_event_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+ struct ltt_event *event = file->private_data;
+
+ switch (cmd) {
+ case LTTNG_KERNEL_CONTEXT:
+ return lttng_abi_add_context(file,
+ (struct lttng_kernel_context __user *) arg,
+ &event->ctx, event->chan->session);
+ default:
+ return -ENOIOCTLCMD;
+ }
+}
+