Fix: JUL to enable user and root tracepoints
authorDavid Goulet <dgoulet@efficios.com>
Thu, 27 Feb 2014 15:03:14 +0000 (10:03 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 27 Feb 2014 15:13:28 +0000 (10:13 -0500)
This is needed to support the LTTng JUL agent to connect to both user
and root session daemon, we have to enable different tracepoint for the
two cases in order to avoid duplicating the trace payload in both the
user and root trace output.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Conflicts:
src/bin/lttng-sessiond/lttng-sessiond.h
src/bin/lttng-sessiond/main.c

src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/lttng-sessiond.h
src/bin/lttng-sessiond/main.c
src/common/defaults.h

index 5bf00be8536f12cb124fd0d828486344b75734b7..532af7d9917b733b33b59d6309f9a184417c6fbb 100644 (file)
@@ -1442,7 +1442,13 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain,
                memset(&uevent, 0, sizeof(uevent));
                uevent.type = LTTNG_EVENT_TRACEPOINT;
                uevent.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
-               strncpy(uevent.name, DEFAULT_JUL_EVENT_NAME, sizeof(uevent.name));
+               if (is_root) {
+                       strncpy(uevent.name, DEFAULT_SYS_JUL_EVENT_NAME,
+                                       sizeof(uevent.name));
+               } else {
+                       strncpy(uevent.name, DEFAULT_USER_JUL_EVENT_NAME,
+                                       sizeof(uevent.name));
+               }
                uevent.name[sizeof(uevent.name) - 1] = '\0';
 
                /*
@@ -1654,7 +1660,13 @@ int cmd_enable_event_all(struct ltt_session *session,
                /* Create the default JUL tracepoint. */
                uevent.type = LTTNG_EVENT_TRACEPOINT;
                uevent.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
-               strncpy(uevent.name, DEFAULT_JUL_EVENT_NAME, sizeof(uevent.name));
+               if (is_root) {
+                       strncpy(uevent.name, DEFAULT_SYS_JUL_EVENT_NAME,
+                                       sizeof(uevent.name));
+               } else {
+                       strncpy(uevent.name, DEFAULT_USER_JUL_EVENT_NAME,
+                                       sizeof(uevent.name));
+               }
                uevent.name[sizeof(uevent.name) - 1] = '\0';
 
                /*
index e21f6d0126c66bf3903683e4caadb8b1078ab557..6417b3de453fbf76bfb1e2177d1bb3c48d5bceb6 100644 (file)
@@ -108,6 +108,9 @@ extern long page_size;
  */
 extern unsigned int jul_tcp_port;
 
+/* Is this daemon root or not. */
+extern int is_root;
+
 int sessiond_set_thread_pollset(struct lttng_poll_event *events, size_t size);
 int sessiond_check_thread_quit_pipe(int fd, uint32_t events);
 
index 0bb06a3efe5aedd335f5a43238300aea7a5d62ba..a65d62bfa9086dab4b4546483323731a5b6c0e0b 100644 (file)
@@ -76,7 +76,6 @@ static int opt_sig_parent;
 static int opt_verbose_consumer;
 static int opt_daemon, opt_background;
 static int opt_no_kernel;
-static int is_root;                    /* Set to 1 if the daemon is running as root */
 static pid_t ppid;          /* Parent PID for --sig-parent option */
 static pid_t child_ppid;    /* Internal parent PID use with daemonize. */
 static char *rundir;
@@ -244,6 +243,9 @@ struct health_app *health_sessiond;
 /* JUL TCP port for registration. Used by the JUL thread. */
 unsigned int jul_tcp_port = DEFAULT_JUL_TCP_PORT;
 
+/* Am I root or not. */
+int is_root;                   /* Set to 1 if the daemon is running as root */
+
 /*
  * Whether sessiond is ready for commands/health check requests.
  * NR_LTTNG_SESSIOND_READY must match the number of calls to
index 6b40ce849e8cba8f505052da9e48d101ec76d674..716b591d8ee88b20e9498a86ada8ce385f0f2f1c 100644 (file)
 /* Default JUL domain channel name. */
 #define DEFAULT_JUL_CHANNEL_NAME        "lttng_jul_channel"
 /* Default JUL tracepoint name. This is a wildcard for the JUL domain. */
-#define DEFAULT_JUL_EVENT_NAME          "lttng_jul*"
+#define DEFAULT_SYS_JUL_EVENT_NAME      "lttng_jul:sys*"
+#define DEFAULT_USER_JUL_EVENT_NAME     "lttng_jul:user*"
 /* JUL default channel name. */
 #define DEFAULT_CHANNEL_OVERWRITE       0
 #define DEFAULT_CHANNEL_TRACEFILE_SIZE  0
This page took 0.040821 seconds and 4 git commands to generate.