Merge branch 'master' into benchmark
authorDavid Goulet <dgoulet@efficios.com>
Mon, 26 Mar 2012 20:55:06 +0000 (16:55 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Mon, 26 Mar 2012 20:55:06 +0000 (16:55 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
1  2 
configure.ac
src/bin/lttng-sessiond/Makefile.am
src/bin/lttng-sessiond/main.c
src/bin/lttng-sessiond/shm.c

diff --cc configure.ac
Simple merge
index 1e449476c6323b1cddf31b11f1b5735d76373985,8748dd6bb915d6f8420872500c87661b9500f316..bc99f9b4a4e8d660fe9680e2543ee4dd12d32740
@@@ -1,5 -1,4 +1,6 @@@
 -AM_CPPFLAGS = -DINSTALL_BIN_PATH=\""$(lttnglibexecdir)"\" \
++<<<<<<< HEAD
 +AM_CPPFLAGS = -I$(top_srcdir)/benchmark \
-                         -DINSTALL_BIN_PATH=\""$(bindir)"\" \
++                        -DINSTALL_BIN_PATH=\""$(lttnglibexecdir)"\" \
                          -DINSTALL_LIB_PATH=\""$(libdir)"\"
  
  AM_CFLAGS = -fno-strict-aliasing
@@@ -33,8 -33,7 +35,8 @@@ lttng_sessiond_LDADD = -lrt -lurcu-comm
                $(top_builddir)/src/common/kernel-ctl/libkernel-ctl.la \
                $(top_builddir)/src/common/hashtable/libhashtable.la \
                $(top_builddir)/src/common/libcommon.la \
-               $(top_builddir)/benchmark/liblttng-benchmark.la \
-               $(top_builddir)/src/common/libcompat.la
 -              $(top_builddir)/src/common/compat/libcompat.la
++              $(top_builddir)/src/common/compat/libcompat.la \
++              $(top_builddir)/benchmark/liblttng-benchmark.la
  
  if HAVE_LIBLTTNG_UST_CTL
  lttng_sessiond_LDADD += -llttng-ust-ctl
index cb4dd25e94f73159d7e9bb1e6f1660060450b30f,3c917b25f51c87f484a33096873f441c0c2da92b..cb186bbbe31723e75764126ab596f1ac1a1111b8
@@@ -426,28 -441,35 +443,54 @@@ static void cleanup(void
                modprobe_remove_lttng_all();
        }
  
-       close(thread_quit_pipe[0]);
-       close(thread_quit_pipe[1]);
+       /*
+        * Closing all pipes used for communication between threads.
+        */
+       for (i = 0; i < 2; i++) {
+               if (kernel_poll_pipe[i] >= 0) {
+                       ret = close(kernel_poll_pipe[i]);
+                       if (ret) {
+                               PERROR("close");
+                       }
+                       
+               }
+       }
+       for (i = 0; i < 2; i++) {
+               if (thread_quit_pipe[i] >= 0) {
+                       ret = close(thread_quit_pipe[i]);
+                       if (ret) {
+                               PERROR("close");
+                       }
+               }
+       }
+       for (i = 0; i < 2; i++) {
+               if (apps_cmd_pipe[i] >= 0) {
+                       ret = close(apps_cmd_pipe[i]);
+                       if (ret) {
+                               PERROR("close");
+                       }
+               }
+       }
  
 +      /* OUTPUT BENCHMARK RESULTS */
 +      bench_init();
 +
 +      if (getenv("BENCH_UST_NOTIFY")) {
 +              bench_print_ust_notification();
 +      }
 +
 +      if (getenv("BENCH_UST_REGISTER")) {
 +              bench_print_ust_register();
 +              bench_print_ust_unregister();
 +      }
 +
 +      if (getenv("BENCH_BOOT_PROCESS")) {
 +              bench_print_boot_process();
 +      }
 +
 +      bench_close();
 +      /* END BENCHMARK */
 +
        /* <fun> */
        DBG("%c[%d;%dm*** assert failed :-) *** ==> %c[%dm%c[%d;%dm"
                        "Matthew, BEET driven development works!%c[%dm",
@@@ -857,11 -873,16 +900,18 @@@ static void *thread_manage_kernel(void 
                /* Zeroed the poll events */
                lttng_poll_reset(&events);
  
 +              tracepoint(sessiond_th_kern_poll);
 +
                /* Poll infinite value of time */
+       restart:
                ret = lttng_poll_wait(&events, -1);
                if (ret < 0) {
+                       /*
+                        * Restart interrupted system call.
+                        */
+                       if (errno == EINTR) {
+                               goto restart;
+                       }
                        goto error;
                } else if (ret == 0) {
                        /* Should not happen since timeout is infinite */
@@@ -952,11 -968,16 +999,18 @@@ static void *thread_manage_consumer(voi
  
        nb_fd = LTTNG_POLL_GETNB(&events);
  
 +      tracepoint(sessiond_th_kcon_poll);
 +
        /* Inifinite blocking call, waiting for transmission */
+ restart:
        ret = lttng_poll_wait(&events, -1);
        if (ret < 0) {
+               /*
+                * Restart interrupted system call.
+                */
+               if (errno == EINTR) {
+                       goto restart;
+               }
                goto error;
        }
  
@@@ -1111,11 -1154,16 +1189,18 @@@ static void *thread_manage_apps(void *d
  
                DBG("Apps thread polling on %d fds", nb_fd);
  
 +              tracepoint(sessiond_th_apps_poll);
 +
                /* Inifinite blocking call, waiting for transmission */
+       restart:
                ret = lttng_poll_wait(&events, -1);
                if (ret < 0) {
+                       /*
+                        * Restart interrupted system call.
+                        */
+                       if (errno == EINTR) {
+                               goto restart;
+                       }
                        goto error;
                }
  
                                        /* Empty pipe */
                                        ret = read(apps_cmd_pipe[0], &ust_cmd, sizeof(ust_cmd));
                                        if (ret < 0 || ret < sizeof(ust_cmd)) {
-                                               perror("read apps cmd pipe");
+                                               PERROR("read apps cmd pipe");
                                                goto error;
                                        }
 +                                      tracepoint(ust_register_read_stop);
  
 +                                      tracepoint(ust_register_add_start);
                                        /* Register applicaton to the session daemon */
                                        ret = ust_app_register(&ust_cmd.reg_msg,
                                                        ust_cmd.sock);
@@@ -3455,10 -3551,13 +3616,15 @@@ skip_domain
        }
        case LTTNG_DESTROY_SESSION:
        {
 +              tracepoint(destroy_session_start);
                ret = cmd_destroy_session(cmd_ctx->session,
                                cmd_ctx->lsm->session.name);
 +              tracepoint(destroy_session_end);
+               /*
+                * Set session to NULL so we do not unlock it after
+                * free.
+                */
+               cmd_ctx->session = NULL;
                break;
        }
        case LTTNG_LIST_DOMAINS:
@@@ -4498,11 -4664,9 +4737,11 @@@ int main(int argc, char **argv
                goto exit_kernel;
        }
  
 +      tracepoint(sessiond_boot_end);
 +
        ret = pthread_join(kernel_thread, &status);
        if (ret != 0) {
-               perror("pthread_join");
+               PERROR("pthread_join");
                goto error;     /* join error, exit without cleanup */
        }
  
index 0bf3ff58f0dd138e553f9c1dafaa38d418b1d09c,584ae078f2d84fe07c32f4c8752850612908fc41..e785aaa8b05c584a248b49ecd764ef9e02ac72b0
@@@ -111,14 -104,16 +111,18 @@@ static int get_wait_shm(char *shm_path
                exit(EXIT_FAILURE);
        }
  
+ #ifndef __FreeBSD__
        ret = fchmod(wait_shm_fd, mode);
        if (ret < 0) {
-               perror("fchmod");
+               PERROR("fchmod");
                exit(EXIT_FAILURE);
        }
+ #else
+ #warning "FreeBSD does not support setting file mode on shm FD. Remember that for secure use, lttng-sessiond should be started before applications linked on lttng-ust."
+ #endif
  
 +      tracepoint(ust_notify_shm_stop);
 +
        DBG("Got the wait shm fd %d", wait_shm_fd);
  
        return wait_shm_fd;
This page took 0.033778 seconds and 4 git commands to generate.