}
/*
- * Command LTTNG_TRACK_PID processed by the client thread.
+ * Command LTTNG_TRACK_ID processed by the client thread.
*
* Called with session lock held.
*/
-int cmd_track_pid(struct ltt_session *session, enum lttng_domain_type domain,
- int pid)
+int cmd_track_id(struct ltt_session *session,
+ enum lttng_tracker_type tracker_type,
+ enum lttng_domain_type domain,
+ const struct lttng_tracker_id *id)
{
int ret;
ksess = session->kernel_session;
- ret = kernel_track_pid(ksess, pid);
+ ret = kernel_track_id(tracker_type, ksess, id);
if (ret != LTTNG_OK) {
goto error;
}
usess = session->ust_session;
- ret = trace_ust_track_pid(usess, pid);
+ ret = trace_ust_track_id(tracker_type, usess, id);
if (ret != LTTNG_OK) {
goto error;
}
}
/*
- * Command LTTNG_UNTRACK_PID processed by the client thread.
+ * Command LTTNG_UNTRACK_ID processed by the client thread.
*
* Called with session lock held.
*/
-int cmd_untrack_pid(struct ltt_session *session, enum lttng_domain_type domain,
- int pid)
+int cmd_untrack_id(struct ltt_session *session,
+ enum lttng_tracker_type tracker_type,
+ enum lttng_domain_type domain,
+ const struct lttng_tracker_id *id)
{
int ret;
ksess = session->kernel_session;
- ret = kernel_untrack_pid(ksess, pid);
+ ret = kernel_untrack_id(tracker_type, ksess, id);
if (ret != LTTNG_OK) {
goto error;
}
usess = session->ust_session;
- ret = trace_ust_untrack_pid(usess, pid);
+ ret = trace_ust_untrack_id(tracker_type, usess, id);
if (ret != LTTNG_OK) {
goto error;
}
}
/*
- * Command LTTNG_LIST_TRACKER_PIDS processed by the client thread.
+ * Command LTTNG_LIST_TRACKER_IDS processed by the client thread.
*
* Called with session lock held.
*/
-ssize_t cmd_list_tracker_pids(struct ltt_session *session,
- enum lttng_domain_type domain, int32_t **pids)
+int cmd_list_tracker_ids(enum lttng_tracker_type tracker_type,
+ struct ltt_session *session,
+ enum lttng_domain_type domain,
+ struct lttng_tracker_ids **ids)
{
- int ret;
- ssize_t nr_pids = 0;
+ int ret = LTTNG_OK;
switch (domain) {
case LTTNG_DOMAIN_KERNEL:
struct ltt_kernel_session *ksess;
ksess = session->kernel_session;
- nr_pids = kernel_list_tracker_pids(ksess, pids);
- if (nr_pids < 0) {
- ret = LTTNG_ERR_KERN_LIST_FAIL;
+ ret = kernel_list_tracker_ids(tracker_type, ksess, ids);
+ if (ret != LTTNG_OK) {
+ ret = -LTTNG_ERR_KERN_LIST_FAIL;
goto error;
}
break;
struct ltt_ust_session *usess;
usess = session->ust_session;
- nr_pids = trace_ust_list_tracker_pids(usess, pids);
- if (nr_pids < 0) {
- ret = LTTNG_ERR_UST_LIST_FAIL;
+ ret = trace_ust_list_tracker_ids(tracker_type, usess, ids);
+ if (ret != LTTNG_OK) {
+ ret = -LTTNG_ERR_UST_LIST_FAIL;
goto error;
}
break;
case LTTNG_DOMAIN_JUL:
case LTTNG_DOMAIN_PYTHON:
default:
- ret = LTTNG_ERR_UND;
+ ret = -LTTNG_ERR_UND;
goto error;
}
- return nr_pids;
-
error:
/* Return negative value to differentiate return code */
- return -ret;
+ return ret;
}
/*
/* Is the session already started? */
if (session->active) {
ret = LTTNG_ERR_TRACE_ALREADY_STARTED;
- goto error;
+ /* Perform nothing */
+ goto end;
}
if (session->rotation_state == LTTNG_ROTATION_STATE_ONGOING &&
session->cleared_after_last_stop =
session_cleared_after_last_stop;
}
+end:
return ret;
}
}
}
- if (session_close_trace_chunk(session, session->current_trace_chunk,
+ if (session_set_trace_chunk(session, NULL, &snapshot_trace_chunk)) {
+ ERR("Failed to release the current trace chunk of session \"%s\"",
+ session->name);
+ ret_code = LTTNG_ERR_UNK;
+ }
+
+ if (session_close_trace_chunk(session, snapshot_trace_chunk,
LTTNG_TRACE_CHUNK_COMMAND_TYPE_NO_OPERATION, NULL)) {
/*
* Don't goto end; make sure the chunk is closed for the session
session->name);
ret_code = LTTNG_ERR_CLOSE_TRACE_CHUNK_FAIL_CONSUMER;
}
- if (session_set_trace_chunk(session, NULL, NULL)) {
- ERR("Failed to release the current trace chunk of session \"%s\"",
- session->name);
- ret_code = LTTNG_ERR_UNK;
- }
error:
if (original_ust_consumer_output) {
session->ust_session->consumer = original_ust_consumer_output;