ret = lttng_snapshot_del_output(current_session_name, output);
if (ret < 0) {
- ret = CMD_FATAL;
goto error;
}
/* This call, if successful, populates the id of the output object. */
ret = lttng_snapshot_add_output(current_session_name, output);
if (ret < 0) {
- ret = CMD_ERROR;
goto error;
}
ret = lttng_snapshot_record(current_session_name, output, 0);
if (ret < 0) {
if (ret == -LTTNG_ERR_MAX_SIZE_INVALID) {
- ERR("The minimum size of a snapshot is computed by multiplying "
- "the total amount of streams with the largest subbuffer "
- "in the session.");
+ ERR("Invalid snapshot size. Cannot fit at least one packet per stream.");
}
goto error;
}
cmd = &actions[i];
}
- ret = -CMD_UNDEFINED;
+ ret = CMD_UNDEFINED;
end:
- /* Overwrite ret if an error occured in cmd->func() */
+ /* Overwrite ret if an error occurred in cmd->func() */
ret = command_ret ? command_ret : ret;
return ret;
}
}
command_ret = handle_command(poptGetArgs(pc));
- if (command_ret < 0) {
+ 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));
+
+ /* A warning is fine since the user has no control on
+ * whether or not applications (or the kernel) have
+ * produced any event between the start of the tracing
+ * session and the recording of the snapshot. MI wise
+ * the command is not a success since nothing was
+ * recorded.
+ */
+ command_ret = 0;
break;
default:
ERR("%s", lttng_strerror(command_ret));