summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3183dbb)
The CMD_WARNING is returned if at least one command went wrong and at
least one succeeded. This shoudl tell the user that there is an error
message on stderr but the rest of the command went well.
One use case for that is the multiple -t of add_context. If one of them
fails, this code is returned.
This error code is added at the end of the enum so the previous CMD code
are not changed.
Also, if the tracer (-k/-u) is not specified, CMD_ERROR is returned
instead of CMD_UNDEFINED which makes way more sense.
Signed-off-by: David Goulet <dgoulet@efficios.com>
CMD_ERROR,
CMD_UNDEFINED,
CMD_FATAL,
CMD_ERROR,
CMD_UNDEFINED,
CMD_FATAL,
*/
static int add_context(char *session_name)
{
*/
static int add_context(char *session_name)
{
+ int ret = CMD_SUCCESS, warn = 0;
struct lttng_event_context context;
struct lttng_domain dom;
struct ctx_type *type;
struct lttng_event_context context;
struct lttng_domain dom;
struct ctx_type *type;
dom.type = LTTNG_DOMAIN_UST;
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
dom.type = LTTNG_DOMAIN_UST;
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
opt_channel_name);
if (ret < 0) {
ERR("%s: ", type->opt->symbol);
opt_channel_name);
if (ret < 0) {
ERR("%s: ", type->opt->symbol);
continue;
} else {
MSG("%s context %s added to %s event in %s",
continue;
} else {
MSG("%s context %s added to %s event in %s",
error:
lttng_destroy_handle(handle);
error:
lttng_destroy_handle(handle);
+ /*
+ * This means that at least one add_context failed and tells the user to
+ * look on stderr for error(s).
+ */
+ if (warn) {
+ ret = CMD_WARNING;
+ }
dom.type = LTTNG_DOMAIN_UST;
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
dom.type = LTTNG_DOMAIN_UST;
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
dom.type = LTTNG_DOMAIN_UST;
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
dom.type = LTTNG_DOMAIN_UST;
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
dom.type = LTTNG_DOMAIN_UST;
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
dom.type = LTTNG_DOMAIN_UST;
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
dom.type = LTTNG_DOMAIN_UST;
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
dom.type = LTTNG_DOMAIN_UST;
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
dom.type = LTTNG_DOMAIN_UST;
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
dom.type = LTTNG_DOMAIN_UST;
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
if (strcmp(argv[0], cmd->name) == 0) {
ret = cmd->func(argc, (const char**) argv);
switch (ret) {
if (strcmp(argv[0], cmd->name) == 0) {
ret = cmd->func(argc, (const char**) argv);
switch (ret) {
+ case CMD_WARNING:
+ WARN("Some command(s) went wrong");
+ break;
case CMD_ERROR:
ERR("Command error");
break;
case CMD_ERROR:
ERR("Command error");
break;