Merge branch 'master' into benchmark
authorDavid Goulet <david.goulet@polymtl.ca>
Mon, 5 Dec 2011 18:54:47 +0000 (13:54 -0500)
committerDavid Goulet <david.goulet@polymtl.ca>
Mon, 5 Dec 2011 18:54:47 +0000 (13:54 -0500)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
1  2 
Makefile.am
configure.ac
lttng-sessiond/Makefile.am
lttng-sessiond/main.c

diff --combined Makefile.am
index 279a73ae53ccc2370c6e37363830065c9ff9a1f9,fa5beea9a9df6ddd0d5cdcdd4ee1d7ea0191cbb2..ae88bcaa0cadc5a541533cd7dbb27bdd8d3d76d1
@@@ -1,18 -1,18 +1,22 @@@
  ACLOCAL_AMFLAGS = -I config
  
 -SUBDIRS = liblttng-sessiond-comm \
 +SUBDIRS = benchmark \
 +                liblttng-sessiond-comm \
                  libkernelctl \
                  liblttng-kconsumer \
                  liblttng-ustconsumer \
                  liblttng-consumer \
-                 lttng-consumerd \
-                 liblttngctl \
-                 lttng \
-                 lttng-sessiond \
-                 tests \
-                 include \
-                 doc
+                 lttng-consumerd
+ if ! BUILD_CONSUMERD_ONLY
+ SUBDIRS += liblttngctl \
+            lttng \
+            lttng-sessiond
+ endif
+ SUBDIRS += tests \
+            include \
+            doc
 +
 +bench:
 +      ./benchmark/runall.sh
diff --combined configure.ac
index 59c6a2838045fee5939c2329391b9d9e0576e960,621f091fd9d57db8e9211a416181ac999f48e1d3..d259b290c880631a1a14a45b307e263d0a98f24f
@@@ -1,23 -1,51 +1,51 @@@
- AC_INIT([lttng-tools], [2.0-pre14], [david.goulet@polymtl.ca], ,[http://lttng.org])
+ AC_INIT([lttng-tools],[2.0-pre14],[david.goulet@polymtl.ca],[],[http://lttng.org])
  AC_CONFIG_AUX_DIR([config])
  AC_CANONICAL_TARGET
  AC_CANONICAL_HOST
  AC_CONFIG_MACRO_DIR([config])
  AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
AM_SILENT_RULES([yes])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  
  AC_CONFIG_HEADERS([include/config.h])
  
- AH_TEMPLATE([CONFIG_LTTNG_TOOLS_HAVE_UST], [Defined on systems where UST headers can be found.])
  AC_CHECK_HEADERS([ \
        sys/types.h unistd.h fcntl.h string.h pthread.h limits.h \
        signal.h stdlib.h sys/un.h sys/socket.h stdlib.h stdio.h \
        getopt.h sys/ipc.h sys/shm.h popt.h grp.h \
  ])
  
- # URCU library version needed or newer
- liburcu_version=">= 0.6.5"
+ AC_ARG_WITH([consumerd32-path],
+       AS_HELP_STRING([--with-consumerd32-path],
+       [Location of the 32-bit consumerd executable]),
+       [CONSUMERD32_PATH="$withval"],
+       [CONSUMERD32_PATH=''])
+ AC_SUBST([CONSUMERD32_PATH])
+ AC_ARG_WITH([consumerd64-path],
+       AS_HELP_STRING([--with-consumerd64-path],
+       [Location of the 64-bit consumerd executable]),
+       [CONSUMERD64_PATH="$withval"],
+       [CONSUMERD64_PATH=''])
+ AC_SUBST([CONSUMERD64_PATH])
+ AC_ARG_WITH([consumerd32-libdir],
+       AS_HELP_STRING([--with-consumerd32-libdir],
+       [Location of the 32-bit consumerd libraries]),
+       [CONSUMERD32_LIBDIR="$withval"],
+       [CONSUMERD32_LIBDIR=''])
+ AC_SUBST([CONSUMERD32_LIBDIR])
+ AC_ARG_WITH([consumer64d-libdir],
+       AS_HELP_STRING([--with-consumerd64-libdir],
+       [Location of the 64-bit consumerd libraries]),
+       [CONSUMERD64_LIBDIR="$withval"],
+       [CONSUMERD64_LIBDIR=''])
+ AC_SUBST([CONSUMERD64_LIBDIR])
+ AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_PATH], $CONSUMERD32_PATH, [Location of the 32-bit consumerd executable.])
+ AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_PATH], $CONSUMERD64_PATH, [Location of the 64-bit consumerd executable])
+ AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD32_LIBDIR], $CONSUMERD32_LIBDIR, [Search for consumerd 32-bit libraries in this location.])
+ AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_LIBDIR], $CONSUMERD64_LIBDIR, [Search for consumerd 64-bit libraries in this location.])
  
  # Check for pthread
  AC_CHECK_LIB([pthread], [pthread_create], [],
@@@ -29,11 -57,9 +57,14 @@@ AC_CHECK_LIB([popt], [poptGetContext], 
        [AC_MSG_ERROR([Cannot find libpopt. Use [LDFLAGS]=-Ldir to specify its location.])]
  )
  
 +# Needed for benchmark time
 +AC_CHECK_DECL([caa_get_cycles], [],
 +      [AC_MSG_ERROR([liburcu liburcu_version or newer is needed])], [[#include <urcu/arch.h>]]
 +)
 +
+ # URCU library version needed or newer
+ liburcu_version=">= 0.6.6"
  # Check liburcu needed function calls
  AC_CHECK_DECL([cds_list_add], [],
        [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/list.h>]]
@@@ -41,6 -67,9 +72,9 @@@
  AC_CHECK_DECL([cds_wfq_init], [],
        [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]]
  )
+ AC_CHECK_DECL([cds_wfq_dequeue_blocking], [],
+     [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/wfqueue.h>]]
+ )
  AC_CHECK_DECL([futex_async], [],
        [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu/futex.h>]]
  )
