[lttng-dev] [lttng-tools PATCH v4 1/2] Rename consumerd32/64_path options to _bin

Alexandre Montplaisir alexandre.montplaisir at gmail.com
Mon Dec 5 17:25:35 EST 2011


The _path suffix was confusing as to whether it would include the
filename at the end or not. In fact it should (to allow greater
flexibility in moving/renaming the consumerd executable).

Rename all configure options, env vars and substition variables to
consumerd32/64_bin instead, and expect the user to pass a complete
basename + filename to those.

Signed-off-by: Alexandre Montplaisir <alexandre.montplaisir at gmail.com>
---
 configure.ac          |   34 +++++++++++++++++-----------------
 lttng-sessiond/main.c |   44 ++++++++++++++++++++++----------------------
 2 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3c09729..6f23577 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,36 +14,36 @@ AC_CHECK_HEADERS([ \
 	getopt.h sys/ipc.h sys/shm.h popt.h grp.h \
 ])
 
-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-bin],
+	AS_HELP_STRING([--with-consumerd32-bin],
+	[Location of the 32-bit consumerd executable (including the filename)]),
+	[CONSUMERD32_BIN="$withval"],
+	[CONSUMERD32_BIN=''])
+AC_SUBST([CONSUMERD32_BIN])
+
+AC_ARG_WITH([consumerd64-bin],
+	AS_HELP_STRING([--with-consumerd64-bin],
+	[Location of the 64-bit consumerd executable (including the filename)]),
+	[CONSUMERD64_BIN="$withval"],
+	[CONSUMERD64_BIN=''])
+AC_SUBST([CONSUMERD64_BIN])
 
 AC_ARG_WITH([consumerd32-libdir],
 	AS_HELP_STRING([--with-consumerd32-libdir],
-	[Location of the 32-bit consumerd libraries]),
+	[Directory containing 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]),
+	[Directory containing 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_BIN], $CONSUMERD32_BIN, [Location of the 32-bit consumerd executable.])
+AC_DEFINE_UNQUOTED([CONFIG_CONSUMERD64_BIN], $CONSUMERD64_BIN, [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.])
 
diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c
index fcae023..723d2a8 100644
--- a/lttng-sessiond/main.c
+++ b/lttng-sessiond/main.c
@@ -171,10 +171,10 @@ 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_bin =
+	__stringify(CONFIG_CONSUMERD32_BIN);
+static const char *consumerd64_bin =
+	__stringify(CONFIG_CONSUMERD64_BIN);
 static const char *consumerd32_libdir =
 	__stringify(CONFIG_CONSUMERD32_LIBDIR);
 static const char *consumerd64_libdir =
@@ -183,7 +183,7 @@ static const char *consumerd64_libdir =
 static
 void setup_consumerd_path(void)
 {
-	const char *path, *libdir;
+	const char *bin, *libdir;
 
 	/*
 	 * Allow INSTALL_BIN_PATH to be used as a target path for the
@@ -191,15 +191,15 @@ void setup_consumerd_path(void)
 	 * has not been defined.
 	 */
 #if (CAA_BITS_PER_LONG == 32)
-	if (!consumerd32_path[0]) {
-		consumerd32_path = INSTALL_BIN_PATH "/" CONSUMERD_FILE;
+	if (!consumerd32_bin[0]) {
+		consumerd32_bin = 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_bin[0]) {
+		consumerd64_bin = INSTALL_BIN_PATH "/" CONSUMERD_FILE;
 	}
 	if (!consumerd64_libdir[0]) {
 		consumerd64_libdir = INSTALL_LIB_PATH;
@@ -211,13 +211,13 @@ void setup_consumerd_path(void)
 	/*
 	 * runtime env. var. overrides the build default.
 	 */
-	path = getenv("LTTNG_CONSUMERD32_PATH");
-	if (path) {
-		consumerd32_path = path;
+	bin = getenv("LTTNG_CONSUMERD32_BIN");
+	if (bin) {
+		consumerd32_bin = bin;
 	}
-	path = getenv("LTTNG_CONSUMERD64_PATH");
-	if (path) {
-		consumerd64_path = path;
+	bin = getenv("LTTNG_CONSUMERD64_BIN");
+	if (bin) {
+		consumerd64_bin = bin;
 	}
 	libdir = getenv("LTTNG_TOOLS_CONSUMERD32_LIBDIR");
 	if (libdir) {
@@ -1524,7 +1524,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
 		}
 		switch (consumer_data->type) {
 		case LTTNG_CONSUMER_KERNEL:
-			execl(INSTALL_BIN_PATH "/lttng-consumerd",
+			execl(INSTALL_BIN_PATH "/" CONSUMERD_FILE,
 					"lttng-consumerd", verbosity, "-k",
 					"--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
 					"--consumerd-err-sock", consumer_data->err_unix_sock_path,
@@ -1561,7 +1561,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
 					goto error;
 				}
 			}
-			ret = execl(consumerd64_path, verbosity, "-u",
+			ret = execl(consumerd64_bin, verbosity, "-u",
 					"--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
 					"--consumerd-err-sock", consumer_data->err_unix_sock_path,
 					NULL);
@@ -1604,7 +1604,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
 					goto error;
 				}
 			}
-			ret = execl(consumerd32_path, verbosity, "-u",
+			ret = execl(consumerd32_bin, verbosity, "-u",
 					"--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
 					"--consumerd-err-sock", consumer_data->err_unix_sock_path,
 					NULL);
@@ -3262,7 +3262,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_path[0] != '\0' &&
+			if (consumerd64_bin[0] != '\0' &&
 					ustconsumer64_data.pid == 0 &&
 					cmd_ctx->lsm->cmd_type != LTTNG_REGISTER_CONSUMER) {
 				pthread_mutex_unlock(&ustconsumer64_data.pid_mutex);
@@ -3278,7 +3278,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx)
 				pthread_mutex_unlock(&ustconsumer64_data.pid_mutex);
 			}
 			/* 32-bit */
-			if (consumerd32_path[0] != '\0' &&
+			if (consumerd32_bin[0] != '\0' &&
 					ustconsumer32_data.pid == 0 &&
 					cmd_ctx->lsm->cmd_type != LTTNG_REGISTER_CONSUMER) {
 				pthread_mutex_unlock(&ustconsumer32_data.pid_mutex);
@@ -3827,13 +3827,13 @@ static int parse_args(int argc, char **argv)
 			opt_verbose_consumer += 1;
 			break;
 		case 'u':
-			consumerd32_path= optarg;
+			consumerd32_bin= optarg;
 			break;
 		case 'U':
 			consumerd32_libdir = optarg;
 			break;
 		case 't':
-			consumerd64_path = optarg;
+			consumerd64_bin = optarg;
 			break;
 		case 'T':
 			consumerd64_libdir = optarg;
-- 
1.7.7.3




More information about the lttng-dev mailing list