From: David Goulet Date: Fri, 20 Jan 2012 21:57:25 +0000 (-0500) Subject: Move all default values to defaults.h X-Git-Tag: v2.0-pre18~11 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=60922cb08cc9fb683c6148da4ff91da8c2c0c4d5;p=lttng-tools.git Move all default values to defaults.h Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c index ab83c6a75..a637a9042 100644 --- a/src/bin/lttng-consumerd/lttng-consumerd.c +++ b/src/bin/lttng-consumerd/lttng-consumerd.c @@ -253,16 +253,16 @@ int main(int argc, char **argv) if (strlen(command_sock_path) == 0) { switch (opt_type) { case LTTNG_CONSUMER_KERNEL: - snprintf(command_sock_path, PATH_MAX, KCONSUMERD_CMD_SOCK_PATH, + snprintf(command_sock_path, PATH_MAX, DEFAULT_KCONSUMERD_CMD_SOCK_PATH, DEFAULT_LTTNG_RUNDIR); break; case LTTNG_CONSUMER64_UST: snprintf(command_sock_path, PATH_MAX, - USTCONSUMERD64_CMD_SOCK_PATH, DEFAULT_LTTNG_RUNDIR); + DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH, DEFAULT_LTTNG_RUNDIR); break; case LTTNG_CONSUMER32_UST: snprintf(command_sock_path, PATH_MAX, - USTCONSUMERD32_CMD_SOCK_PATH, DEFAULT_LTTNG_RUNDIR); + DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH, DEFAULT_LTTNG_RUNDIR); break; default: WARN("Unknown consumerd type"); @@ -284,16 +284,16 @@ int main(int argc, char **argv) if (strlen(error_sock_path) == 0) { switch (opt_type) { case LTTNG_CONSUMER_KERNEL: - snprintf(error_sock_path, PATH_MAX, KCONSUMERD_ERR_SOCK_PATH, + snprintf(error_sock_path, PATH_MAX, DEFAULT_KCONSUMERD_ERR_SOCK_PATH, DEFAULT_LTTNG_RUNDIR); break; case LTTNG_CONSUMER64_UST: snprintf(error_sock_path, PATH_MAX, - USTCONSUMERD64_ERR_SOCK_PATH, DEFAULT_LTTNG_RUNDIR); + DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH, DEFAULT_LTTNG_RUNDIR); break; case LTTNG_CONSUMER32_UST: snprintf(error_sock_path, PATH_MAX, - USTCONSUMERD32_ERR_SOCK_PATH, DEFAULT_LTTNG_RUNDIR); + DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH, DEFAULT_LTTNG_RUNDIR); break; default: WARN("Unknown consumerd type"); diff --git a/src/bin/lttng-consumerd/lttng-consumerd.h b/src/bin/lttng-consumerd/lttng-consumerd.h index e42b2fea5..872a3e916 100644 --- a/src/bin/lttng-consumerd/lttng-consumerd.h +++ b/src/bin/lttng-consumerd/lttng-consumerd.h @@ -20,21 +20,4 @@ #ifndef _LTTNG_CONSUMERD_H #define _LTTNG_CONSUMERD_H -#define CONSUMERD_RUNDIR "%s" - -/* Kernel consumer path */ -#define KCONSUMERD_PATH CONSUMERD_RUNDIR "/kconsumerd" -#define KCONSUMERD_CMD_SOCK_PATH KCONSUMERD_PATH "/command" -#define KCONSUMERD_ERR_SOCK_PATH KCONSUMERD_PATH "/error" - -/* UST 64-bit consumer path */ -#define USTCONSUMERD64_PATH CONSUMERD_RUNDIR "/ustconsumerd64" -#define USTCONSUMERD64_CMD_SOCK_PATH USTCONSUMERD64_PATH "/command" -#define USTCONSUMERD64_ERR_SOCK_PATH USTCONSUMERD64_PATH "/error" - -/* UST 32-bit consumer path */ -#define USTCONSUMERD32_PATH CONSUMERD_RUNDIR "/ustconsumerd32" -#define USTCONSUMERD32_CMD_SOCK_PATH USTCONSUMERD32_PATH "/command" -#define USTCONSUMERD32_ERR_SOCK_PATH USTCONSUMERD32_PATH "/error" - #endif /* _LTTNG_CONSUMERD_H */ diff --git a/src/bin/lttng-sessiond/lttng-sessiond.h b/src/bin/lttng-sessiond/lttng-sessiond.h index 6a7006c0b..238f27a80 100644 --- a/src/bin/lttng-sessiond/lttng-sessiond.h +++ b/src/bin/lttng-sessiond/lttng-sessiond.h @@ -28,14 +28,6 @@ #include "session.h" #include "ust-app.h" -#define DEFAULT_HOME_DIR "/tmp" -#define DEFAULT_UST_SOCK_DIR DEFAULT_HOME_DIR "/ust-app-socks" -#define DEFAULT_GLOBAL_APPS_PIPE DEFAULT_UST_SOCK_DIR "/global" -#define DEFAULT_TRACE_OUTPUT DEFAULT_HOME_DIR "/lttng" - -#define DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH "/lttng-ust-apps-wait" -#define DEFAULT_HOME_APPS_WAIT_SHM_PATH "/lttng-ust-apps-wait-%u" - struct module_param { const char *name; int required; diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index d7ed4eb0b..77b107875 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -38,7 +38,6 @@ #include #include -#include #include #include #include @@ -98,18 +97,18 @@ static char *rundir; /* 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, + .err_unix_sock_path = DEFAULT_KCONSUMERD_ERR_SOCK_PATH, + .cmd_unix_sock_path = DEFAULT_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, + .err_unix_sock_path = DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH, + .cmd_unix_sock_path = DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH, }; 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, + .err_unix_sock_path = DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH, + .cmd_unix_sock_path = DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH, }; static int dispatch_thread_exit; @@ -4112,13 +4111,13 @@ static int set_consumer_sockets(struct consumer_data *consumer_data, switch (consumer_data->type) { case LTTNG_CONSUMER_KERNEL: - snprintf(path, PATH_MAX, KCONSUMERD_PATH, rundir); + snprintf(path, PATH_MAX, DEFAULT_KCONSUMERD_PATH, rundir); break; case LTTNG_CONSUMER64_UST: - snprintf(path, PATH_MAX, USTCONSUMERD64_PATH, rundir); + snprintf(path, PATH_MAX, DEFAULT_USTCONSUMERD64_PATH, rundir); break; case LTTNG_CONSUMER32_UST: - snprintf(path, PATH_MAX, USTCONSUMERD32_PATH, rundir); + snprintf(path, PATH_MAX, DEFAULT_USTCONSUMERD32_PATH, rundir); break; default: ERR("Consumer type unknown"); @@ -4304,9 +4303,9 @@ int main(int argc, char **argv) /* Setup kernel consumerd path */ snprintf(kconsumer_data.err_unix_sock_path, PATH_MAX, - KCONSUMERD_ERR_SOCK_PATH, rundir); + DEFAULT_KCONSUMERD_ERR_SOCK_PATH, rundir); snprintf(kconsumer_data.cmd_unix_sock_path, PATH_MAX, - KCONSUMERD_CMD_SOCK_PATH, rundir); + DEFAULT_KCONSUMERD_CMD_SOCK_PATH, rundir); DBG2("Kernel consumer err path: %s", kconsumer_data.err_unix_sock_path); @@ -4360,9 +4359,9 @@ int main(int argc, char **argv) /* 32 bits consumerd path setup */ snprintf(ustconsumer32_data.err_unix_sock_path, PATH_MAX, - USTCONSUMERD32_ERR_SOCK_PATH, rundir); + DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH, rundir); snprintf(ustconsumer32_data.cmd_unix_sock_path, PATH_MAX, - USTCONSUMERD32_CMD_SOCK_PATH, rundir); + DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH, rundir); DBG2("UST consumer 32 bits err path: %s", ustconsumer32_data.err_unix_sock_path); @@ -4371,9 +4370,9 @@ int main(int argc, char **argv) /* 64 bits consumerd path setup */ snprintf(ustconsumer64_data.err_unix_sock_path, PATH_MAX, - USTCONSUMERD64_ERR_SOCK_PATH, rundir); + DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH, rundir); snprintf(ustconsumer64_data.cmd_unix_sock_path, PATH_MAX, - USTCONSUMERD64_CMD_SOCK_PATH, rundir); + DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH, rundir); DBG2("UST consumer 64 bits err path: %s", ustconsumer64_data.err_unix_sock_path); diff --git a/src/common/defaults.h b/src/common/defaults.h index 6be44c7c3..b15bdc9e2 100644 --- a/src/common/defaults.h +++ b/src/common/defaults.h @@ -20,17 +20,45 @@ #define _DEFAULTS_H /* Default size of a hash table */ -#define DEFAULT_HT_SIZE 4 +#define DEFAULT_HT_SIZE 4 + +/* Default session daemon paths */ +#define DEFAULT_HOME_DIR "/tmp" +#define DEFAULT_UST_SOCK_DIR DEFAULT_HOME_DIR "/ust-app-socks" +#define DEFAULT_GLOBAL_APPS_PIPE DEFAULT_UST_SOCK_DIR "/global" +#define DEFAULT_TRACE_OUTPUT DEFAULT_HOME_DIR "/lttng" + +#define DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH "/lttng-ust-apps-wait" +#define DEFAULT_HOME_APPS_WAIT_SHM_PATH "/lttng-ust-apps-wait-%u" + +/* Default consumer paths */ +#define DEFAULT_CONSUMERD_RUNDIR "%s" + +/* Kernel consumer path */ +#define DEFAULT_KCONSUMERD_PATH DEFAULT_CONSUMERD_RUNDIR "/kconsumerd" +#define DEFAULT_KCONSUMERD_CMD_SOCK_PATH DEFAULT_KCONSUMERD_PATH "/command" +#define DEFAULT_KCONSUMERD_ERR_SOCK_PATH DEFAULT_KCONSUMERD_PATH "/error" + +/* UST 64-bit consumer path */ +#define DEFAULT_USTCONSUMERD64_PATH DEFAULT_CONSUMERD_RUNDIR "/ustconsumerd64" +#define DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH DEFAULT_USTCONSUMERD64_PATH "/command" +#define DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH DEFAULT_USTCONSUMERD64_PATH "/error" + +/* UST 32-bit consumer path */ +#define DEFAULT_USTCONSUMERD32_PATH DEFAULT_CONSUMERD_RUNDIR "/ustconsumerd32" +#define DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH DEFAULT_USTCONSUMERD32_PATH "/command" +#define DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH DEFAULT_USTCONSUMERD32_PATH "/error" + /* Default lttng run directory */ -#define DEFAULT_LTTNG_RUNDIR "/var/run/lttng" -#define DEFAULT_LTTNG_HOME_RUNDIR "%s/.lttng" +#define DEFAULT_LTTNG_RUNDIR "/var/run/lttng" +#define DEFAULT_LTTNG_HOME_RUNDIR "%s/.lttng" /* Default unix socket path */ -#define DEFAULT_GLOBAL_CLIENT_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/client-lttng-sessiond" -#define DEFAULT_GLOBAL_APPS_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/apps-lttng-sessiond" -#define DEFAULT_HOME_APPS_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/apps-lttng-sessiond" -#define DEFAULT_HOME_CLIENT_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/client-lttng-sessiond" +#define DEFAULT_GLOBAL_CLIENT_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/client-lttng-sessiond" +#define DEFAULT_GLOBAL_APPS_UNIX_SOCK DEFAULT_LTTNG_RUNDIR "/apps-lttng-sessiond" +#define DEFAULT_HOME_APPS_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/apps-lttng-sessiond" +#define DEFAULT_HOME_CLIENT_UNIX_SOCK DEFAULT_LTTNG_HOME_RUNDIR "/client-lttng-sessiond" /* * Value taken from the hard limit allowed by the kernel when using setrlimit