LTTNG_ERR_SESS_NOT_FOUND = 23, /* Session by name not found */
LTTNG_ERR_BUFFER_TYPE_MISMATCH = 24, /* Buffer type mismatched. */
LTTNG_ERR_FATAL = 25, /* Fatal error */
- /* 26 */
+ LTTNG_ERR_NOMEM = 26, /* Not enough memory. */
LTTNG_ERR_SELECT_SESS = 27, /* Must select a session */
LTTNG_ERR_EXIST_SESS = 28, /* Session name already exist */
LTTNG_ERR_NO_EVENT = 29, /* No event found */
/* Set URI into consumer output object */
ret = consumer_set_network_uri(consumer, uri);
if (ret < 0) {
- ret = LTTNG_ERR_FATAL;
+ ret = -ret;
goto error;
} else if (ret == 1) {
/*
break;
}
+ ret = LTTNG_OK;
+
error:
return ret;
}
for (i = 0; i < nb_uri; i++) {
ret = add_uri_to_consumer(consumer, &uris[i], domain, session->name);
- if (ret < 0) {
+ if (ret != LTTNG_OK) {
goto error;
}
}
if (uri->port == 0) {
/* Assign default port. */
uri->port = DEFAULT_NETWORK_CONTROL_PORT;
+ } else {
+ if (obj->dst.net.data_isset && uri->port ==
+ obj->dst.net.data.port) {
+ ret = -LTTNG_ERR_INVALID;
+ goto error;
+ }
}
DBG3("Consumer control URI set with port %d", uri->port);
break;
if (uri->port == 0) {
/* Assign default port. */
uri->port = DEFAULT_NETWORK_DATA_PORT;
+ } else {
+ if (obj->dst.net.control_isset && uri->port ==
+ obj->dst.net.control.port) {
+ ret = -LTTNG_ERR_INVALID;
+ goto error;
+ }
}
DBG3("Consumer data URI set with port %d", uri->port);
break;
default:
ERR("Set network uri type unknown %d", uri->stype);
+ ret = -LTTNG_ERR_INVALID;
goto error;
}
}
if (ret < 0) {
PERROR("snprintf set consumer uri subdir");
+ ret = -LTTNG_ERR_NOMEM;
goto error;
}
equal:
return 1;
error:
- return -1;
+ return ret;
}
/*
WARN("Session %s already exists", session_name);
break;
default:
- ERR("%s", lttng_strerror(ret));
break;
}
goto error;
[ ERROR_INDEX(LTTNG_ERR_URL_EXIST) ] = "URL already exists",
[ ERROR_INDEX(LTTNG_ERR_BUFFER_NOT_SUPPORTED)] = "Buffer type not supported",
[ ERROR_INDEX(LTTNG_ERR_BUFFER_TYPE_MISMATCH)] = "Buffer type mismatch for session",
+ [ ERROR_INDEX(LTTNG_ERR_NOMEM)] = "Not enough memory",
/* Last element */
[ ERROR_INDEX(LTTNG_ERR_NR) ] = "Unknown error code"