+ COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
+
+ lttng_ctl_copy_string(lsm.session.name, handle->session_name,
+ sizeof(lsm.session.name));
+
+ ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(
+ &lsm, (char *) var_data, var_data_len, NULL);
+ return ret;
+error:
+ return -LTTNG_ERR_INVALID;
+}
+
+/*
+ * Add ID to session tracker.
+ * Return 0 on success else a negative LTTng error code.
+ */
+int lttng_track_id(struct lttng_handle *handle,
+ enum lttng_tracker_type tracker_type,
+ const struct lttng_tracker_id *id)
+{
+ return lttng_track_untrack_id(handle, tracker_type, id, LTTNG_TRACK_ID);
+}
+
+/*
+ * Remove ID from session tracker.
+ * Return 0 on success else a negative LTTng error code.
+ */
+int lttng_untrack_id(struct lttng_handle *handle,
+ enum lttng_tracker_type tracker_type,
+ const struct lttng_tracker_id *id)
+{
+ return lttng_track_untrack_id(
+ handle, tracker_type, id, LTTNG_UNTRACK_ID);
+}
+
+/*
+ * Add PID to session tracker.
+ * Return 0 on success else a negative LTTng error code.
+ */
+int lttng_track_pid(struct lttng_handle *handle, int pid)
+{
+ int ret;
+ struct lttng_tracker_id *id = NULL;
+ enum lttng_tracker_id_status status;
+
+ id = lttng_tracker_id_create();
+ status = lttng_tracker_id_set_value(id, pid);
+ if (status == LTTNG_TRACKER_ID_STATUS_INVALID) {
+ ret = -LTTNG_ERR_INVALID;
+ goto error;
+ }
+
+ ret = lttng_track_id(handle, LTTNG_TRACKER_PID, id);
+error:
+ lttng_tracker_id_destroy(id);
+ return ret;
+}
+
+/*
+ * Remove PID from session tracker.
+ * Return 0 on success else a negative LTTng error code.
+ */
+int lttng_untrack_pid(struct lttng_handle *handle, int pid)
+{
+ int ret;
+ struct lttng_tracker_id *id = NULL;
+ enum lttng_tracker_id_status status;
+
+ id = lttng_tracker_id_create();
+ status = lttng_tracker_id_set_value(id, pid);
+ if (status == LTTNG_TRACKER_ID_STATUS_INVALID) {
+ ret = -LTTNG_ERR_INVALID;
+ goto error;
+ }
+
+ ret = lttng_untrack_id(handle, LTTNG_TRACKER_PID, id);
+error:
+ lttng_tracker_id_destroy(id);