From: Jérémie Galarneau Date: Fri, 28 Nov 2014 23:08:30 +0000 (-0500) Subject: Fix: "Any" loglevel's value is -1 and not 0 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9b7431cfd4e61bc2b1e3bc859d5a6a79de9aa0ed;p=lttng-tools.git Fix: "Any" loglevel's value is -1 and not 0 lttng_disable_event_ext() was erroring-out on loglevel != 0. loglevel 0 is a valid level whereas "-1" is used an unknown/unspecified in the rest of the code. Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 33ab492da..696e650de 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1042,7 +1042,8 @@ int cmd_disable_event(struct ltt_session *session, int domain, event_name = event->name; - if (event->loglevel_type || event->loglevel || event->enabled + /* Error out on unhandled search criteria */ + if (event->loglevel_type || event->loglevel != -1 || event->enabled || event->pid || event->filter || event->exclusion) { return LTTNG_ERR_UNK; } diff --git a/src/bin/lttng/commands/disable_events.c b/src/bin/lttng/commands/disable_events.c index 9ab8bf0b2..45e91a8bb 100644 --- a/src/bin/lttng/commands/disable_events.c +++ b/src/bin/lttng/commands/disable_events.c @@ -222,6 +222,9 @@ static int disable_events(char *session_name) } memset(&event, 0, sizeof(event)); + /* Set default loglevel to any/unknown */ + event.loglevel = -1; + switch (opt_event_type) { case LTTNG_EVENT_SYSCALL: event.type = LTTNG_EVENT_SYSCALL; diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 004196965..4a0a07b14 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -1216,6 +1216,7 @@ int lttng_disable_event(struct lttng_handle *handle, const char *name, struct lttng_event ev; memset(&ev, 0, sizeof(ev)); + ev.loglevel = -1; ev.type = LTTNG_EVENT_ALL; lttng_ctl_copy_string(ev.name, name, sizeof(ev.name)); return lttng_disable_event_ext(handle, &ev, channel_name, NULL);