Fix: "Any" loglevel's value is -1 and not 0
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 28 Nov 2014 23:08:30 +0000 (18:08 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 1 Dec 2014 02:39:03 +0000 (21:39 -0500)
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 <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/cmd.c
src/bin/lttng/commands/disable_events.c
src/lib/lttng-ctl/lttng-ctl.c

index cc4adfd5db899b8afcd768ba4d334c871ef85e17..b54e1d03c90b9e31023cc4b021f7974595c99fba 100644 (file)
@@ -1041,7 +1041,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;
        }
index 1ce687aa422aebc2eb96e76e348b4552d3fdd565..b50882e04ff0d70d3518d173db856625d9eb3432 100644 (file)
@@ -216,6 +216,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;
index 38cc79f3cb76fff32b0a1a23f5f7b7a8abcbb0e7..f204055b3d74fa889492bce06df650bc37077e7f 100644 (file)
@@ -1208,6 +1208,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);
This page took 0.02984 seconds and 4 git commands to generate.