From: Mathieu Desnoyers Date: Sat, 19 Nov 2011 20:36:48 +0000 (-0500) Subject: Introduce build/env/argument override for 32-bit compat consumer X-Git-Tag: v2.0-pre15~95 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=fb09408a89eb37b77cc4bd5fe89b61271117ad07;p=lttng-tools.git Introduce build/env/argument override for 32-bit compat consumer Also remove unnecessary use of strdup on optarg. Signed-off-by: Mathieu Desnoyers --- diff --git a/configure.ac b/configure.ac index e3efec8f2..c602e2bae 100644 --- a/configure.ac +++ b/configure.ac @@ -14,8 +14,8 @@ AC_CHECK_HEADERS([ \ getopt.h sys/ipc.h sys/shm.h popt.h grp.h \ ]) -AC_ARG_VAR([LTTNG_TOOLS_COMPAT_BIN_PREFIX], [Search for LTTng Tools 32-bit compatibility binaries in this location.]) -AC_DEFINE_UNQUOTED([CONFIG_COMPAT_BIN_PREFIX], $LTTNG_TOOLS_COMPAT_BIN_PREFIX, [Search for LTTng Tools 32-bit compatibility binaries in this location.]) +AC_ARG_VAR([LTTNG_TOOLS_COMPAT_BIN_DIR], [Search for LTTng Tools 32-bit compatibility binaries in this location.]) +AC_DEFINE_UNQUOTED([CONFIG_COMPAT_BIN_DIR], $LTTNG_TOOLS_COMPAT_BIN_PREFIX, [Search for LTTng Tools 32-bit compatibility binaries in this location.]) # Check for pthread AC_CHECK_LIB([pthread], [pthread_create], [], diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index 54dcbdff0..d0c1d4068 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -159,6 +159,24 @@ static struct ltt_session_list *session_list_ptr; int ust_consumer_fd; +static const char *compat32_consumer_bindir = + __stringify(CONFIG_COMPAT_BIN_DIR); +static const char *compat32_consumer_prog = "lttng-consumerd"; + +static +void setup_compat32_consumer(void) +{ + const char *bindir; + + /* + * runtime env. var. overrides the build default. + */ + bindir = getenv("LTTNG_TOOLS_COMPAT_BIN_DIR"); + if (bindir) { + compat32_consumer_bindir = bindir; + } +} + /* * Create a poll set with O_CLOEXEC and add the thread quit pipe to the set. */ @@ -3441,6 +3459,7 @@ static void usage(void) 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, " --ustconsumerd-compat32 PATH Specify path for the 32-bit UST consumer daemon binary\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"); @@ -3464,6 +3483,7 @@ static int parse_args(int argc, char **argv) { "kconsumerd-err-sock", 1, 0, 'E' }, { "ustconsumerd-cmd-sock", 1, 0, 'D' }, { "ustconsumerd-err-sock", 1, 0, 'F' }, + { "ustconsumerd-compat32", 1, 0, 'u' }, { "daemonize", 0, 0, 'd' }, { "sig-parent", 0, 0, 'S' }, { "help", 0, 0, 'h' }, @@ -3477,7 +3497,7 @@ static int parse_args(int argc, char **argv) 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", long_options, &option_index); if (c == -1) { break; @@ -3500,7 +3520,7 @@ static int parse_args(int argc, char **argv) opt_daemon = 1; break; case 'g': - opt_tracing_group = strdup(optarg); + opt_tracing_group = optarg; break; case 'h': usage(); @@ -3533,6 +3553,9 @@ static int parse_args(int argc, char **argv) case 'Z': opt_verbose_consumer += 1; break; + case 'u': + compat32_consumer_bindir = optarg; + break; default: /* Unknown option or other error. * Error is printed by getopt, just return */ @@ -3859,6 +3882,8 @@ int main(int argc, char **argv) goto error; } + setup_compat32_consumer(); + /* Parse arguments */ progname = argv[0]; if ((ret = parse_args(argc, argv) < 0)) { diff --git a/lttng-sessiond/utils.h b/lttng-sessiond/utils.h index 449c3ef6b..415e0135b 100644 --- a/lttng-sessiond/utils.h +++ b/lttng-sessiond/utils.h @@ -20,6 +20,11 @@ #include +#ifndef __stringify +#define __stringify1(x) #x +#define __stringify(x) __stringify1(x) +#endif + int mkdir_recursive(const char *path, mode_t mode, uid_t uid, gid_t gid); const char *get_home_dir(void); int notify_thread_pipe(int wpipe);