+static
+long lttng_tracepoint_list_cmd(int objd, unsigned int cmd, unsigned long arg,
+ union ust_args *uargs, void *owner)
+{
+ struct lttng_ust_tracepoint_list *list = objd_private(objd);
+ struct lttng_ust_tracepoint_iter *tp =
+ (struct lttng_ust_tracepoint_iter *) arg;
+ struct lttng_ust_tracepoint_iter *iter;
+
+ switch (cmd) {
+ case LTTNG_UST_TRACEPOINT_LIST_GET:
+ {
+ iter = lttng_ust_tracepoint_list_get_iter_next(list);
+ if (!iter)
+ return -LTTNG_UST_ERR_NOENT;
+ memcpy(tp, iter, sizeof(*tp));
+ return 0;
+ }
+ default:
+ return -EINVAL;
+ }
+}
+
+static
+int lttng_abi_tracepoint_list(void *owner)
+{
+ int list_objd, ret;
+ struct lttng_ust_tracepoint_list *list;
+
+ list_objd = objd_alloc(NULL, <tng_tracepoint_list_ops, owner, "tp_list");
+ if (list_objd < 0) {
+ ret = list_objd;
+ goto objd_error;
+ }
+ list = zmalloc(sizeof(*list));
+ if (!list) {
+ ret = -ENOMEM;
+ goto alloc_error;
+ }
+ objd_set_private(list_objd, list);
+
+ /* populate list by walking on all registered probes. */
+ ret = lttng_probes_get_event_list(list);
+ if (ret) {
+ goto list_error;
+ }
+ return list_objd;
+
+list_error:
+ free(list);
+alloc_error:
+ {
+ int err;
+
+ err = lttng_ust_objd_unref(list_objd, 1);
+ assert(!err);
+ }
+objd_error:
+ return ret;
+}
+
+static
+int lttng_release_tracepoint_list(int objd)
+{
+ struct lttng_ust_tracepoint_list *list = objd_private(objd);
+
+ if (list) {
+ lttng_probes_prune_event_list(list);
+ free(list);
+ return 0;
+ } else {
+ return -EINVAL;
+ }
+}
+
+static const struct lttng_ust_objd_ops lttng_tracepoint_list_ops = {
+ .release = lttng_release_tracepoint_list,
+ .cmd = lttng_tracepoint_list_cmd,