@@@ -50,22 -79,32 +84,32 @@@ AC_CHECK_DECL([rcu_thread_offline], []
  AC_CHECK_DECL([rcu_thread_online], [],
        [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
  )
- AC_CHECK_DECL([ustctl_create_session],
-       [
-               AC_DEFINE([CONFIG_LTTNG_TOOLS_HAVE_UST], 1)
-               have_ust_test=1
-       ],
-       [
-               AC_MSG_WARN([UST header not found. Building without UST support.])
-               have_ust_test=0
-       ],
-       [[#include <ust/lttng-ust-ctl.h>]]
+ AC_CHECK_DECL([caa_likely], [],
+       [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include <urcu.h>]]
  )
  
- AM_CONDITIONAL([LTTNG_TOOLS_HAVE_UST], [ test "x$have_ust_test" = "x1" ])
+ # Check liblttng-ust-ctl library
+ AC_ARG_ENABLE(lttng-ust,
+       AS_HELP_STRING([--disable-lttng-ust],[build without LTTng-UST (Userspace Tracing) support]),
+       lttng_ust_support=$enableval, lttng_ust_support=yes)
+ AS_IF([test "x$lttng_ust_support" = "xyes"], [
+       AC_CHECK_LIB([lttng-ust-ctl], [ustctl_create_session], [],
+               [AC_MSG_ERROR([Cannot find LTTng-UST. Use [LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])]
+       )
+ ])
+ AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [ test "x$ac_cv_lib_lttng_ust_ctl_ustctl_create_session" = "xyes" ])
  
  AC_CHECK_FUNCS([sched_getcpu sysconf])
  
+ # Option to only build the consumer daemon and its libraries
+ AC_ARG_WITH([consumerd-only],
+       AS_HELP_STRING([--with-consumerd-only],[Only build the consumer daemon [default=no]]),
+       [consumerd_only=$withval],
+       [consumerd_only=no])
+ AM_CONDITIONAL([BUILD_CONSUMERD_ONLY], [test "x$consumerd_only" = "xyes"])
  # Epoll check. If not present, the build will fallback on poll() API
  AX_HAVE_EPOLL(
        [AX_CONFIG_FEATURE_ENABLE(epoll)],
@@@ -79,7 -118,7 +123,7 @@@ AX_CONFIG_FEATURE
  AM_CONDITIONAL([COMPAT_EPOLL], [ test "$enable_epoll" = "yes" ])
  
  AC_PROG_CC
- AC_PROG_LIBTOOL
+ LT_INIT
  
  CFLAGS="-Wall $CFLAGS -g -fno-strict-aliasing"
  
@@@ -93,7 -132,6 +137,7 @@@ AC_SUBST(DEFAULT_INCLUDES
  AC_CONFIG_FILES([
        Makefile
        include/Makefile
 +      benchmark/Makefile
        libkernelctl/Makefile
        liblttng-consumer/Makefile
        liblttng-kconsumer/Makefile
  ])
  
  AC_OUTPUT
+ # Mini-report on what will be built
+ AS_ECHO("")
+ AS_ECHO_N("Lttng-UST support: ")
+ AS_IF([test "x$lttng_ust_support" = "xyes"], [AS_ECHO("Enabled")],
+       [AS_ECHO("Disabled")]
+ )
+ AS_IF([test "x$consumerd_only" = "xyes"],
+       [AS_ECHO("Only the consumerd daemon will be built.")],
+       [AS_ECHO("All binaries will be built.")]
+ )
+ AS_ECHO("")
index 425a0d58357809e06b5bf6c7eb75f722aa4fe618,7f97d9d2f7e5486c506346320745cefde6453e47..db621d8e38999fcee97c5e48ae5a9ad85a6506ce
@@@ -1,5 -1,6 +1,6 @@@
 -AM_CPPFLAGS = -I$(top_srcdir)/include \
 +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/benchmark \
-                         -DINSTALL_BIN_PATH=\"$(bindir)\"
+                         -DINSTALL_BIN_PATH=\""$(bindir)"\" \
+                         -DINSTALL_LIB_PATH=\""$(libdir)"\"
  
  AM_CFLAGS = -fno-strict-aliasing
  
@@@ -15,7 -16,7 +16,7 @@@ lttng_sessiond_SOURCES = utils.c utils.
                         hashtable.c hashtable.h \
                         compat/poll.h $(COMPAT) \
                         trace-kernel.c trace-kernel.h \
-                        kernel-ctl.c kernel-ctl.h \
+                        kernel.c kernel.h \
                         ust-ctl.h ust-app.h trace-ust.h \
                         context.c context.h \
                         channel.c channel.h \
@@@ -27,7 -28,7 +28,7 @@@
                         ../hashtable/rculfhash.h \
                         ../hashtable/hash.c ../hashtable/hash.h
  
- if LTTNG_TOOLS_HAVE_UST
+ if HAVE_LIBLTTNG_UST_CTL
  lttng_sessiond_SOURCES += trace-ust.c ust-app.c ust-consumer.c ust-consumer.h
  endif
  
  lttng_sessiond_SOURCES += lttng-sessiond.h main.c
  
  # link on liblttngctl for check if sessiond is already alive.
- lttng_sessiond_LDADD = -lrt -lurcu-cds -lurcu \
+ lttng_sessiond_LDADD = -lrt -lurcu-common -lurcu \
                 $(top_builddir)/liblttng-sessiond-comm/liblttng-sessiond-comm.la \
                 $(top_builddir)/libkernelctl/libkernelctl.la \
 -               $(top_builddir)/liblttngctl/liblttngctl.la
 +               $(top_builddir)/liblttngctl/liblttngctl.la \
 +               $(top_builddir)/benchmark/liblttng-benchmark.la
  
- if LTTNG_TOOLS_HAVE_UST
- lttng_sessiond_LDADD += -llttng-ust-comm -lustctl
+ if HAVE_LIBLTTNG_UST_CTL
+ lttng_sessiond_LDADD += -llttng-ust-ctl
  endif
diff --combined lttng-sessiond/main.c
index 04e5efb4f594a8190f2ad99a4570dbaaffc3bca6,75732a334c376cb5a0b5c7fd666c10ffc3cbccde..db0d661016889924c3310e42eec5f1a931e1f834
  #include "event.h"
  #include "futex.h"
  #include "hashtable.h"
- #include "kernel-ctl.h"
+ #include "kernel.h"
  #include "lttng-sessiond.h"
  #include "shm.h"
  #include "ust-app.h"
  #include "ust-ctl.h"
  #include "utils.h"
  
+ #define CONSUMERD_FILE        "lttng-consumerd"
  struct consumer_data {
        enum lttng_consumer_type type;
  
@@@ -75,8 -77,6 +77,8 @@@
        char cmd_unix_sock_path[PATH_MAX];
  };
  
 +#include "benchmark.h"
 +
  /* Const values */
  const char default_home_dir[] = DEFAULT_HOME_DIR;
  const char default_tracing_group[] = LTTNG_DEFAULT_TRACING_GROUP;
@@@ -98,9 -98,18 +100,18 @@@ static pid_t ppid;          /* Parent P
  /* Consumer daemon specific control data */
  static struct consumer_data kconsumer_data = {
        .type = LTTNG_CONSUMER_KERNEL,
+       .err_unix_sock_path = KCONSUMERD_ERR_SOCK_PATH,
+       .cmd_unix_sock_path = KCONSUMERD_CMD_SOCK_PATH,
+ };
+ static struct consumer_data ustconsumer64_data = {
+       .type = LTTNG_CONSUMER64_UST,
+       .err_unix_sock_path = USTCONSUMERD64_ERR_SOCK_PATH,
+       .cmd_unix_sock_path = USTCONSUMERD64_CMD_SOCK_PATH,
  };
- static struct consumer_data ustconsumer_data = {
-       .type = LTTNG_CONSUMER_UST,
+ static struct consumer_data ustconsumer32_data = {
+       .type = LTTNG_CONSUMER32_UST,
+       .err_unix_sock_path = USTCONSUMERD32_ERR_SOCK_PATH,
+       .cmd_unix_sock_path = USTCONSUMERD32_CMD_SOCK_PATH,
  };
  
  static int dispatch_thread_exit;
@@@ -159,6 -168,67 +170,67 @@@ static struct ust_cmd_queue ust_cmd_que
   */
  static struct ltt_session_list *session_list_ptr;
  
+ int ust_consumerd64_fd = -1;
+ int ust_consumerd32_fd = -1;
+ static const char *consumerd32_path =
+       __stringify(CONFIG_CONSUMERD32_PATH);
+ static const char *consumerd64_path =
+       __stringify(CONFIG_CONSUMERD64_PATH);
+ static const char *consumerd32_libdir =
+       __stringify(CONFIG_CONSUMERD32_LIBDIR);
+ static const char *consumerd64_libdir =
+       __stringify(CONFIG_CONSUMERD64_LIBDIR);
+ static
+ void setup_consumerd_path(void)
+ {
+       const char *path, *libdir;
+       /*
+        * Allow INSTALL_BIN_PATH to be used as a target path for the
+        * native architecture size consumer if CONFIG_CONSUMER*_PATH
+        * has not been defined.
+        */
+ #if (CAA_BITS_PER_LONG == 32)
+       if (!consumerd32_path[0]) {
+               consumerd32_path = INSTALL_BIN_PATH "/" CONSUMERD_FILE;
+       }
+       if (!consumerd32_libdir[0]) {
+               consumerd32_libdir = INSTALL_LIB_PATH;
+       }
+ #elif (CAA_BITS_PER_LONG == 64)
+       if (!consumerd64_path[0]) {
+               consumerd64_path = INSTALL_BIN_PATH "/" CONSUMERD_FILE;
+       }
+       if (!consumerd64_libdir[0]) {
+               consumerd64_libdir = INSTALL_LIB_PATH;
+       }
+ #else
+ #error "Unknown bitness"
+ #endif
+       /*
+        * runtime env. var. overrides the build default.
+        */
+       path = getenv("LTTNG_CONSUMERD32_PATH");
+       if (path) {
+               consumerd32_path = path;
+       }
+       path = getenv("LTTNG_CONSUMERD64_PATH");
+       if (path) {
+               consumerd64_path = path;
+       }
+       libdir = getenv("LTTNG_TOOLS_CONSUMERD32_LIBDIR");
+       if (libdir) {
+               consumerd32_libdir = libdir;
+       }
+       libdir = getenv("LTTNG_TOOLS_CONSUMERD64_LIBDIR");
+       if (libdir) {
+               consumerd64_libdir = libdir;
+       }
+ }
  /*
   * Create a poll set with O_CLOEXEC and add the thread quit pipe to the set.
   */
@@@ -282,21 -352,22 +354,22 @@@ error
   */
  static void teardown_kernel_session(struct ltt_session *session)
  {
-       if (session->kernel_session != NULL) {
-               DBG("Tearing down kernel session");
+       if (!session->kernel_session) {
+               DBG3("No kernel session when tearingdown session");
+               return;
+       }
  
-               /*
-                * If a custom kernel consumer was registered, close the socket before
-                * tearing down the complete kernel session structure
-                */
-               if (session->kernel_session->consumer_fd != kconsumer_data.cmd_sock) {
-                       lttcomm_close_unix_sock(session->kernel_session->consumer_fd);
-               }
+       DBG("Tearing down kernel session");
  
-               trace_kernel_destroy_session(session->kernel_session);
-               /* Extra precaution */
-               session->kernel_session = NULL;
+       /*
+        * If a custom kernel consumer was registered, close the socket before
+        * tearing down the complete kernel session structure
+        */
+       if (session->kernel_session->consumer_fd != kconsumer_data.cmd_sock) {
+               lttcomm_close_unix_sock(session->kernel_session->consumer_fd);
        }
+       trace_kernel_destroy_session(session->kernel_session);
  }
  
  /*
   */
  static void teardown_ust_session(struct ltt_session *session)
  {
+       int ret;
+       if (!session->ust_session) {
+               DBG3("No UST session when tearingdown session");
+               return;
+       }
        DBG("Tearing down UST session(s)");
  
+       ret = ust_app_destroy_trace_all(session->ust_session);
+       if (ret) {
+               ERR("Error in ust_app_destroy_trace_all");
+       }
        trace_ust_destroy_session(session->ust_session);
  }
  
@@@ -340,12 -423,6 +425,6 @@@ static void cleanup(void
  
        DBG("Cleaning up");
  
-       /* <fun> */
-       MSG("%c[%d;%dm*** assert failed *** ==> %c[%dm%c[%d;%dm"
-               "Matthew, BEET driven development works!%c[%dm",
-               27, 1, 31, 27, 0, 27, 1, 33, 27, 0);
-       /* </fun> */
        if (is_root) {
                DBG("Removing %s directory", LTTNG_RUNDIR);
                ret = asprintf(&cmd, "rm -rf " LTTNG_RUNDIR);
        close(thread_quit_pipe[0]);
        close(thread_quit_pipe[1]);
  
 +      /* 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> */
+       MSG("%c[%d;%dm*** assert failed :-) *** ==> %c[%dm%c[%d;%dm"
+                       "Matthew, BEET driven development works!%c[%dm",
+                       27, 1, 31, 27, 0, 27, 1, 33, 27, 0);
+       /* </fun> */
  }
  
  /*
@@@ -580,8 -644,6 +665,8 @@@ static int notify_ust_apps(int active
  
        DBG("Notifying applications of session daemon state: %d", active);
  
 +      tracepoint(ust_notify_apps_start);
 +
        /* See shm.c for this call implying mmap, shm and futex calls */
        wait_shm_mmap = shm_ust_get_mmap(wait_shm_path, is_root);
        if (wait_shm_mmap == NULL) {
        /* Wake waiting process */
        futex_wait_update((int32_t *) wait_shm_mmap, active);
  
 +      tracepoint(ust_notify_apps_stop);
 +
        /* Apps notified successfully */
        return 0;
  
@@@ -613,9 -673,9 +698,9 @@@ static int setup_lttng_msg(struct comma
  
        buf_size = size;
  
-       cmd_ctx->llm = malloc(sizeof(struct lttcomm_lttng_msg) + buf_size);
+       cmd_ctx->llm = zmalloc(sizeof(struct lttcomm_lttng_msg) + buf_size);
        if (cmd_ctx->llm == NULL) {
-               perror("malloc");
+               perror("zmalloc");
                ret = -ENOMEM;
                goto error;
        }
@@@ -736,6 -796,21 +821,21 @@@ error
        return ret;
  }
  
+ /*
+  * For each tracing session, update newly registered apps.
+  */
+ static void update_ust_app(int app_sock)
+ {
+       struct ltt_session *sess, *stmp;
+       /* For all tracing session(s) */
+       cds_list_for_each_entry_safe(sess, stmp, &session_list_ptr->head, list) {
+               if (sess->ust_session) {
+                       ust_app_global_update(sess->ust_session, app_sock);
+               }
+       }
+ }
  /*
   * This thread manage event coming from the kernel.
   *
@@@ -749,8 -824,6 +849,8 @@@ static void *thread_manage_kernel(void 
        char tmp;
        struct lttng_poll_event events;
  
 +      tracepoint(sessiond_th_kern_start);
 +
        DBG("Thread manage kernel started");
  
        ret = create_thread_poll_set(&events, 2);
                /* Zeroed the poll events */
                lttng_poll_reset(&events);
  
 +              tracepoint(sessiond_th_kern_poll);
 +
                /* Poll infinite value of time */
                ret = lttng_poll_wait(&events, -1);
                if (ret < 0) {
@@@ -855,8 -926,6 +955,8 @@@ static void *thread_manage_consumer(voi
        struct lttng_poll_event events;
        struct consumer_data *consumer_data = data;
  
 +      tracepoint(sessiond_th_kcon_start);
 +
        DBG("[thread] Manage consumer started");
  
        ret = lttcomm_listen_unix_sock(consumer_data->err_sock);
  
        nb_fd = LTTNG_POLL_GETNB(&events);
  
 +      tracepoint(sessiond_th_kcon_poll);
 +
        /* Inifinite blocking call, waiting for transmission */
        ret = lttng_poll_wait(&events, -1);
        if (ret < 0) {
@@@ -1014,8 -1081,6 +1114,8 @@@ static void *thread_manage_apps(void *d
        struct ust_command ust_cmd;
        struct lttng_poll_event events;
  
 +      tracepoint(sessiond_th_apps_start);
 +
        DBG("[thread] Manage application started");
  
        rcu_register_thread();
  
                DBG("Apps thread polling on %d fds", nb_fd);
  
 +              tracepoint(sessiond_th_apps_poll);
 +
                /* Inifinite blocking call, waiting for transmission */
                ret = lttng_poll_wait(&events, -1);
                if (ret < 0) {
                                        ERR("Apps command pipe error");
                                        goto error;
                                } else if (revents & LPOLLIN) {
 +                                      tracepoint(ust_register_read_start);
                                        /* 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");
                                                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);
-                                       if (ret < 0) {
-                                               /* Only critical ENOMEM error can be returned here */
+                                       if (ret == -ENOMEM) {
                                                goto error;
+                                       } else if (ret < 0) {
+                                               break;
                                        }
 +                                      tracepoint(ust_register_add_stop);
  
 +                                      tracepoint(ust_register_done_start);
+                                       /*
+                                        * Add channel(s) and event(s) to newly registered apps
+                                        * from lttng global UST domain.
+                                        */
+                                       update_ust_app(ust_cmd.sock);
                                        ret = ustctl_register_done(ust_cmd.sock);
                                        if (ret < 0) {
                                                /*
                                                DBG("Apps with sock %d added to poll set",
                                                                ust_cmd.sock);
                                        }
 -
 +                                      tracepoint(ust_register_done_stop);
                                        break;
                                }
                        } else {
                                                goto error;
                                        }
  
-                                       /* Socket closed */
+                                       /* Socket closed on remote end. */
                                        ust_app_unregister(pollfd);
                                        break;
                                }
@@@ -1149,8 -1214,6 +1256,8 @@@ static void *thread_dispatch_ust_regist
        struct cds_wfq_node *node;
        struct ust_command *ust_cmd = NULL;
  
 +      tracepoint(sessiond_th_dispatch_start);
 +
        DBG("[thread] Dispatch UST command started");
  
        while (!dispatch_thread_exit) {
                futex_nto1_prepare(&ust_cmd_queue.futex);
  
                do {
 +                      tracepoint(sessiond_th_dispatch_block);
 +
                        /* Dequeue command for registration */
                        node = cds_wfq_dequeue_blocking(&ust_cmd_queue.queue);
                        if (node == NULL) {
                                break;
                        }
  
 +                      tracepoint(ust_dispatch_register_start);
 +
                        ust_cmd = caa_container_of(node, struct ust_command, node);
  
                        DBG("Dispatching UST registration pid:%d ppid:%d uid:%d"
                        free(ust_cmd);
                } while (node != NULL);
  
 +              tracepoint(ust_dispatch_register_stop);
 +
                /* Futex wait on queue. Blocking call on futex() */
                futex_nto1_wait(&ust_cmd_queue.futex);
        }
@@@ -1225,8 -1282,6 +1332,8 @@@ static void *thread_registration_apps(v
         */
        struct ust_command *ust_cmd = NULL;
  
 +      tracepoint(sessiond_th_reg_start);
 +
        DBG("[thread] Manage application registration started");
  
        ret = lttcomm_listen_unix_sock(apps_sock);
        while (1) {
                DBG("Accepting application registration");
  
 +              tracepoint(sessiond_th_reg_poll);
 +
                nb_fd = LTTNG_POLL_GETNB(&events);
  
                /* Inifinite blocking call, waiting for transmission */
                                        ERR("Register apps socket poll error");
                                        goto error;
                                } else if (revents & LPOLLIN) {
 +                                      /* Registration starts here. Recording cycles */
 +                                      tracepoint(ust_register_start);
 +
                                        sock = lttcomm_accept_unix_sock(apps_sock);
                                        if (sock < 0) {
                                                goto error;
                                        }
  
                                        /* Create UST registration command for enqueuing */
-                                       ust_cmd = malloc(sizeof(struct ust_command));
+                                       ust_cmd = zmalloc(sizeof(struct ust_command));
                                        if (ust_cmd == NULL) {
-                                               perror("ust command malloc");
+                                               perror("ust command zmalloc");
                                                goto error;
                                        }
  
                                         * barrier with the exchange in cds_wfq_enqueue.
                                         */
                                        futex_nto1_wake(&ust_cmd_queue.futex);
 +
 +                                      tracepoint(ust_register_stop);
                                }
                        }
                }
@@@ -1477,12 -1525,97 +1584,97 @@@ static pid_t spawn_consumerd(struct con
                switch (consumer_data->type) {
                case LTTNG_CONSUMER_KERNEL:
                        execl(INSTALL_BIN_PATH "/lttng-consumerd",
-                                       "lttng-consumerd", verbosity, "-k", NULL);
+                                       "lttng-consumerd", verbosity, "-k",
+                                       "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
+                                       "--consumerd-err-sock", consumer_data->err_unix_sock_path,
+                                       NULL);
                        break;
-               case LTTNG_CONSUMER_UST:
-                       execl(INSTALL_BIN_PATH "/lttng-consumerd",
-                                       "lttng-consumerd", verbosity, "-u", NULL);
+               case LTTNG_CONSUMER64_UST:
+               {
+                       char *tmpnew = NULL;
+                       if (consumerd64_libdir[0] != '\0') {
+                               char *tmp;
+                               size_t tmplen;
+                               tmp = getenv("LD_LIBRARY_PATH");
+                               if (!tmp) {
+                                       tmp = "";
+                               }
+                               tmplen = strlen("LD_LIBRARY_PATH=")
+                                       + strlen(consumerd64_libdir) + 1 /* : */ + strlen(tmp);
+                               tmpnew = zmalloc(tmplen + 1 /* \0 */);
+                               if (!tmpnew) {
+                                       ret = -ENOMEM;
+                                       goto error;
+                               }
+                               strcpy(tmpnew, "LD_LIBRARY_PATH=");
+                               strcat(tmpnew, consumerd64_libdir);
+                               if (tmp[0] != '\0') {
+                                       strcat(tmpnew, ":");
+                                       strcat(tmpnew, tmp);
+                               }
+                               ret = putenv(tmpnew);
+                               if (ret) {
+                                       ret = -errno;
+                                       goto error;
+                               }
+                       }
+                       ret = execl(consumerd64_path, verbosity, "-u",
+                                       "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
+                                       "--consumerd-err-sock", consumer_data->err_unix_sock_path,
+                                       NULL);
+                       if (consumerd64_libdir[0] != '\0') {
+                               free(tmpnew);
+                       }
+                       if (ret) {
+                               goto error;
+                       }
+                       break;
+               }
+               case LTTNG_CONSUMER32_UST:
+               {
+                       char *tmpnew = NULL;
+                       if (consumerd32_libdir[0] != '\0') {
+                               char *tmp;
+                               size_t tmplen;
+                               tmp = getenv("LD_LIBRARY_PATH");
+                               if (!tmp) {
+                                       tmp = "";
+                               }
+                               tmplen = strlen("LD_LIBRARY_PATH=")
+                                       + strlen(consumerd32_libdir) + 1 /* : */ + strlen(tmp);
+                               tmpnew = zmalloc(tmplen + 1 /* \0 */);
+                               if (!tmpnew) {
+                                       ret = -ENOMEM;
+                                       goto error;
+                               }
+                               strcpy(tmpnew, "LD_LIBRARY_PATH=");
+                               strcat(tmpnew, consumerd32_libdir);
+                               if (tmp[0] != '\0') {
+                                       strcat(tmpnew, ":");
+                                       strcat(tmpnew, tmp);
+                               }
+                               ret = putenv(tmpnew);
+                               if (ret) {
+                                       ret = -errno;
+                                       goto error;
+                               }
+                       }
+                       ret = execl(consumerd32_path, verbosity, "-u",
+                                       "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
+                                       "--consumerd-err-sock", consumer_data->err_unix_sock_path,
+                                       NULL);
+                       if (consumerd32_libdir[0] != '\0') {
+                               free(tmpnew);
+                       }
+                       if (ret) {
+                               goto error;
+                       }
                        break;
+               }
                default:
                        perror("unknown consumer type");
                        exit(EXIT_FAILURE);
                perror("start consumer fork");
                ret = -errno;
        }
+ error:
        return ret;
  }
  
@@@ -1733,10 -1867,7 +1926,7 @@@ static int create_ust_session(struct lt
  
        DBG("Creating UST session");
  
-       session_lock_list();
-       uid = session_list_ptr->count;
-       session_unlock_list();
+       uid = session->uid;
        lus = trace_ust_create_session(session->path, uid, domain);
        if (lus == NULL) {
                ret = LTTCOMM_UST_SESS_FAIL;
                /* No ustctl for the global UST domain */
                break;
        default:
+               ERR("Unknown UST domain on create session %d", domain->type);
                goto error;
        }
        session->ust_session = lus;
@@@ -1825,6 -1957,7 +2016,7 @@@ static void list_lttng_sessions(struct 
                sessions[i].path[PATH_MAX - 1] = '\0';
                strncpy(sessions[i].name, session->name, NAME_MAX);
                sessions[i].name[NAME_MAX - 1] = '\0';
+               sessions[i].enabled = session->enabled;
                i++;
        }
  }
  /*
   * Fill lttng_channel array of all channels.
   */
- static void list_lttng_channels(struct ltt_session *session,
+ static void list_lttng_channels(int domain, struct ltt_session *session,
                struct lttng_channel *channels)
  {
        int i = 0;
  
        DBG("Listing channels for session %s", session->name);
  
-       /* Kernel channels */
-       if (session->kernel_session != NULL) {
-               cds_list_for_each_entry(kchan,
-                               &session->kernel_session->channel_list.head, list) {
-                       /* Copy lttng_channel struct to array */
-                       memcpy(&channels[i], kchan->channel, sizeof(struct lttng_channel));
-                       channels[i].enabled = kchan->enabled;
+       switch (domain) {
+       case LTTNG_DOMAIN_KERNEL:
+               /* Kernel channels */
+               if (session->kernel_session != NULL) {
+                       cds_list_for_each_entry(kchan,
+                                       &session->kernel_session->channel_list.head, list) {
+                               /* Copy lttng_channel struct to array */
+                               memcpy(&channels[i], kchan->channel, sizeof(struct lttng_channel));
+                               channels[i].enabled = kchan->enabled;
+                               i++;
+                       }
+               }
+               break;
+       case LTTNG_DOMAIN_UST:
+       {
+               struct cds_lfht_iter iter;
+               struct ltt_ust_channel *uchan;
+               cds_lfht_for_each_entry(session->ust_session->domain_global.channels,
+                               &iter, uchan, node) {
+                       strncpy(channels[i].name, uchan->name, LTTNG_SYMBOL_NAME_LEN);
+                       channels[i].attr.overwrite = uchan->attr.overwrite;
+                       channels[i].attr.subbuf_size = uchan->attr.subbuf_size;
+                       channels[i].attr.num_subbuf = uchan->attr.num_subbuf;
+                       channels[i].attr.switch_timer_interval =
+                               uchan->attr.switch_timer_interval;
+                       channels[i].attr.read_timer_interval =
+                               uchan->attr.read_timer_interval;
+                       channels[i].enabled = uchan->enabled;
+                       switch (uchan->attr.output) {
+                       case LTTNG_UST_MMAP:
+                       default:
+                               channels[i].attr.output = LTTNG_EVENT_MMAP;
+                               break;
+                       }
                        i++;
                }
+               break;
+       }
+       default:
+               break;
        }
+ }
  
-       /* TODO: Missing UST listing */
+ /*
+  * Create a list of ust global domain events.
+  */
+ static int list_lttng_ust_global_events(char *channel_name,
+               struct ltt_ust_domain_global *ust_global, struct lttng_event **events)
+ {
+       int i = 0, ret = 0;
+       unsigned int nb_event = 0;
+       struct cds_lfht_iter iter;
+       struct cds_lfht_node *node;
+       struct ltt_ust_channel *uchan;
+       struct ltt_ust_event *uevent;
+       struct lttng_event *tmp;
+       DBG("Listing UST global events for channel %s", channel_name);
+       rcu_read_lock();
+       node = hashtable_lookup(ust_global->channels, (void *) channel_name,
+                       strlen(channel_name), &iter);
+       if (node == NULL) {
+               ret = -LTTCOMM_UST_CHAN_NOT_FOUND;
+               goto error;
+       }
+       uchan = caa_container_of(node, struct ltt_ust_channel, node);
+       nb_event += hashtable_get_count(uchan->events);
+       if (nb_event == 0) {
+               ret = nb_event;
+               goto error;
+       }
+       DBG3("Listing UST global %d events", nb_event);
+       tmp = zmalloc(nb_event * sizeof(struct lttng_event));
+       if (tmp == NULL) {
+               ret = -LTTCOMM_FATAL;
+               goto error;
+       }
+       cds_lfht_for_each_entry(uchan->events, &iter, uevent, node) {
+               strncpy(tmp[i].name, uevent->attr.name, LTTNG_SYMBOL_NAME_LEN);
+               tmp[i].name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
+               tmp[i].enabled = uevent->enabled;
+               switch (uevent->attr.instrumentation) {
+               case LTTNG_UST_TRACEPOINT:
+                       tmp[i].type = LTTNG_EVENT_TRACEPOINT;
+                       break;
+               case LTTNG_UST_PROBE:
+                       tmp[i].type = LTTNG_EVENT_PROBE;
+                       break;
+               case LTTNG_UST_FUNCTION:
+                       tmp[i].type = LTTNG_EVENT_FUNCTION;
+                       break;
+               case LTTNG_UST_TRACEPOINT_LOGLEVEL:
+                       /* TODO */
+                       ret = -LTTCOMM_NOT_IMPLEMENTED;
+                       goto error;
+                       break;
+               }
+               i++;
+       }
+       ret = nb_event;
+       *events = tmp;
+ error:
+       rcu_read_unlock();
+       return ret;
  }
  
  /*
-  * Fill lttng_event array of all events in the channel.
+  * Fill lttng_event array of all kernel events in the channel.
   */
- static void list_lttng_events(struct ltt_kernel_channel *kchan,
-               struct lttng_event *events)
+ static int list_lttng_kernel_events(char *channel_name,
+               struct ltt_kernel_session *kernel_session, struct lttng_event **events)
  {
-       /*
-        * TODO: This is ONLY kernel. Need UST support.
-        */
-       int i = 0;
+       int i = 0, ret;
+       unsigned int nb_event;
        struct ltt_kernel_event *event;
+       struct ltt_kernel_channel *kchan;
+       kchan = trace_kernel_get_channel_by_name(channel_name, kernel_session);
+       if (kchan == NULL) {
+               ret = LTTCOMM_KERN_CHAN_NOT_FOUND;
+               goto error;
+       }
+       nb_event = kchan->event_count;
  
        DBG("Listing events for channel %s", kchan->channel->name);
  
+       if (nb_event == 0) {
+               ret = nb_event;
+               goto error;
+       }
+       *events = zmalloc(nb_event * sizeof(struct lttng_event));
+       if (*events == NULL) {
+               ret = LTTCOMM_FATAL;
+               goto error;
+       }
        /* Kernel channels */
        cds_list_for_each_entry(event, &kchan->events_list.head , list) {
-               strncpy(events[i].name, event->event->name, LTTNG_SYMBOL_NAME_LEN);
-               events[i].name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
-               events[i].enabled = event->enabled;
+               strncpy((*events)[i].name, event->event->name, LTTNG_SYMBOL_NAME_LEN);
+               (*events)[i].name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
+               (*events)[i].enabled = event->enabled;
                switch (event->event->instrumentation) {
                        case LTTNG_KERNEL_TRACEPOINT:
-                               events[i].type = LTTNG_EVENT_TRACEPOINT;
+                               (*events)[i].type = LTTNG_EVENT_TRACEPOINT;
                                break;
                        case LTTNG_KERNEL_KPROBE:
                        case LTTNG_KERNEL_KRETPROBE:
-                               events[i].type = LTTNG_EVENT_PROBE;
-                               memcpy(&events[i].attr.probe, &event->event->u.kprobe,
+                               (*events)[i].type = LTTNG_EVENT_PROBE;
+                               memcpy(&(*events)[i].attr.probe, &event->event->u.kprobe,
                                                sizeof(struct lttng_kernel_kprobe));
                                break;
                        case LTTNG_KERNEL_FUNCTION:
-                               events[i].type = LTTNG_EVENT_FUNCTION;
-                               memcpy(&events[i].attr.ftrace, &event->event->u.ftrace,
+                               (*events)[i].type = LTTNG_EVENT_FUNCTION;
+                               memcpy(&((*events)[i].attr.ftrace), &event->event->u.ftrace,
                                                sizeof(struct lttng_kernel_function));
                                break;
                        case LTTNG_KERNEL_NOOP:
-                               events[i].type = LTTNG_EVENT_NOOP;
+                               (*events)[i].type = LTTNG_EVENT_NOOP;
                                break;
                        case LTTNG_KERNEL_SYSCALL:
-                               events[i].type = LTTNG_EVENT_SYSCALL;
+                               (*events)[i].type = LTTNG_EVENT_SYSCALL;
                                break;
                        case LTTNG_KERNEL_ALL:
                                assert(0);
                }
                i++;
        }
+       return nb_event;
+ error:
+       return ret;
  }
  
  /*
@@@ -1909,22 -2168,58 +2227,58 @@@ static int cmd_disable_channel(struct l
                int domain, char *channel_name)
  {
        int ret;
+       struct ltt_ust_session *usess;
+       usess = session->ust_session;
  
        switch (domain) {
-               case LTTNG_DOMAIN_KERNEL:
-                       ret = channel_kernel_disable(session->kernel_session,
-                                       channel_name);
-                       if (ret != LTTCOMM_OK) {
-                               goto error;
-                       }
+       case LTTNG_DOMAIN_KERNEL:
+       {
+               ret = channel_kernel_disable(session->kernel_session,
+                               channel_name);
+               if (ret != LTTCOMM_OK) {
+                       goto error;
+               }
  
-                       kernel_wait_quiescent(kernel_tracer_fd);
-                       break;
-               case LTTNG_DOMAIN_UST_PID:
+               kernel_wait_quiescent(kernel_tracer_fd);
+               break;
+       }
+       case LTTNG_DOMAIN_UST:
+       {
+               struct ltt_ust_channel *uchan;
+               /* Get channel in global UST domain HT */
+               uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
+                               channel_name);
+               if (uchan == NULL) {
+                       ret = LTTCOMM_UST_CHAN_NOT_FOUND;
+                       goto error;
+               }
+               /* Already disabled */
+               if (!uchan->enabled) {
+                       DBG2("UST channel %s already disabled", channel_name);
                        break;
-               default:
-                       ret = LTTCOMM_UNKNOWN_DOMAIN;
+               }
+               ret = ust_app_disable_channel_glb(usess, uchan);
+               if (ret < 0) {
+                       ret = LTTCOMM_UST_DISABLE_FAIL;
                        goto error;
+               }
+               uchan->enabled = 0;
+               break;
+       }
+       case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN:
+       case LTTNG_DOMAIN_UST_EXEC_NAME:
+       case LTTNG_DOMAIN_UST_PID:
+               ret = LTTCOMM_NOT_IMPLEMENTED;
+               goto error;
+       default:
+               ret = LTTCOMM_UNKNOWN_DOMAIN;
+               goto error;
        }
  
        ret = LTTCOMM_OK;
@@@ -1971,14 -2266,14 +2325,14 @@@ error
   * Command LTTNG_ENABLE_CHANNEL processed by the client thread.
   */
  static int cmd_enable_channel(struct ltt_session *session,
-               struct lttng_domain *domain, struct lttng_channel *attr)
+               int domain, struct lttng_channel *attr)
  {
        int ret;
        struct ltt_ust_session *usess = session->ust_session;
  
-       DBG("Enabling channel %s for session %s", session->name, attr->name);
+       DBG("Enabling channel %s for session %s", attr->name, session->name);
  
-       switch (domain->type) {
+       switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
        {
                struct ltt_kernel_channel *kchan;
                                ret = LTTCOMM_UST_CHAN_FAIL;
                                goto error;
                        }
+                       /* Add channel to all registered applications */
+                       ret = ust_app_create_channel_glb(usess, uchan);
+                       if (ret != 0) {
+                               ret = LTTCOMM_UST_CHAN_FAIL;
+                               goto error;
+                       }
                        rcu_read_lock();
                        hashtable_add_unique(usess->domain_global.channels, &uchan->node);
                        rcu_read_unlock();
                        DBG2("UST channel %s added to global domain HT", attr->name);
                } else {
-                       ret = LTTCOMM_UST_CHAN_EXIST;
-                       goto error;
-               }
+                       /* If already enabled, everything is OK */
+                       if (uchan->enabled) {
+                               break;
+                       }
  
-               ret = ust_app_add_channel(usess, uchan);
-               if (ret != LTTCOMM_OK) {
-                       goto error;
+                       ret = ust_app_enable_channel_glb(usess, uchan);
+                       if (ret < 0) {
+                               if (ret != -EEXIST) {
+                                       ret = LTTCOMM_UST_CHAN_ENABLE_FAIL;
+                                       goto error;
+                               } else {
+                                       ret = LTTCOMM_OK;
+                               }
+                       }
                }
  
+               uchan->enabled = 1;
                break;
        }
+       case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN:
+       case LTTNG_DOMAIN_UST_EXEC_NAME:
        case LTTNG_DOMAIN_UST_PID:
-       {
-               /*
-               int sock;
-               struct ltt_ust_channel *uchan;
-               struct ltt_ust_session *usess;
-               struct ust_app *app;
-               usess = trace_ust_get_session_by_pid(&session->ust_session_list,
-                               domain->attr.pid);
-               if (usess == NULL) {
-                       ret = LTTCOMM_UST_CHAN_NOT_FOUND;
-                       goto error;
-               }
-               app = ust_app_get_by_pid(domain->attr.pid);
-               if (app == NULL) {
-                       ret = LTTCOMM_APP_NOT_FOUND;
-                       goto error;
-               }
-               sock = app->sock;
-               uchan = trace_ust_get_channel_by_name(attr->name, usess);
-               if (uchan == NULL) {
-                       ret = channel_ust_create(usess, attr, sock);
-               } else {
-                       ret = channel_ust_enable(usess, uchan, sock);
-               }
-               if (ret != LTTCOMM_OK) {
-                       goto error;
-               }
-               ret = copy_ust_channel_to_app(usess, attr, app);
-               if (ret != LTTCOMM_OK) {
-                       goto error;
-               }
-               DBG("UST channel %s created for app sock %d with pid %d",
-                               attr->name, app->sock, domain->attr.pid);
-               */
                ret = LTTCOMM_NOT_IMPLEMENTED;
                goto error;
-       }
        default:
                ret = LTTCOMM_UNKNOWN_DOMAIN;
                goto error;
@@@ -2097,15 -2371,17 +2430,17 @@@ static int cmd_disable_event(struct ltt
        case LTTNG_DOMAIN_KERNEL:
        {
                struct ltt_kernel_channel *kchan;
+               struct ltt_kernel_session *ksess;
  
-               kchan = trace_kernel_get_channel_by_name(channel_name,
-                               session->kernel_session);
+               ksess = session->kernel_session;
+               kchan = trace_kernel_get_channel_by_name(channel_name, ksess);
                if (kchan == NULL) {
                        ret = LTTCOMM_KERN_CHAN_NOT_FOUND;
                        goto error;
                }
  
-               ret = event_kernel_disable_tracepoint(session->kernel_session, kchan, event_name);
+               ret = event_kernel_disable_tracepoint(ksess, kchan, event_name);
                if (ret != LTTCOMM_OK) {
                        goto error;
                }
                break;
        }
        case LTTNG_DOMAIN_UST:
+       {
+               struct ltt_ust_session *usess;
+               struct ltt_ust_channel *uchan;
+               struct ltt_ust_event *uevent;
+               usess = session->ust_session;
+               uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
+                               channel_name);
+               if (uchan == NULL) {
+                       ret = LTTCOMM_UST_CHAN_NOT_FOUND;
+                       goto error;
+               }
+               uevent = trace_ust_find_event_by_name(uchan->events, event_name);
+               if (uevent == NULL) {
+                       ret = LTTCOMM_UST_EVENT_NOT_FOUND;
+                       goto error;
+               }
+               ret = ust_app_disable_event_glb(usess, uchan, uevent);
+               if (ret < 0) {
+                       ret = LTTCOMM_UST_DISABLE_FAIL;
+                       goto error;
+               }
+               uevent->enabled = 0;
+               DBG2("Disable UST event %s in channel %s completed", event_name,
+                               channel_name);
+               break;
+       }
        case LTTNG_DOMAIN_UST_EXEC_NAME:
        case LTTNG_DOMAIN_UST_PID:
        case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN:
        default:
-               /* TODO: Other UST domains */
                ret = LTTCOMM_NOT_IMPLEMENTED;
                goto error;
        }
@@@ -2136,26 -2444,57 +2503,57 @@@ static int cmd_disable_event_all(struc
                char *channel_name)
  {
        int ret;
-       struct ltt_kernel_channel *kchan;
  
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
-               kchan = trace_kernel_get_channel_by_name(channel_name,
-                               session->kernel_session);
+       {
+               struct ltt_kernel_session *ksess;
+               struct ltt_kernel_channel *kchan;
+               ksess = session->kernel_session;
+               kchan = trace_kernel_get_channel_by_name(channel_name, ksess);
                if (kchan == NULL) {
                        ret = LTTCOMM_KERN_CHAN_NOT_FOUND;
                        goto error;
                }
  
-               ret = event_kernel_disable_all(session->kernel_session, kchan);
+               ret = event_kernel_disable_all(ksess, kchan);
                if (ret != LTTCOMM_OK) {
                        goto error;
                }
  
                kernel_wait_quiescent(kernel_tracer_fd);
                break;
+       }
+       case LTTNG_DOMAIN_UST:
+       {
+               struct ltt_ust_session *usess;
+               struct ltt_ust_channel *uchan;
+               usess = session->ust_session;
+               uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
+                               channel_name);
+               if (uchan == NULL) {
+                       ret = LTTCOMM_UST_CHAN_NOT_FOUND;
+                       goto error;
+               }
+               ret = ust_app_disable_all_event_glb(usess, uchan);
+               if (ret < 0) {
+                       ret = LTTCOMM_UST_DISABLE_FAIL;
+                       goto error;
+               }
+               DBG2("Disable all UST event in channel %s completed", channel_name);
+               break;
+       }
+       case LTTNG_DOMAIN_UST_EXEC_NAME:
+       case LTTNG_DOMAIN_UST_PID:
+       case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN:
        default:
-               /* TODO: Userspace tracing */
                ret = LTTCOMM_NOT_IMPLEMENTED;
                goto error;
        }
@@@ -2185,21 -2524,18 +2583,18 @@@ static int cmd_add_context(struct ltt_s
                break;
        case LTTNG_DOMAIN_UST:
        {
-               /*
-               struct ltt_ust_session *usess;
+               struct ltt_ust_session *usess = session->ust_session;
  
-               cds_list_for_each_entry(usess, &session->ust_session_list.head, list) {
-                       ret = context_ust_add(usess, ctx,
-                                       event_name, channel_name, domain);
-                       if (ret != LTTCOMM_OK) {
-                               goto error;
-                       }
+               ret = context_ust_add(usess, domain, ctx, event_name, channel_name);
+               if (ret != LTTCOMM_OK) {
+                       goto error;
                }
                break;
-               */
        }
+       case LTTNG_DOMAIN_UST_EXEC_NAME:
+       case LTTNG_DOMAIN_UST_PID:
+       case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN:
        default:
-               /* TODO: UST other domains */
                ret = LTTCOMM_NOT_IMPLEMENTED;
                goto error;
        }
@@@ -2239,8 -2575,10 +2634,10 @@@ static int cmd_enable_event(struct ltt_
                        ret = channel_kernel_create(session->kernel_session,
                                        attr, kernel_poll_pipe[1]);
                        if (ret != LTTCOMM_OK) {
+                               free(attr);
                                goto error;
                        }
+                       free(attr);
                }
  
                /* Get the newly created kernel channel pointer */
        }
        case LTTNG_DOMAIN_UST:
        {
+               struct lttng_channel *attr;
                struct ltt_ust_channel *uchan;
-               struct ltt_ust_event *uevent;
  
+               /* Get channel from global UST domain */
                uchan = trace_ust_find_channel_by_name(usess->domain_global.channels,
                                channel_name);
                if (uchan == NULL) {
-                       /* TODO: Create default channel */
-                       ret = LTTCOMM_UST_CHAN_NOT_FOUND;
-                       goto error;
-               }
+                       /* Create default channel */
+                       attr = channel_new_default_attr(domain);
+                       if (attr == NULL) {
+                               ret = LTTCOMM_FATAL;
+                               goto error;
+                       }
+                       snprintf(attr->name, NAME_MAX, "%s", channel_name);
+                       attr->name[NAME_MAX - 1] = '\0';
  
-               uevent = trace_ust_find_event_by_name(uchan->events, event->name);
-               if (uevent == NULL) {
-                       uevent = trace_ust_create_event(event);
-                       if (uevent == NULL) {
+                       /* Use the internal command enable channel */
+                       ret = cmd_enable_channel(session, domain, attr);
+                       if (ret != LTTCOMM_OK) {
+                               free(attr);
+                               goto error;
+                       }
+                       free(attr);
+                       /* Get the newly created channel reference back */
+                       uchan = trace_ust_find_channel_by_name(
+                                       usess->domain_global.channels, channel_name);
+                       if (uchan == NULL) {
+                               /* Something is really wrong */
                                ret = LTTCOMM_FATAL;
                                goto error;
                        }
                }
  
-               ret = ust_app_add_event(usess, uchan, uevent);
-               if (ret < 0) {
-                       ret = LTTCOMM_UST_ENABLE_FAIL;
+               /* At this point, the session and channel exist on the tracer */
+               ret = event_ust_enable_tracepoint(usess, domain, uchan, event);
+               if (ret != LTTCOMM_OK) {
                        goto error;
                }
                break;
@@@ -2324,15 -2677,16 +2736,16 @@@ static int cmd_enable_event_all(struct 
                        if (ret != LTTCOMM_OK) {
                                goto error;
                        }
-               }
  
-               /* Get the newly created kernel channel pointer */
-               kchan = trace_kernel_get_channel_by_name(channel_name,
-                               session->kernel_session);
-               if (kchan == NULL) {
-                       /* This sould not happen... */
-                       ret = LTTCOMM_FATAL;
-                       goto error;
+                       /* Get the newly created kernel channel pointer */
+                       kchan = trace_kernel_get_channel_by_name(channel_name,
+                                       session->kernel_session);
+                       if (kchan == NULL) {
+                               /* This sould not happen... */
+                               ret = LTTCOMM_FATAL;
+                               goto error;
+                       }
                }
  
                switch (event_type) {
                        ret = LTTCOMM_KERN_ENABLE_FAIL;
                        goto error;
                }
+               /* Manage return value */
                if (ret != LTTCOMM_OK) {
                        goto error;
                }
@@@ -2391,8 -2747,14 +2806,14 @@@ static ssize_t cmd_list_tracepoints(in
                        goto error;
                }
                break;
+       case LTTNG_DOMAIN_UST:
+               nb_events = ust_app_list_events(events);
+               if (nb_events < 0) {
+                       ret = LTTCOMM_UST_LIST_FAIL;
+                       goto error;
+               }
+               break;
        default:
-               /* TODO: Userspace listing */
                ret = LTTCOMM_NOT_IMPLEMENTED;
                goto error;
        }
@@@ -2411,10 -2773,15 +2832,15 @@@ static int cmd_start_trace(struct ltt_s
  {
        int ret;
        struct ltt_kernel_session *ksession;
-       struct ltt_ust_session *usess = session->ust_session;
+       struct ltt_ust_session *usess;
  
        /* Short cut */
        ksession = session->kernel_session;
+       usess = session->ust_session;
+       if (session->enabled)
+               return LTTCOMM_UST_START_FAIL;
+       session->enabled = 1;
  
        /* Kernel tracing */
        if (ksession != NULL) {
                kernel_wait_quiescent(kernel_tracer_fd);
        }
  
-       ret = ust_app_start_trace(usess);
-       if (ret < 0) {
-               ret = LTTCOMM_UST_START_FAIL;
-               goto error;
+       /* Flag session that trace should start automatically */
+       if (usess) {
+               usess->start_trace = 1;
+               ret = ust_app_start_trace_all(usess);
+               if (ret < 0) {
+                       ret = LTTCOMM_UST_START_FAIL;
+                       goto error;
+               }
        }
  
        ret = LTTCOMM_OK;
@@@ -2490,11 -2862,15 +2921,15 @@@ static int cmd_stop_trace(struct ltt_se
        int ret;
        struct ltt_kernel_channel *kchan;
        struct ltt_kernel_session *ksession;
-       //struct ltt_ust_session *usess;
-       //struct ltt_ust_channel *ustchan;
+       struct ltt_ust_session *usess;
  
        /* Short cut */
        ksession = session->kernel_session;
+       usess = session->ust_session;
+       if (!session->enabled)
+               return LTTCOMM_UST_START_FAIL;
+       session->enabled = 0;
  
        /* Kernel tracer */
        if (ksession != NULL) {
                kernel_wait_quiescent(kernel_tracer_fd);
        }
  
- #ifdef DISABLE
-       /* Stop each UST session */
-       DBG("Stop UST tracing");
-       cds_list_for_each_entry(usess, &session->ust_session_list.head, list) {
-               /* Flush all buffers before stopping */
-               ret = ustctl_flush_buffer(usess->sock, usess->metadata->obj);
-               if (ret < 0) {
-                       ERR("UST metadata flush failed");
-               }
+       if (usess) {
+               usess->start_trace = 0;
  
-               cds_list_for_each_entry(ustchan, &usess->channels.head, list) {
-                       ret = ustctl_flush_buffer(usess->sock, ustchan->obj);
-                       if (ret < 0) {
-                               ERR("UST flush buffer error");
-                       }
-               }
-               ret = ustctl_stop_session(usess->sock, usess->handle);
+               ret = ust_app_stop_trace_all(usess);
                if (ret < 0) {
-                       ret = LTTCOMM_KERN_STOP_FAIL;
+                       ret = LTTCOMM_UST_START_FAIL;
                        goto error;
                }
-               ustctl_wait_quiescent(usess->sock);
        }
- #endif
  
        ret = LTTCOMM_OK;
  
@@@ -2582,6 -2941,8 +3000,8 @@@ static int cmd_destroy_session(struct l
  
        /* Clean kernel session teardown */
        teardown_kernel_session(session);
+       /* UST session teardown */
+       teardown_ust_session(session);
  
        /*
         * Must notify the kernel thread here to update it's poll setin order
@@@ -2671,22 -3032,34 +3091,34 @@@ error
  static ssize_t cmd_list_domains(struct ltt_session *session,
                struct lttng_domain **domains)
  {
-       int ret;
+       int ret, index = 0;
        ssize_t nb_dom = 0;
  
        if (session->kernel_session != NULL) {
+               DBG3("Listing domains found kernel domain");
                nb_dom++;
        }
  
-       /* TODO: User-space tracer domain support */
+       if (session->ust_session != NULL) {
+               DBG3("Listing domains found UST global domain");
+               nb_dom++;
+       }
  
-       *domains = malloc(nb_dom * sizeof(struct lttng_domain));
+       *domains = zmalloc(nb_dom * sizeof(struct lttng_domain));
        if (*domains == NULL) {
                ret = -LTTCOMM_FATAL;
                goto error;
        }
  
-       (*domains)[0].type = LTTNG_DOMAIN_KERNEL;
+       if (session->kernel_session != NULL) {
+               (*domains)[index].type = LTTNG_DOMAIN_KERNEL;
+               index++;
+       }
+       if (session->ust_session != NULL) {
+               (*domains)[index].type = LTTNG_DOMAIN_UST;
+               index++;
+       }
  
        return nb_dom;
  
@@@ -2697,25 -3070,43 +3129,43 @@@ error
  /*
   * Command LTTNG_LIST_CHANNELS processed by the client thread.
   */
- static ssize_t cmd_list_channels(struct ltt_session *session,
+ static ssize_t cmd_list_channels(int domain, struct ltt_session *session,
                struct lttng_channel **channels)
  {
        int ret;
        ssize_t nb_chan = 0;
  
-       if (session->kernel_session != NULL) {
-               nb_chan += session->kernel_session->channel_count;
-       }
-       *channels = malloc(nb_chan * sizeof(struct lttng_channel));
-       if (*channels == NULL) {
-               ret = -LTTCOMM_FATAL;
+       switch (domain) {
+       case LTTNG_DOMAIN_KERNEL:
+               if (session->kernel_session != NULL) {
+                       nb_chan = session->kernel_session->channel_count;
+               }
+               DBG3("Number of kernel channels %zd", nb_chan);
+               break;
+       case LTTNG_DOMAIN_UST:
+               if (session->ust_session != NULL) {
+                       nb_chan = hashtable_get_count(
+                                       session->ust_session->domain_global.channels);
+               }
+               DBG3("Number of UST global channels %zd", nb_chan);
+               break;
+       default:
+               *channels = NULL;
+               ret = -LTTCOMM_NOT_IMPLEMENTED;
                goto error;
        }
  
-       list_lttng_channels(session, *channels);
+       if (nb_chan > 0) {
+               *channels = zmalloc(nb_chan * sizeof(struct lttng_channel));
+               if (*channels == NULL) {
+                       ret = -LTTCOMM_FATAL;
+                       goto error;
+               }
  
-       /* TODO UST support */
+               list_lttng_channels(domain, session, *channels);
+       } else {
+               *channels = NULL;
+       }
  
        return nb_chan;
  
@@@ -2726,34 -3117,33 +3176,33 @@@ error
  /*
   * Command LTTNG_LIST_EVENTS processed by the client thread.
   */
- static ssize_t cmd_list_events(struct ltt_session *session,
+ static ssize_t cmd_list_events(int domain, struct ltt_session *session,
                char *channel_name, struct lttng_event **events)
  {
-       int ret;
+       int ret = 0;
        ssize_t nb_event = 0;
-       struct ltt_kernel_channel *kchan = NULL;
  
-       if (session->kernel_session != NULL) {
-               kchan = trace_kernel_get_channel_by_name(channel_name,
-                               session->kernel_session);
-               if (kchan == NULL) {
-                       ret = -LTTCOMM_KERN_CHAN_NOT_FOUND;
-                       goto error;
+       switch (domain) {
+       case LTTNG_DOMAIN_KERNEL:
+               if (session->kernel_session != NULL) {
+                       nb_event = list_lttng_kernel_events(channel_name,
+                                       session->kernel_session, events);
+               }
+               break;
+       case LTTNG_DOMAIN_UST:
+       {
+               if (session->ust_session != NULL) {
+                       nb_event = list_lttng_ust_global_events(channel_name,
+                                       &session->ust_session->domain_global, events);
                }
-               nb_event += kchan->event_count;
+               break;
        }
-       *events = malloc(nb_event * sizeof(struct lttng_event));
-       if (*events == NULL) {
-               ret = -LTTCOMM_FATAL;
+       default:
+               ret = -LTTCOMM_NOT_IMPLEMENTED;
                goto error;
        }
  
-       list_lttng_events(kchan, *events);
-       /* TODO: User-space tracer support */
-       return nb_event;
+       ret = nb_event;
  
  error:
        return ret;
@@@ -2857,8 -3247,9 +3306,9 @@@ static int process_client_msg(struct co
                                        ret = LTTCOMM_KERN_CONSUMER_FAIL;
                                        goto error;
                                }
+                       } else {
+                               pthread_mutex_unlock(&kconsumer_data.pid_mutex);
                        }
-                       pthread_mutex_unlock(&kconsumer_data.pid_mutex);
                }
                break;
        case LTTNG_DOMAIN_UST:
                                        goto error;
                                }
                        }
-                       /* Start the kernel consumer daemon */
-                       pthread_mutex_lock(&ustconsumer_data.pid_mutex);
-                       if (ustconsumer_data.pid == 0 &&
+                       /* Start the UST consumer daemons */
+                       /* 64-bit */
+                       pthread_mutex_lock(&ustconsumer64_data.pid_mutex);
+                       if (consumerd64_path[0] != '\0' &&
+                                       ustconsumer64_data.pid == 0 &&
                                        cmd_ctx->lsm->cmd_type != LTTNG_REGISTER_CONSUMER) {
-                               pthread_mutex_unlock(&ustconsumer_data.pid_mutex);
-                               ret = start_consumerd(&ustconsumer_data);
+                               pthread_mutex_unlock(&ustconsumer64_data.pid_mutex);
+                               ret = start_consumerd(&ustconsumer64_data);
                                if (ret < 0) {
-                                       ret = LTTCOMM_KERN_CONSUMER_FAIL;
+                                       ret = LTTCOMM_UST_CONSUMER64_FAIL;
+                                       ust_consumerd64_fd = -EINVAL;
                                        goto error;
                                }
  
-                               cmd_ctx->session->ust_session->consumer_fd =
-                                       ustconsumer_data.cmd_sock;
+                               ust_consumerd64_fd = ustconsumer64_data.cmd_sock;
+                       } else {
+                               pthread_mutex_unlock(&ustconsumer64_data.pid_mutex);
+                       }
+                       /* 32-bit */
+                       if (consumerd32_path[0] != '\0' &&
+                                       ustconsumer32_data.pid == 0 &&
+                                       cmd_ctx->lsm->cmd_type != LTTNG_REGISTER_CONSUMER) {
+                               pthread_mutex_unlock(&ustconsumer32_data.pid_mutex);
+                               ret = start_consumerd(&ustconsumer32_data);
+                               if (ret < 0) {
+                                       ret = LTTCOMM_UST_CONSUMER32_FAIL;
+                                       ust_consumerd32_fd = -EINVAL;
+                                       goto error;
+                               }
+                               ust_consumerd32_fd = ustconsumer32_data.cmd_sock;
+                       } else {
+                               pthread_mutex_unlock(&ustconsumer32_data.pid_mutex);
                        }
-                       pthread_mutex_unlock(&ustconsumer_data.pid_mutex);
                }
                break;
        }
        }
        case LTTNG_ENABLE_CHANNEL:
        {
-               ret = cmd_enable_channel(cmd_ctx->session, &cmd_ctx->lsm->domain,
+               ret = cmd_enable_channel(cmd_ctx->session, cmd_ctx->lsm->domain.type,
                                &cmd_ctx->lsm->u.channel.chan);
                break;
        }
        }
        case LTTNG_CREATE_SESSION:
        {
 +              tracepoint(create_session_start);
                ret = cmd_create_session(cmd_ctx->lsm->session.name,
                                cmd_ctx->lsm->session.path);
 +              tracepoint(create_session_end);
                break;
        }
        case LTTNG_DESTROY_SESSION:
        {
 +              tracepoint(destroy_session_start);
                ret = cmd_destroy_session(cmd_ctx->session,
                                cmd_ctx->lsm->session.name);
 +              tracepoint(destroy_session_end);
                break;
        }
        case LTTNG_LIST_DOMAINS:
                size_t nb_chan;
                struct lttng_channel *channels;
  
-               nb_chan = cmd_list_channels(cmd_ctx->session, &channels);
+               nb_chan = cmd_list_channels(cmd_ctx->lsm->domain.type,
+                               cmd_ctx->session, &channels);
                if (nb_chan < 0) {
                        ret = -nb_chan;
                        goto error;
        }
        case LTTNG_LIST_EVENTS:
        {
-               size_t nb_event;
+               ssize_t nb_event;
                struct lttng_event *events = NULL;
  
-               nb_event = cmd_list_events(cmd_ctx->session,
+               nb_event = cmd_list_events(cmd_ctx->lsm->domain.type, cmd_ctx->session,
                                cmd_ctx->lsm->u.list.channel_name, &events);
                if (nb_event < 0) {
                        ret = -nb_event;
@@@ -3149,8 -3555,6 +3618,8 @@@ static void *thread_manage_clients(voi
        struct command_ctx *cmd_ctx = NULL;
        struct lttng_poll_event events;
  
 +      tracepoint(sessiond_th_cli_start);
 +
        DBG("[thread] Manage client started");
  
        rcu_register_thread();
        while (1) {
                DBG("Accepting client command ...");
  
 +              tracepoint(sessiond_th_cli_poll);
 +
                nb_fd = LTTNG_POLL_GETNB(&events);
  
                /* Inifinite blocking call, waiting for transmission */
                }
  
                /* Allocate context command to process the client request */
-               cmd_ctx = malloc(sizeof(struct command_ctx));
+               cmd_ctx = zmalloc(sizeof(struct command_ctx));
                if (cmd_ctx == NULL) {
-                       perror("malloc cmd_ctx");
+                       perror("zmalloc cmd_ctx");
                        goto error;
                }
  
                /* Allocate data buffer for reception */
-               cmd_ctx->lsm = malloc(sizeof(struct lttcomm_session_msg));
+               cmd_ctx->lsm = zmalloc(sizeof(struct lttcomm_session_msg));
                if (cmd_ctx->lsm == NULL) {
-                       perror("malloc cmd_ctx->lsm");
+                       perror("zmalloc cmd_ctx->lsm");
                        goto error;
                }
  
                if (ret < 0) {
                        /*
                         * TODO: Inform client somehow of the fatal error. At
-                        * this point, ret < 0 means that a malloc failed
+                        * this point, ret < 0 means that a zmalloc failed
                         * (ENOMEM). Error detected but still accept command.
                         */
                        clean_command_ctx(&cmd_ctx);
@@@ -3315,8 -3717,14 +3784,14 @@@ static void usage(void
        fprintf(stderr, "  -a, --apps-sock PATH               Specify path for apps unix socket\n");
        fprintf(stderr, "      --kconsumerd-err-sock PATH     Specify path for the kernel consumer error socket\n");
        fprintf(stderr, "      --kconsumerd-cmd-sock PATH     Specify path for the kernel consumer command socket\n");
-       fprintf(stderr, "      --ustconsumerd-err-sock PATH   Specify path for the UST consumer error socket\n");
-       fprintf(stderr, "      --ustconsumerd-cmd-sock PATH   Specify path for the UST consumer command socket\n");
+       fprintf(stderr, "      --ustconsumerd32-err-sock PATH Specify path for the 32-bit UST consumer error socket\n");
+       fprintf(stderr, "      --ustconsumerd64-err-sock PATH Specify path for the 64-bit UST consumer error socket\n");
+       fprintf(stderr, "      --ustconsumerd32-cmd-sock PATH Specify path for the 32-bit UST consumer command socket\n");
+       fprintf(stderr, "      --ustconsumerd64-cmd-sock PATH Specify path for the 64-bit UST consumer command socket\n");
+       fprintf(stderr, "      --consumerd32-path PATH     Specify path for the 32-bit UST consumer daemon binary\n");
+       fprintf(stderr, "      --consumerd32-libdir PATH   Specify path for the 32-bit UST consumer daemon libraries\n");
+       fprintf(stderr, "      --consumerd64-path PATH     Specify path for the 64-bit UST consumer daemon binary\n");
+       fprintf(stderr, "      --consumerd64-libdir PATH   Specify path for the 64-bit UST consumer daemon libraries\n");
        fprintf(stderr, "  -d, --daemonize                    Start as a daemon.\n");
        fprintf(stderr, "  -g, --group NAME                   Specify the tracing group name. (default: tracing)\n");
        fprintf(stderr, "  -V, --version                      Show version number.\n");
@@@ -3338,8 -3746,14 +3813,14 @@@ static int parse_args(int argc, char **
                { "apps-sock", 1, 0, 'a' },
                { "kconsumerd-cmd-sock", 1, 0, 'C' },
                { "kconsumerd-err-sock", 1, 0, 'E' },
-               { "ustconsumerd-cmd-sock", 1, 0, 'D' },
-               { "ustconsumerd-err-sock", 1, 0, 'F' },
+               { "ustconsumerd32-cmd-sock", 1, 0, 'G' },
+               { "ustconsumerd32-err-sock", 1, 0, 'H' },
+               { "ustconsumerd64-cmd-sock", 1, 0, 'D' },
+               { "ustconsumerd64-err-sock", 1, 0, 'F' },
+               { "consumerd32-path", 1, 0, 'u' },
+               { "consumerd32-libdir", 1, 0, 'U' },
+               { "consumerd64-path", 1, 0, 't' },
+               { "consumerd64-libdir", 1, 0, 'T' },
                { "daemonize", 0, 0, 'd' },
                { "sig-parent", 0, 0, 'S' },
                { "help", 0, 0, 'h' },
  
        while (1) {
                int option_index = 0;
-               c = getopt_long(argc, argv, "dhqvVS" "a:c:g:s:C:E:D:F:Z",
+               c = getopt_long(argc, argv, "dhqvVS" "a:c:g:s:C:E:D:F:Z:u:t",
                                long_options, &option_index);
                if (c == -1) {
                        break;
                        opt_daemon = 1;
                        break;
                case 'g':
-                       opt_tracing_group = strdup(optarg);
+                       opt_tracing_group = optarg;
                        break;
                case 'h':
                        usage();
                        snprintf(kconsumer_data.cmd_unix_sock_path, PATH_MAX, "%s", optarg);
                        break;
                case 'F':
-                       snprintf(ustconsumer_data.err_unix_sock_path, PATH_MAX, "%s", optarg);
+                       snprintf(ustconsumer64_data.err_unix_sock_path, PATH_MAX, "%s", optarg);
                        break;
                case 'D':
-                       snprintf(ustconsumer_data.cmd_unix_sock_path, PATH_MAX, "%s", optarg);
+                       snprintf(ustconsumer64_data.cmd_unix_sock_path, PATH_MAX, "%s", optarg);
+                       break;
+               case 'H':
+                       snprintf(ustconsumer32_data.err_unix_sock_path, PATH_MAX, "%s", optarg);
+                       break;
+               case 'G':
+                       snprintf(ustconsumer32_data.cmd_unix_sock_path, PATH_MAX, "%s", optarg);
                        break;
                case 'q':
                        opt_quiet = 1;
                case 'Z':
                        opt_verbose_consumer += 1;
                        break;
+               case 'u':
+                       consumerd32_path= optarg;
+                       break;
+               case 'U':
+                       consumerd32_libdir = optarg;
+                       break;
+               case 't':
+                       consumerd64_path = optarg;
+                       break;
+               case 'T':
+                       consumerd64_libdir = optarg;
+                       break;
                default:
                        /* Unknown option or other error.
                         * Error is printed by getopt, just return */
@@@ -3532,10 -3964,17 +4031,17 @@@ static int set_permissions(void
                perror("chown");
        }
  
-       /* ustconsumer error socket path */
-       ret = chown(ustconsumer_data.err_unix_sock_path, 0, gid);
+       /* 64-bit ustconsumer error socket path */
+       ret = chown(ustconsumer64_data.err_unix_sock_path, 0, gid);
+       if (ret < 0) {
+               ERR("Unable to set group on %s", ustconsumer64_data.err_unix_sock_path);
+               perror("chown");
+       }
+       /* 32-bit ustconsumer compat32 error socket path */
+       ret = chown(ustconsumer32_data.err_unix_sock_path, 0, gid);
        if (ret < 0) {
-               ERR("Unable to set group on %s", ustconsumer_data.err_unix_sock_path);
+               ERR("Unable to set group on %s", ustconsumer32_data.err_unix_sock_path);
                perror("chown");
        }
  
@@@ -3589,21 -4028,22 +4095,22 @@@ error
  static int set_consumer_sockets(struct consumer_data *consumer_data)
  {
        int ret;
-       const char *path = consumer_data->type == LTTNG_CONSUMER_KERNEL ?
-                       KCONSUMERD_PATH : USTCONSUMERD_PATH;
-       if (strlen(consumer_data->err_unix_sock_path) == 0) {
-               snprintf(consumer_data->err_unix_sock_path, PATH_MAX,
-                       consumer_data->type == LTTNG_CONSUMER_KERNEL ?
-                               KCONSUMERD_ERR_SOCK_PATH :
-                               USTCONSUMERD_ERR_SOCK_PATH);
-       }
+       const char *path;
  
-       if (strlen(consumer_data->cmd_unix_sock_path) == 0) {
-               snprintf(consumer_data->cmd_unix_sock_path, PATH_MAX,
-                       consumer_data->type == LTTNG_CONSUMER_KERNEL ?
-                               KCONSUMERD_CMD_SOCK_PATH :
-                               USTCONSUMERD_CMD_SOCK_PATH);
+       switch (consumer_data->type) {
+       case LTTNG_CONSUMER_KERNEL:
+               path = KCONSUMERD_PATH;
+               break;
+       case LTTNG_CONSUMER64_UST:
+               path = USTCONSUMERD64_PATH;
+               break;
+       case LTTNG_CONSUMER32_UST:
+               path = USTCONSUMERD32_PATH;
+               break;
+       default:
+               ERR("Consumer type unknown");
+               ret = -EINVAL;
+               goto error;
        }
  
        ret = mkdir(path, S_IRWXU | S_IRWXG);
@@@ -3728,7 -4168,6 +4235,7 @@@ int main(int argc, char **argv
        void *status;
        const char *home_path;
  
 +      tracepoint(sessiond_boot_start);
        rcu_register_thread();
  
        /* Create thread quit pipe */
                goto error;
        }
  
+       setup_consumerd_path();
        /* Parse arguments */
        progname = argv[0];
        if ((ret = parse_args(argc, argv) < 0)) {
                        goto exit;
                }
  
-               ret = set_consumer_sockets(&ustconsumer_data);
+               ret = set_consumer_sockets(&ustconsumer64_data);
                if (ret < 0) {
                        goto exit;
                }
+               ret = set_consumer_sockets(&ustconsumer32_data);
+               if (ret < 0) {
+                       goto exit;
+               }
                /* Setup kernel tracer */
                init_kernel_tracer();
  
                goto exit_kernel;
        }
  
 +      tracepoint(sessiond_boot_end);
 +
        ret = pthread_join(kernel_thread, &status);
        if (ret != 0) {
                perror("pthread_join");
This page took 0.078227 seconds and 4 git commands to generate.