LTTNG_ERR_EXCLUSION_NOMEM = 111, /* Lack of memory while processing event exclusions */
LTTNG_ERR_INVALID_EVENT_NAME = 112, /* Invalid event name */
LTTNG_ERR_INVALID_CHANNEL_NAME = 113, /* Invalid channel name */
+ LTTNG_ERR_PID_TRACKED = 114, /* PID already tracked */
+ LTTNG_ERR_PID_NOT_TRACKED = 115, /* PID not tracked */
/* MUST be last element */
LTTNG_ERR_NR, /* Last element */
tracker_node = pid_tracker_lookup(pid_tracker, pid, &iter);
if (tracker_node) {
/* Already exists. */
- retval = LTTNG_ERR_INVALID;
+ retval = LTTNG_ERR_PID_TRACKED;
goto end;
}
tracker_node = zmalloc(sizeof(*tracker_node));
tracker_node = pid_tracker_lookup(pid_tracker, pid, &iter);
if (!tracker_node) {
/* Not found */
- retval = LTTNG_ERR_INVALID;
+ retval = LTTNG_ERR_PID_NOT_TRACKED;
goto end;
}
ret = lttng_ht_del(pid_tracker->ht, &iter);
DBG("%s PID %d", cmd_str, pid_list[i]);
ret = lib_func(handle, pid_list[i]);
if (ret) {
- success = 0;
- retval = CMD_ERROR;
+ switch (-ret) {
+ case LTTNG_ERR_PID_TRACKED:
+ WARN("PID %i already tracked in session %s",
+ pid_list[i], session_name);
+ success = 1;
+ retval = CMD_SUCCESS;
+ break;
+ case LTTNG_ERR_PID_NOT_TRACKED:
+ WARN("PID %i not tracked in session %s",
+ pid_list[i], session_name);
+ success = 1;
+ retval = CMD_SUCCESS;
+ break;
+ default:
+ ERR("%s", lttng_strerror(ret));
+ success = 0;
+ retval = CMD_ERROR;
+ break;
+ }
} else {
+ MSG("PID %i %sed in session %s",
+ pid_list[i], cmd_str, session_name);
success = 1;
}
[ ERROR_INDEX(LTTNG_ERR_MI_NOT_IMPLEMENTED) ] = "Mi feature not implemented",
[ ERROR_INDEX(LTTNG_ERR_INVALID_EVENT_NAME) ] = "Invalid event name",
[ ERROR_INDEX(LTTNG_ERR_INVALID_CHANNEL_NAME) ] = "Invalid channel name",
+ [ ERROR_INDEX(LTTNG_ERR_PID_TRACKED) ] = "PID already tracked",
+ [ ERROR_INDEX(LTTNG_ERR_PID_NOT_TRACKED) ] = "PID not tracked",
/* Last element */
[ ERROR_INDEX(LTTNG_ERR_NR) ] = "Unknown error code"