Fix loglevel handling in test case (API change) and lttng command
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 1 Feb 2012 19:39:49 +0000 (14:39 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 1 Feb 2012 19:39:49 +0000 (14:39 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/lttng.h
src/bin/lttng-sessiond/main.c
src/bin/lttng/commands/enable_events.c
tests/lttng/ust_global_all_events_basic.c
tests/lttng/ust_global_event_basic.c

index 433d2d804829749b2909b2485213b1c06607377f..c83f9832588e8bfea1a1d73c56ca2b79dfc80690 100644 (file)
@@ -152,9 +152,9 @@ struct lttng_event {
        char name[LTTNG_SYMBOL_NAME_LEN];
 
        enum lttng_loglevel_type loglevel_type;
-       char loglevel[LTTNG_SYMBOL_NAME_LEN];
-       int64_t loglevel_value;         /* for printing */
+       char loglevel[LTTNG_SYMBOL_NAME_LEN];   /* '\0' for all loglevels */
 
+       int64_t loglevel_value;         /* for printing */
        uint32_t enabled;
        pid_t pid;
        /* Per event type configuration */
index 8e4afb00ba0827295d86f53ed728763eb5ebe463..2aa93e63e915d8e0b03357f815ad7c3f3d13f766 100644 (file)
@@ -2426,12 +2426,6 @@ error:
 
 /*
  * Command LTTNG_ENABLE_EVENT processed by the client thread.
- *
- * TODO: currently, both events and loglevels are kept within the same
- * namespace for UST global registry/app registery, so if an event
- * happen to have the same name as the loglevel (very unlikely though),
- * and an attempt is made to enable/disable both in the same session,
- * the first to be created will be the only one allowed to exist.
  */
 static int cmd_enable_event(struct ltt_session *session, int domain,
                char *channel_name, struct lttng_event *event)
index 0fa3e916c835b48e2d9228ac8c86ee1e0e4a5dcf..1fcc81acb64e360a88e7da2b503001a4097b77b4 100644 (file)
@@ -341,7 +341,7 @@ static int enable_events(char *session_name)
                                goto error;
                        }
 
-                       if (opt_loglevel[0] != '\0') {
+                       if (opt_loglevel) {
                                MSG("Kernel loglevels are not supported.");
                                ret = CMD_UNDEFINED;
                                goto error;
@@ -381,8 +381,12 @@ static int enable_events(char *session_name)
                        }
 
                        ev.loglevel_type = opt_loglevel_type;
-                       strncpy(ev.loglevel, opt_loglevel, LTTNG_SYMBOL_NAME_LEN);
-                       ev.loglevel[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
+                       if (opt_loglevel) {
+                               strncpy(ev.loglevel, opt_loglevel, LTTNG_SYMBOL_NAME_LEN);
+                               ev.loglevel[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
+                       } else {
+                               ev.loglevel[0] = '\0';
+                       }
                } else {
                        ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
                        goto error;
index 32c39fb5e1cf2a58e66c646d07f974ee56fde2c1..b141057c6b8d4a44c31ee95882f071697fc44b99 100644 (file)
@@ -42,6 +42,8 @@ int main(int argc, char **argv)
 
        memset(&event, 0, sizeof(struct lttng_event));
        event.type = LTTNG_EVENT_TRACEPOINT;
+       event.loglevel[0] = '\0';
+       event.loglevel_type = LTTNG_EVENT_LOGLEVEL;
 
        printf("\nTesting tracing all UST events:\n");
        printf("-----------\n");
index d3a103033678bc5038a38ebcf1d5993cdee2db0c..ac0687daa11120e112ad5cc9d6e42014461e0453 100644 (file)
@@ -52,12 +52,18 @@ int main(int argc, char **argv)
 
        strcpy(ev1.name, "tp1");
        ev1.type = LTTNG_EVENT_TRACEPOINT;
+       ev1.loglevel[0] = '\0';
+       ev1.loglevel_type = LTTNG_EVENT_LOGLEVEL;
 
        strcpy(ev2.name, "ev2");
        ev2.type = LTTNG_EVENT_TRACEPOINT;
+       ev2.loglevel[0] = '\0';
+       ev2.loglevel_type = LTTNG_EVENT_LOGLEVEL;
 
        strcpy(ev3.name, "ev3");
        ev3.type = LTTNG_EVENT_TRACEPOINT;
+       ev3.loglevel[0] = '\0';
+       ev3.loglevel_type = LTTNG_EVENT_LOGLEVEL;
 
        printf("\nTesting tracing UST events:\n");
        printf("-----------\n");
This page took 0.02982 seconds and 4 git commands to generate.