+static
+int lttng_abi_tracepoint_list(void)
+{
+ struct file *tracepoint_list_file;
+ int file_fd, ret;
+
+ file_fd = get_unused_fd();
+ if (file_fd < 0) {
+ ret = file_fd;
+ goto fd_error;
+ }
+
+ tracepoint_list_file = anon_inode_getfile("[lttng_session]",
+ <tng_tracepoint_list_fops,
+ NULL, O_RDWR);
+ if (IS_ERR(tracepoint_list_file)) {
+ ret = PTR_ERR(tracepoint_list_file);
+ goto file_error;
+ }
+ ret = lttng_tracepoint_list_fops.open(NULL, tracepoint_list_file);
+ if (ret < 0)
+ goto open_error;
+ fd_install(file_fd, tracepoint_list_file);
+ if (file_fd < 0) {
+ ret = file_fd;
+ goto fd_error;
+ }
+ return file_fd;
+
+open_error:
+ fput(tracepoint_list_file);
+file_error:
+ put_unused_fd(file_fd);
+fd_error:
+ return ret;
+}
+
+static
+long lttng_abi_tracer_version(struct file *file,
+ struct lttng_kernel_tracer_version __user *uversion_param)
+{
+ struct lttng_kernel_tracer_version v;
+
+ v.version = LTTNG_VERSION;
+ v.patchlevel = LTTNG_PATCHLEVEL;
+ v.sublevel = LTTNG_SUBLEVEL;
+
+ if (copy_to_user(uversion_param, &v, sizeof(v)))
+ return -EFAULT;
+ return 0;
+}
+
+static
+long lttng_abi_add_context(struct file *file,
+ struct lttng_kernel_context __user *ucontext_param,
+ struct lttng_ctx **ctx, struct ltt_session *session)
+{
+ struct lttng_kernel_context context_param;
+
+ if (session->been_active)
+ return -EPERM;
+
+ if (copy_from_user(&context_param, ucontext_param, sizeof(context_param)))
+ return -EFAULT;
+
+ switch (context_param.ctx) {
+ case LTTNG_KERNEL_CONTEXT_PID:
+ return lttng_add_pid_to_ctx(ctx);
+ case LTTNG_KERNEL_CONTEXT_PRIO:
+ return lttng_add_prio_to_ctx(ctx);
+ case LTTNG_KERNEL_CONTEXT_NICE:
+ return lttng_add_nice_to_ctx(ctx);
+ case LTTNG_KERNEL_CONTEXT_PERF_COUNTER:
+ return -ENOSYS;
+ case LTTNG_KERNEL_CONTEXT_COMM:
+ return lttng_add_comm_to_ctx(ctx);
+ default:
+ return -EINVAL;
+ }
+}
+