Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
LTTNG_ERR_PER_PID_SESSION = 120, /* Per-PID sessions unsupported */
LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE = 121, /* Context unavailable on this kernel */
LTTNG_ERR_REGEN_STATEDUMP_FAIL = 122, /* Failed to regenerate the state dump */
LTTNG_ERR_PER_PID_SESSION = 120, /* Per-PID sessions unsupported */
LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE = 121, /* Context unavailable on this kernel */
LTTNG_ERR_REGEN_STATEDUMP_FAIL = 122, /* Failed to regenerate the state dump */
- LTTNG_ERR_REGEN_STATEDUMP_NOMEM = 123, /* Failed to regenerate the state dump, not enough memory */
+ LTTNG_ERR_REGEN_STATEDUMP_NOMEM = 123, /* Failed to regenerate the state dump, not enough memory */
+ LTTNG_ERR_NOT_SNAPSHOT_SESSION = 124, /* Session is not in snapshot mode. */
/* MUST be last element */
LTTNG_ERR_NR, /* Last element */
/* MUST be last element */
LTTNG_ERR_NR, /* Last element */
DBG("Cmd snapshot add output for session %s", session->name);
/*
DBG("Cmd snapshot add output for session %s", session->name);
/*
- * Permission denied to create an output if the session is not
- * set in no output mode.
+ * Can't create an output if the session is not set in no-output mode.
*/
if (session->output_traces) {
*/
if (session->output_traces) {
+ ret = LTTNG_ERR_NOT_SNAPSHOT_SESSION;
* set in no output mode.
*/
if (session->output_traces) {
* set in no output mode.
*/
if (session->output_traces) {
+ ret = LTTNG_ERR_NOT_SNAPSHOT_SESSION;
* set in no output mode.
*/
if (session->output_traces) {
* set in no output mode.
*/
if (session->output_traces) {
- ret = -LTTNG_ERR_EPERM;
- goto error;
+ ret = -LTTNG_ERR_NOT_SNAPSHOT_SESSION;
+ goto end;
}
if (session->snapshot.nb_output == 0) {
ret = 0;
}
if (session->snapshot.nb_output == 0) {
ret = 0;
}
list = zmalloc(session->snapshot.nb_output * sizeof(*list));
if (!list) {
ret = -LTTNG_ERR_NOMEM;
}
list = zmalloc(session->snapshot.nb_output * sizeof(*list));
if (!list) {
ret = -LTTNG_ERR_NOMEM;
}
/* Copy list from session to the new list object. */
}
/* Copy list from session to the new list object. */
if (lttng_strncpy(list[idx].name, output->name,
sizeof(list[idx].name))) {
ret = -LTTNG_ERR_INVALID;
if (lttng_strncpy(list[idx].name, output->name,
sizeof(list[idx].name))) {
ret = -LTTNG_ERR_INVALID;
}
if (output->consumer->type == CONSUMER_DST_LOCAL) {
if (lttng_strncpy(list[idx].ctrl_url,
output->consumer->dst.trace_path,
sizeof(list[idx].ctrl_url))) {
ret = -LTTNG_ERR_INVALID;
}
if (output->consumer->type == CONSUMER_DST_LOCAL) {
if (lttng_strncpy(list[idx].ctrl_url,
output->consumer->dst.trace_path,
sizeof(list[idx].ctrl_url))) {
ret = -LTTNG_ERR_INVALID;
}
} else {
/* Control URI. */
}
} else {
/* Control URI. */
list[idx].ctrl_url, sizeof(list[idx].ctrl_url));
if (ret < 0) {
ret = -LTTNG_ERR_NOMEM;
list[idx].ctrl_url, sizeof(list[idx].ctrl_url));
if (ret < 0) {
ret = -LTTNG_ERR_NOMEM;
list[idx].data_url, sizeof(list[idx].data_url));
if (ret < 0) {
ret = -LTTNG_ERR_NOMEM;
list[idx].data_url, sizeof(list[idx].data_url));
if (ret < 0) {
ret = -LTTNG_ERR_NOMEM;
*outputs = list;
list = NULL;
ret = session->snapshot.nb_output;
*outputs = list;
list = NULL;
ret = session->snapshot.nb_output;
-error_unlock:
- rcu_read_unlock();
* set in no output mode.
*/
if (session->output_traces) {
* set in no output mode.
*/
if (session->output_traces) {
+ ret = LTTNG_ERR_NOT_SNAPSHOT_SESSION;
command_ret = handle_command(poptGetArgs(pc));
if (command_ret) {
switch (-command_ret) {
command_ret = handle_command(poptGetArgs(pc));
if (command_ret) {
switch (-command_ret) {
- case LTTNG_ERR_EPERM:
- ERR("The session needs to be set in no output mode (--no-output)");
- break;
case LTTNG_ERR_SNAPSHOT_NODATA:
WARN("%s", lttng_strerror(command_ret));
case LTTNG_ERR_SNAPSHOT_NODATA:
WARN("%s", lttng_strerror(command_ret));
[ ERROR_INDEX(LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE) ] = "Context unavailable on this kernel",
[ ERROR_INDEX(LTTNG_ERR_REGEN_STATEDUMP_FAIL) ] = "Failed to regenerate the state dump",
[ ERROR_INDEX(LTTNG_ERR_REGEN_STATEDUMP_NOMEM) ] = "Failed to regenerate the state dump, not enough memory",
[ ERROR_INDEX(LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE) ] = "Context unavailable on this kernel",
[ ERROR_INDEX(LTTNG_ERR_REGEN_STATEDUMP_FAIL) ] = "Failed to regenerate the state dump",
[ ERROR_INDEX(LTTNG_ERR_REGEN_STATEDUMP_NOMEM) ] = "Failed to regenerate the state dump, not enough memory",
+ [ ERROR_INDEX(LTTNG_ERR_NOT_SNAPSHOT_SESSION) ] = "Snapshot command can't be applied to a non-snapshot session",
/* Last element */
[ ERROR_INDEX(LTTNG_ERR_NR) ] = "Unknown error code"
/* Last element */
[ ERROR_INDEX(LTTNG_ERR_NR) ] = "Unknown error code"