Implement consumer bin/lib 32/64-bit configure/env/arg support
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 28 Nov 2011 23:52:04 +0000 (18:52 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 28 Nov 2011 23:52:04 +0000 (18:52 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
configure.ac
lttng-sessiond/Makefile.am
lttng-sessiond/main.c

index aa185a6db07b60144536483fbba46324c7772adc..d0a372a0c6eca4dd0b53be5ac847f929c5a00342 100644 (file)
@@ -14,22 +14,38 @@ AC_CHECK_HEADERS([ \
        getopt.h sys/ipc.h sys/shm.h popt.h grp.h \
 ])
 
-AC_ARG_WITH([consumer32-bindir],
-       AC_HELP_STRING([--with-consumer32-bindir],
-       [Location of the 32-bit consumer executable]),
-       [LTTNG_TOOLS_32BIT_BINDIR="$withval"],
-       [LTTNG_TOOLS_32BIT_BINDIR=''])
-AC_SUBST([LTTNG_TOOLS_32BIT_BINDIR])
-
-AC_ARG_WITH([consumer64-bindir],
-       AC_HELP_STRING([--with-consumer64-bindir],
-       [Location of the 64-bit consumer executable]),
-       [LTTNG_TOOLS_64BIT_BINDIR="$withval"],
-       [LTTNG_TOOLS_64BIT_BINDIR=''])
-AC_SUBST([LTTNG_TOOLS_64BIT_BINDIR])
-
-AC_DEFINE_UNQUOTED([CONFIG_32BIT_BINDIR], $LTTNG_TOOLS_32BIT_BINDIR, [Search for LTTng Tools 32-bit binaries in this location.])
-AC_DEFINE_UNQUOTED([CONFIG_64BIT_BINDIR], $LTTNG_TOOLS_64BIT_BINDIR, [Search for LTTng Tools 64-bit binaries in this location.])
+AC_ARG_WITH([consumerd32-path],
+       AC_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],
+       AC_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],
+       AC_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],
+       AC_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], [],
index 5ccb5acffd8ed2636793a2cd5cb7023148e2e8ca..755bee4fbc524c5dda35b059d1e56c29412e4bfd 100644 (file)
@@ -1,5 +1,6 @@
 AM_CPPFLAGS = -I$(top_srcdir)/include \
-                         -DINSTALL_BIN_PATH=\""$(bindir)"\"
+                         -DINSTALL_BIN_PATH=\""$(bindir)"\" \
+                         -DINSTALL_LIB_PATH=\""$(libdir)"\"
 
 AM_CFLAGS = -fno-strict-aliasing
 
index 9af001dfd63d3de910d8de5f14a6beca4872f334..7e58ff781ee86d481458657ddba725f30c102d49 100644 (file)
@@ -57,6 +57,8 @@
 #include "ust-ctl.h"
 #include "utils.h"
 
