From 7659d4907b24d257f56efb5d666f59a7434dcd3d Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 4 May 2016 15:57:36 -0400 Subject: [PATCH] Define default values in configure.ac MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch moves the definitions of the various default values of LTTng-tools to configure.ac, so that the code and the man pages can share the same default values. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- configure.ac | 52 ++++++++++++++++++++++++++++++ src/common/defaults.h | 74 ++++++++++++++++++++----------------------- 2 files changed, 86 insertions(+), 40 deletions(-) diff --git a/configure.ac b/configure.ac index a67b7cb1f..84992244c 100644 --- a/configure.ac +++ b/configure.ac @@ -213,6 +213,58 @@ AC_DEFINE_UNQUOTED([CONFIG_LTTV_GUI_BIN], "$LTTV_GUI_BIN", [Location of the lttv AC_DEFINE_UNQUOTED([CONFIG_SESSIOND_BIN], "$SESSIOND_BIN", [Location of the sessiond executable.]) AC_DEFINE_UNQUOTED([CONFIG_LTTNG_SYSTEM_RUNDIR], ["$LTTNG_SYSTEM_RUNDIR"], [LTTng system runtime directory]) +AC_DEFUN([_AC_DEFINE_AND_SUBST], [ + AC_DEFINE_UNQUOTED([CONFIG_$1], [$2], [$1]) + $1="$2" + AC_SUBST([$1]) +]) + +AC_DEFUN([_AC_DEFINE_QUOTED_AND_SUBST], [ + AC_DEFINE_UNQUOTED([CONFIG_$1], ["$2"], [$1]) + $1="$2" + AC_SUBST([$1]) +]) + +# Default values +m4_define([_DEFAULT_CHANNEL_SUBBUF_SIZE], [4096]) +m4_define([_DEFAULT_CHANNEL_SUBBUF_NUM], [4]) +m4_define([_DEFAULT_CHANNEL_SWITCH_TIMER], [0]) +m4_define([_DEFAULT_CHANNEL_LIVE_TIMER], [0]) +m4_define([_DEFAULT_CHANNEL_READ_TIMER], [200000]) +_AC_DEFINE_AND_SUBST([DEFAULT_AGENT_TCP_PORT], [5345]) +_AC_DEFINE_AND_SUBST([DEFAULT_APP_SOCKET_RW_TIMEOUT], [5]) +_AC_DEFINE_AND_SUBST([DEFAULT_CHANNEL_SUBBUF_SIZE], [_DEFAULT_CHANNEL_SUBBUF_SIZE]) +_AC_DEFINE_AND_SUBST([DEFAULT_CHANNEL_TRACEFILE_COUNT], [0]) +_AC_DEFINE_AND_SUBST([DEFAULT_CHANNEL_TRACEFILE_SIZE], [0]) +_AC_DEFINE_AND_SUBST([DEFAULT_KERNEL_CHANNEL_LIVE_TIMER], [_DEFAULT_CHANNEL_LIVE_TIMER]) +_AC_DEFINE_AND_SUBST([DEFAULT_KERNEL_CHANNEL_READ_TIMER], [_DEFAULT_CHANNEL_READ_TIMER]) +_AC_DEFINE_AND_SUBST([DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM], [_DEFAULT_CHANNEL_SUBBUF_NUM]) +_AC_DEFINE_AND_SUBST([DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE], [262144]) +_AC_DEFINE_AND_SUBST([DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER], [_DEFAULT_CHANNEL_SWITCH_TIMER]) +_AC_DEFINE_AND_SUBST([DEFAULT_LTTNG_LIVE_TIMER], [1000000]) +_AC_DEFINE_AND_SUBST([DEFAULT_METADATA_CACHE_SIZE], [4096]) +_AC_DEFINE_AND_SUBST([DEFAULT_METADATA_READ_TIMER], [0]) +_AC_DEFINE_AND_SUBST([DEFAULT_METADATA_SUBBUF_NUM], [2]) +_AC_DEFINE_AND_SUBST([DEFAULT_METADATA_SUBBUF_SIZE], [4096]) +_AC_DEFINE_AND_SUBST([DEFAULT_METADATA_SWITCH_TIMER], [_DEFAULT_CHANNEL_SWITCH_TIMER]) +_AC_DEFINE_AND_SUBST([DEFAULT_NETWORK_CONTROL_PORT], [5342]) +_AC_DEFINE_AND_SUBST([DEFAULT_NETWORK_DATA_PORT], [5343]) +_AC_DEFINE_AND_SUBST([DEFAULT_NETWORK_VIEWER_PORT], [5344]) +_AC_DEFINE_AND_SUBST([DEFAULT_UST_PID_CHANNEL_LIVE_TIMER], [_DEFAULT_CHANNEL_LIVE_TIMER]) +_AC_DEFINE_AND_SUBST([DEFAULT_UST_PID_CHANNEL_READ_TIMER], [0]) +_AC_DEFINE_AND_SUBST([DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM], [_DEFAULT_CHANNEL_SUBBUF_NUM]) +_AC_DEFINE_AND_SUBST([DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE], [_DEFAULT_CHANNEL_SUBBUF_SIZE]) +_AC_DEFINE_AND_SUBST([DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER], [_DEFAULT_CHANNEL_SWITCH_TIMER]) +_AC_DEFINE_AND_SUBST([DEFAULT_UST_UID_CHANNEL_LIVE_TIMER], [_DEFAULT_CHANNEL_LIVE_TIMER]) +_AC_DEFINE_AND_SUBST([DEFAULT_UST_UID_CHANNEL_READ_TIMER], [0]) +_AC_DEFINE_AND_SUBST([DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM], [_DEFAULT_CHANNEL_SUBBUF_NUM]) +_AC_DEFINE_AND_SUBST([DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE], [131072]) +_AC_DEFINE_AND_SUBST([DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER], [_DEFAULT_CHANNEL_SWITCH_TIMER]) +_AC_DEFINE_QUOTED_AND_SUBST([DEFAULT_AGENT_BIND_ADDRESS], [localhost]) +_AC_DEFINE_QUOTED_AND_SUBST([DEFAULT_NETWORK_CONTROL_BIND_ADDRESS], [0.0.0.0]) +_AC_DEFINE_QUOTED_AND_SUBST([DEFAULT_NETWORK_DATA_BIND_ADDRESS], [0.0.0.0]) +_AC_DEFINE_QUOTED_AND_SUBST([DEFAULT_NETWORK_VIEWER_BIND_ADDRESS], [localhost]) + if test "x$prefix" = "xNONE"; then prefix=$ac_default_prefix fi diff --git a/src/common/defaults.h b/src/common/defaults.h index 6e343b50c..59fe8ec46 100644 --- a/src/common/defaults.h +++ b/src/common/defaults.h @@ -189,60 +189,54 @@ #define DEFAULT_PYTHON_EVENT_NAME DEFAULT_PYTHON_EVENT_COMPONENT ":*" #define DEFAULT_CHANNEL_OVERWRITE 0 -#define DEFAULT_CHANNEL_TRACEFILE_SIZE 0 -#define DEFAULT_CHANNEL_TRACEFILE_COUNT 0 - -/* Must always be a power of 2 */ -#define _DEFAULT_CHANNEL_SUBBUF_SIZE 4096 /* bytes */ -/* Must always be a power of 2 */ -#define _DEFAULT_CHANNEL_SUBBUF_NUM 4 -#define _DEFAULT_CHANNEL_SWITCH_TIMER 0 /* usec */ -#define _DEFAULT_CHANNEL_LIVE_TIMER 0 /* usec */ -#define _DEFAULT_CHANNEL_READ_TIMER 200000 /* usec */ +#define DEFAULT_CHANNEL_TRACEFILE_SIZE CONFIG_DEFAULT_CHANNEL_TRACEFILE_SIZE +#define DEFAULT_CHANNEL_TRACEFILE_COUNT CONFIG_DEFAULT_CHANNEL_TRACEFILE_COUNT + +#define _DEFAULT_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_CHANNEL_SUBBUF_SIZE #define _DEFAULT_CHANNEL_OUTPUT LTTNG_EVENT_MMAP /* Metadata channel defaults. */ -#define DEFAULT_METADATA_SUBBUF_SIZE 4096 -#define DEFAULT_METADATA_SUBBUF_NUM 2 -#define DEFAULT_METADATA_CACHE_SIZE 4096 -#define DEFAULT_METADATA_SWITCH_TIMER _DEFAULT_CHANNEL_SWITCH_TIMER -#define DEFAULT_METADATA_READ_TIMER 0 +#define DEFAULT_METADATA_SUBBUF_SIZE CONFIG_DEFAULT_METADATA_SUBBUF_SIZE +#define DEFAULT_METADATA_SUBBUF_NUM CONFIG_DEFAULT_METADATA_SUBBUF_NUM +#define DEFAULT_METADATA_CACHE_SIZE CONFIG_DEFAULT_METADATA_CACHE_SIZE +#define DEFAULT_METADATA_SWITCH_TIMER CONFIG_DEFAULT_METADATA_SWITCH_TIMER +#define DEFAULT_METADATA_READ_TIMER CONFIG_DEFAULT_METADATA_READ_TIMER #define DEFAULT_METADATA_OUTPUT _DEFAULT_CHANNEL_OUTPUT /* Kernel has different defaults */ /* DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE must always be a power of 2 */ -#define DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE 262144 /* bytes */ +#define DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_KERNEL_CHANNEL_SUBBUF_SIZE /* * DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM must always be a power of 2. * Update help manually if override. */ -#define DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM _DEFAULT_CHANNEL_SUBBUF_NUM +#define DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM /* See lttng-kernel.h enum lttng_kernel_output for channel output */ #define DEFAULT_KERNEL_CHANNEL_OUTPUT LTTNG_EVENT_SPLICE -#define DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER _DEFAULT_CHANNEL_SWITCH_TIMER -#define DEFAULT_KERNEL_CHANNEL_READ_TIMER _DEFAULT_CHANNEL_READ_TIMER -#define DEFAULT_KERNEL_CHANNEL_LIVE_TIMER _DEFAULT_CHANNEL_LIVE_TIMER +#define DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER +#define DEFAULT_KERNEL_CHANNEL_READ_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_READ_TIMER +#define DEFAULT_KERNEL_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_KERNEL_CHANNEL_LIVE_TIMER /* User space defaults */ /* Must be a power of 2 */ -#define DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE _DEFAULT_CHANNEL_SUBBUF_SIZE -#define DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE 131072 /* bytes */ +#define DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_UST_PID_CHANNEL_SUBBUF_SIZE +#define DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE CONFIG_DEFAULT_UST_UID_CHANNEL_SUBBUF_SIZE /* Must be a power of 2. Update help manuall if override. */ -#define DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM _DEFAULT_CHANNEL_SUBBUF_NUM -#define DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM _DEFAULT_CHANNEL_SUBBUF_NUM +#define DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM +#define DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM CONFIG_DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM /* See lttng-ust.h enum lttng_ust_output */ #define DEFAULT_UST_PID_CHANNEL_OUTPUT _DEFAULT_CHANNEL_OUTPUT #define DEFAULT_UST_UID_CHANNEL_OUTPUT _DEFAULT_CHANNEL_OUTPUT /* Timers in usec. */ -#define DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER _DEFAULT_CHANNEL_SWITCH_TIMER -#define DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER _DEFAULT_CHANNEL_SWITCH_TIMER -#define DEFAULT_UST_PID_CHANNEL_LIVE_TIMER _DEFAULT_CHANNEL_LIVE_TIMER -#define DEFAULT_UST_UID_CHANNEL_LIVE_TIMER _DEFAULT_CHANNEL_LIVE_TIMER +#define DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER +#define DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER +#define DEFAULT_UST_PID_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_LIVE_TIMER +#define DEFAULT_UST_UID_CHANNEL_LIVE_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_LIVE_TIMER -#define DEFAULT_UST_PID_CHANNEL_READ_TIMER 0 /* usec */ -#define DEFAULT_UST_UID_CHANNEL_READ_TIMER 0 /* usec */ +#define DEFAULT_UST_PID_CHANNEL_READ_TIMER CONFIG_DEFAULT_UST_PID_CHANNEL_READ_TIMER +#define DEFAULT_UST_UID_CHANNEL_READ_TIMER CONFIG_DEFAULT_UST_UID_CHANNEL_READ_TIMER /* * Default timeout value for the sem_timedwait() call. Blocking forever is not @@ -252,18 +246,18 @@ #define DEFAULT_SEM_WAIT_TIMEOUT 30 /* in seconds */ /* Default bind addresses for network services. */ -#define DEFAULT_NETWORK_CONTROL_BIND_ADDRESS "0.0.0.0" -#define DEFAULT_NETWORK_DATA_BIND_ADDRESS "0.0.0.0" -#define DEFAULT_NETWORK_VIEWER_BIND_ADDRESS "localhost" -#define DEFAULT_AGENT_BIND_ADDRESS "localhost" +#define DEFAULT_NETWORK_CONTROL_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_CONTROL_BIND_ADDRESS +#define DEFAULT_NETWORK_DATA_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_DATA_BIND_ADDRESS +#define DEFAULT_NETWORK_VIEWER_BIND_ADDRESS CONFIG_DEFAULT_NETWORK_VIEWER_BIND_ADDRESS +#define DEFAULT_AGENT_BIND_ADDRESS CONFIG_DEFAULT_AGENT_BIND_ADDRESS /* Default network ports for trace streaming support. */ -#define DEFAULT_NETWORK_CONTROL_PORT 5342 -#define DEFAULT_NETWORK_DATA_PORT 5343 -#define DEFAULT_NETWORK_VIEWER_PORT 5344 +#define DEFAULT_NETWORK_CONTROL_PORT CONFIG_DEFAULT_NETWORK_CONTROL_PORT +#define DEFAULT_NETWORK_DATA_PORT CONFIG_DEFAULT_NETWORK_DATA_PORT +#define DEFAULT_NETWORK_VIEWER_PORT CONFIG_DEFAULT_NETWORK_VIEWER_PORT /* Agent registration TCP port. */ -#define DEFAULT_AGENT_TCP_PORT 5345 +#define DEFAULT_AGENT_TCP_PORT CONFIG_DEFAULT_AGENT_TCP_PORT /* * If a thread stalls for this amount of time, it will be considered bogus (bad @@ -294,7 +288,7 @@ /* * Default receiving and sending timeout for an application socket. */ -#define DEFAULT_APP_SOCKET_RW_TIMEOUT 5 /* sec */ +#define DEFAULT_APP_SOCKET_RW_TIMEOUT CONFIG_DEFAULT_APP_SOCKET_RW_TIMEOUT #define DEFAULT_APP_SOCKET_TIMEOUT_ENV "LTTNG_APP_SOCKET_TIMEOUT" #define DEFAULT_UST_STREAM_FD_NUM 2 /* Number of fd per UST stream. */ @@ -307,7 +301,7 @@ #define DEFAULT_INDEX_DIR "index" /* Default lttng command live timer value in usec. */ -#define DEFAULT_LTTNG_LIVE_TIMER 1000000 +#define DEFAULT_LTTNG_LIVE_TIMER CONFIG_DEFAULT_LTTNG_LIVE_TIMER /* Default runas worker name */ #define DEFAULT_RUN_AS_WORKER_NAME "lttng-runas" -- 2.34.1