From ce2a9e76964f3bd53abb652299e5b00f824172ff Mon Sep 17 00:00:00 2001 From: David Goulet Date: Fri, 2 Nov 2012 13:16:29 -0400 Subject: [PATCH] Fix: Add space for stream name CPU number Fixes #358 Signed-off-by: David Goulet --- src/bin/lttng-sessiond/trace-kernel.h | 3 ++- src/bin/lttng-sessiond/trace-ust.h | 3 ++- src/common/defaults.h | 8 ++++++++ src/common/sessiond-comm/relayd.h | 3 ++- src/common/sessiond-comm/sessiond-comm.h | 3 ++- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/bin/lttng-sessiond/trace-kernel.h b/src/bin/lttng-sessiond/trace-kernel.h index e5a8f3b0b..96a3664b4 100644 --- a/src/bin/lttng-sessiond/trace-kernel.h +++ b/src/bin/lttng-sessiond/trace-kernel.h @@ -23,6 +23,7 @@ #include #include #include +#include #include "consumer.h" @@ -82,7 +83,7 @@ struct ltt_kernel_stream { int fd; int state; /* Format is %s_%d respectively channel name and CPU number. */ - char name[LTTNG_SYMBOL_NAME_LEN]; + char name[DEFAULT_STREAM_NAME_LEN]; struct cds_list_head list; }; diff --git a/src/bin/lttng-sessiond/trace-ust.h b/src/bin/lttng-sessiond/trace-ust.h index 845bcd6c9..f01f82d7d 100644 --- a/src/bin/lttng-sessiond/trace-ust.h +++ b/src/bin/lttng-sessiond/trace-ust.h @@ -24,6 +24,7 @@ #include #include +#include #include "consumer.h" #include "ust-ctl.h" @@ -54,7 +55,7 @@ struct ltt_ust_stream { int handle; char pathname[PATH_MAX]; /* Format is %s_%d respectively channel name and CPU number. */ - char name[LTTNG_SYMBOL_NAME_LEN]; + char name[DEFAULT_STREAM_NAME_LEN]; struct lttng_ust_object_data *obj; /* Using a list of streams to keep order. */ struct cds_list_head list; diff --git a/src/common/defaults.h b/src/common/defaults.h index 9853fbc9e..5495531f6 100644 --- a/src/common/defaults.h +++ b/src/common/defaults.h @@ -87,6 +87,14 @@ */ #define DEFAULT_POLL_SIZE 65535 +/* + * Format is %s_%d respectively channel name and CPU number. Eigth bytes + * are added here to add space for the CPU number. I guess 2^8 CPUs is more + * than enough. We might end up with quantum computing in a cell phone when + * reaching this limit. + */ +#define DEFAULT_STREAM_NAME_LEN LTTNG_SYMBOL_NAME_LEN + 8 + /* Default channel attributes */ #define DEFAULT_CHANNEL_NAME "channel0" #define DEFAULT_CHANNEL_OVERWRITE 0 /* usec */ diff --git a/src/common/sessiond-comm/relayd.h b/src/common/sessiond-comm/relayd.h index b897714d7..7bc7a1217 100644 --- a/src/common/sessiond-comm/relayd.h +++ b/src/common/sessiond-comm/relayd.h @@ -25,6 +25,7 @@ #include #include +#include #define RELAYD_VERSION_COMM_MAJOR 2 #define RELAYD_VERSION_COMM_MINOR 1 @@ -56,7 +57,7 @@ struct lttcomm_relayd_data_hdr { * Used to add a stream on the relay daemon. */ struct lttcomm_relayd_add_stream { - char channel_name[LTTNG_SYMBOL_NAME_LEN]; + char channel_name[DEFAULT_STREAM_NAME_LEN]; char pathname[PATH_MAX]; } __attribute__ ((__packed__)); diff --git a/src/common/sessiond-comm/sessiond-comm.h b/src/common/sessiond-comm/sessiond-comm.h index b94d3fb8d..e69c32bb2 100644 --- a/src/common/sessiond-comm/sessiond-comm.h +++ b/src/common/sessiond-comm/sessiond-comm.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -274,7 +275,7 @@ struct lttcomm_consumer_msg { char path_name[PATH_MAX]; int net_index; unsigned int metadata_flag; - char name[LTTNG_SYMBOL_NAME_LEN]; /* Name string of the stream */ + char name[DEFAULT_STREAM_NAME_LEN]; /* Name string of the stream */ uint64_t session_id; /* Tracing session id of the stream */ } stream; struct { -- 2.34.1