+#define CONSUMERD_FILE "lttng-consumerd"
+
 struct consumer_data {
        enum lttng_consumer_type type;
 
@@ -169,31 +171,38 @@ static struct ltt_session_list *session_list_ptr;
 int ust_consumerd64_fd = -1;
 int ust_consumerd32_fd = -1;
 
-static const char *consumerd64_prog = "lttng-consumerd";
-static const char *consumerd32_prog = "lttng-consumerd";
-
-static const char *consumerd64_bindir =
-       __stringify(CONFIG_64BIT_BINDIR);
-static const char *consumerd32_bindir =
-       __stringify(CONFIG_32BIT_BINDIR);
+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 *bindir;
+       const char *path, *libdir;
 
        /*
         * Allow INSTALL_BIN_PATH to be used as a target path for the
-        * native architecture size consumer if CONFIG_NBIT_BINDIR as
-        * not been defined.
+        * native architecture size consumer if CONFIG_CONSUMER*_PATH
+        * has not been defined.
         */
-#if (CAA_BITS_PER_LONG == 64)
-       if (!consumerd64_bindir[0]) {
-               consumerd64_bindir = INSTALL_BIN_PATH;
+#if (CAA_BITS_PER_LONG == 32)
+       if (!consumerd32_path[0]) {
+               consumerd32_bindir = 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;
        }
-#elif (CAA_BITS_PER_LONG == 32)
-       if (!consumerd32_bindir[0]) {
-               consumerd32_bindir = INSTALL_BIN_PATH;
+       if (!consumerd64_libdir[0]) {
+               consumerd64_libdir = INSTALL_LIB_PATH;
        }
 #else
 #error "Unknown bitness"
@@ -202,13 +211,21 @@ void setup_consumerd_path(void)
        /*
         * runtime env. var. overrides the build default.
         */
-       bindir = getenv("LTTNG_TOOLS_64BIT_BINDIR");
-       if (bindir) {
-               consumerd64_bindir = bindir;
+       path = getenv("LTTNG_CONSUMERD32_PATH");
+       if (path) {
+               consumerd32_path = path;
        }
-       bindir = getenv("LTTNG_TOOLS_32BIT_BINDIR");
-       if (bindir) {
-               consumerd32_bindir = bindir;
+       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;
        }
 }
 
@@ -1515,11 +1532,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                        break;
                case LTTNG_CONSUMER64_UST:
                {
-                       char path[PATH_MAX];
-
-                       snprintf(path, PATH_MAX, "%s/%s",
-                               consumerd64_bindir, consumerd64_prog);
-                       execl(path, verbosity, "-u",
+                       execl(consumerd64_path, verbosity, "-u",
                                        "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
                                        "--consumerd-err-sock", consumer_data->err_unix_sock_path,
                                        NULL);
@@ -1527,11 +1540,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                }
                case LTTNG_CONSUMER32_UST:
                {
-                       char path[PATH_MAX];
-
-                       snprintf(path, PATH_MAX, "%s/%s",
-                               consumerd32_bindir, consumerd32_prog);
-                       execl(path, verbosity, "-u",
+                       execl(consumerd32_path, verbosity, "-u",
                                        "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
                                        "--consumerd-err-sock", consumer_data->err_unix_sock_path,
                                        NULL);
@@ -3180,7 +3189,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx)
                        /* Start the UST consumer daemons */
                        /* 64-bit */
                        pthread_mutex_lock(&ustconsumer64_data.pid_mutex);
-                       if (consumerd64_bindir[0] != '\0' &&
+                       if (consumerd64_path[0] != '\0' &&
                                        ustconsumer64_data.pid == 0 &&
                                        cmd_ctx->lsm->cmd_type != LTTNG_REGISTER_CONSUMER) {
                                pthread_mutex_unlock(&ustconsumer64_data.pid_mutex);
@@ -3196,7 +3205,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx)
                                pthread_mutex_unlock(&ustconsumer64_data.pid_mutex);
                        }
                        /* 32-bit */
-                       if (consumerd32_bindir[0] != '\0' &&
+                       if (consumerd32_path[0] != '\0' &&
                                        ustconsumer32_data.pid == 0 &&
                                        cmd_ctx->lsm->cmd_type != LTTNG_REGISTER_CONSUMER) {
                                pthread_mutex_unlock(&ustconsumer32_data.pid_mutex);
@@ -3636,8 +3645,10 @@ static void usage(void)
        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, "      --ustconsumerd32 PATH          Specify path for the 32-bit UST consumer daemon binary\n");
-       fprintf(stderr, "      --ustconsumerd64 PATH          Specify path for the 64-bit UST consumer daemon binary\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");
@@ -3659,12 +3670,14 @@ static int parse_args(int argc, char **argv)
                { "apps-sock", 1, 0, 'a' },
                { "kconsumerd-cmd-sock", 1, 0, 'C' },
                { "kconsumerd-err-sock", 1, 0, 'E' },
-               { "ustconsumerd64", 1, 0, 't' },
-               { "ustconsumerd64-cmd-sock", 1, 0, 'D' },
-               { "ustconsumerd64-err-sock", 1, 0, 'F' },
-               { "ustconsumerd32", 1, 0, 'u' },
                { "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' },
@@ -3741,10 +3754,16 @@ static int parse_args(int argc, char **argv)
                        opt_verbose_consumer += 1;
                        break;
                case 'u':
-                       consumerd32_bindir = optarg;
+                       consumerd32_path= optarg;
+                       break;
+               case 'U':
+                       consumerd32_libdir = optarg;
                        break;
                case 't':
-                       consumerd64_bindir = optarg;
+                       consumerd64_path = optarg;
+                       break;
+               case 'T':
+                       consumerd64_libdir = optarg;
                        break;
                default:
                        /* Unknown option or other error.
This page took 0.044505 seconds and 4 git commands to generate.