+ while ((one_value_str = strtok_r(iter, ",", &iter)) != NULL) {
+ const bool is_numerical_argument = isdigit(one_value_str[0]);
+ enum lttng_process_attr_tracker_handle_status status;
+ enum lttng_tracking_policy policy;
+ int ret;
+ char *prettified_arg;
+
+ if (!policy_set) {
+ status = lttng_process_attr_tracker_handle_get_tracking_policy(
+ tracker_handle, &policy);
+ if (status != LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK) {
+ break;
+ }
+
+ if (policy != LTTNG_TRACKING_POLICY_INCLUDE_SET) {
+ status = lttng_process_attr_tracker_handle_set_tracking_policy(
+ tracker_handle,
+ LTTNG_TRACKING_POLICY_INCLUDE_SET);
+ if (status != LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK) {
+ break;
+ }
+ }
+ policy_set = true;
+ }
+
+ if (is_numerical_argument) {
+ const unsigned long one_value_int =
+ strtoul(one_value_str, NULL, 10);
+
+ if (writer) {
+ ret = mi_lttng_integral_process_attribute_value(
+ writer, process_attr,
+ (int64_t) one_value_int, true);
+ if (ret) {
+ cmd_ret = CMD_FATAL;
+ goto end;
+ }
+ }
+
+ switch (process_attr) {
+ case LTTNG_PROCESS_ATTR_PROCESS_ID:
+ status = cmd_type == CMD_TRACK ?
+ lttng_process_attr_process_id_tracker_handle_add_pid(
+ tracker_handle,
+ (pid_t) one_value_int) :
+ lttng_process_attr_process_id_tracker_handle_remove_pid(
+ tracker_handle,
+ (pid_t) one_value_int);
+ break;
+ case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID:
+ status = cmd_type == CMD_TRACK ?
+ lttng_process_attr_virtual_process_id_tracker_handle_add_pid(
+ tracker_handle,
+ (pid_t) one_value_int) :
+ lttng_process_attr_virtual_process_id_tracker_handle_remove_pid(
+ tracker_handle,
+ (pid_t) one_value_int);
+ break;
+ case LTTNG_PROCESS_ATTR_USER_ID:
+ status = cmd_type == CMD_TRACK ?
+ lttng_process_attr_user_id_tracker_handle_add_uid(
+ tracker_handle,
+ (uid_t) one_value_int) :
+ lttng_process_attr_user_id_tracker_handle_remove_uid(
+ tracker_handle,
+ (uid_t) one_value_int);
+ break;
+ case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID:
+ status = cmd_type == CMD_TRACK ?
+ lttng_process_attr_virtual_user_id_tracker_handle_add_uid(
+ tracker_handle,
+ (uid_t) one_value_int) :
+ lttng_process_attr_virtual_user_id_tracker_handle_remove_uid(
+ tracker_handle,
+ (uid_t) one_value_int);
+ break;
+ case LTTNG_PROCESS_ATTR_GROUP_ID:
+ status = cmd_type == CMD_TRACK ?
+ lttng_process_attr_group_id_tracker_handle_add_gid(
+ tracker_handle,
+ (gid_t) one_value_int) :
+ lttng_process_attr_group_id_tracker_handle_remove_gid(
+ tracker_handle,
+ (gid_t) one_value_int);
+ break;
+ case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
+ status = cmd_type == CMD_TRACK ?
+ lttng_process_attr_virtual_group_id_tracker_handle_add_gid(
+ tracker_handle,
+ (gid_t) one_value_int) :
+ lttng_process_attr_virtual_group_id_tracker_handle_remove_gid(
+ tracker_handle,
+ (gid_t) one_value_int);
+ break;
+ default:
+ abort();
+ }
+
+ } else {
+ if (writer) {
+ ret = mi_lttng_string_process_attribute_value(
+ writer, process_attr,
+ one_value_str, true);
+ if (ret) {
+ cmd_ret = CMD_FATAL;
+ goto end;
+ }
+ }
+
+ switch (process_attr) {
+ case LTTNG_PROCESS_ATTR_USER_ID:
+ status = cmd_type == CMD_TRACK ?
+ lttng_process_attr_user_id_tracker_handle_add_user_name(
+ tracker_handle,
+ one_value_str) :
+ lttng_process_attr_user_id_tracker_handle_remove_user_name(
+ tracker_handle,
+ one_value_str);
+ break;
+ case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID:
+ status = cmd_type == CMD_TRACK ?
+ lttng_process_attr_virtual_user_id_tracker_handle_add_user_name(
+ tracker_handle,
+ one_value_str) :
+ lttng_process_attr_virtual_user_id_tracker_handle_remove_user_name(
+ tracker_handle,
+ one_value_str);
+ break;
+ case LTTNG_PROCESS_ATTR_GROUP_ID:
+ status = cmd_type == CMD_TRACK ?
+ lttng_process_attr_group_id_tracker_handle_add_group_name(
+ tracker_handle,
+ one_value_str) :
+ lttng_process_attr_group_id_tracker_handle_remove_group_name(
+ tracker_handle,
+ one_value_str);
+ break;
+ case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
+ status = cmd_type == CMD_TRACK ?
+ lttng_process_attr_virtual_group_id_tracker_handle_add_group_name(
+ tracker_handle,
+ one_value_str) :
+ lttng_process_attr_virtual_group_id_tracker_handle_remove_group_name(
+ tracker_handle,
+ one_value_str);
+ break;
+ default:
+ ERR("%s is not a valid %s value; expected an integer",
+ one_value_str,
+ lttng_process_attr_to_string(
+ process_attr));
+ cmd_ret = CMD_FATAL;
+ goto end;
+ }
+ }
+
+ ret = asprintf(&prettified_arg,
+ is_numerical_argument ? "%s" : "`%s`",
+ one_value_str);
+ if (ret < 0) {
+ PERROR("Failed to format argument `%s`", one_value_str);
+ cmd_ret = CMD_FATAL;