From: Michael Jeanson Date: Wed, 14 Oct 2015 18:31:03 +0000 (-0400) Subject: Port: Use LTTNG_NAME_MAX instead of NAME_MAX X-Git-Tag: v2.8.0-rc1~287 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=36d2e35df61339e4394e84ad9790b984d259e0f0;p=lttng-tools.git Port: Use LTTNG_NAME_MAX instead of NAME_MAX Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- diff --git a/include/lttng/constant.h b/include/lttng/constant.h index 10f1bf694..edf4c3a8d 100644 --- a/include/lttng/constant.h +++ b/include/lttng/constant.h @@ -54,4 +54,6 @@ #define LTTNG_MAX_PID INT32_MAX #define LTTNG_MAX_PID_STR "2147483647" +#define LTTNG_NAME_MAX 255 + #endif /* LTTNG_CONSTANT_H */ diff --git a/include/lttng/domain.h b/include/lttng/domain.h index 3ee04191c..bff134a84 100644 --- a/include/lttng/domain.h +++ b/include/lttng/domain.h @@ -54,7 +54,7 @@ struct lttng_domain { union { pid_t pid; - char exec_name[NAME_MAX]; + char exec_name[LTTNG_NAME_MAX]; char padding[LTTNG_DOMAIN_PADDING2]; } attr; }; diff --git a/include/lttng/handle.h b/include/lttng/handle.h index b1057efe5..a313e7963 100644 --- a/include/lttng/handle.h +++ b/include/lttng/handle.h @@ -31,7 +31,7 @@ extern "C" { */ #define LTTNG_HANDLE_PADDING1 16 struct lttng_handle { - char session_name[NAME_MAX]; + char session_name[LTTNG_NAME_MAX]; struct lttng_domain domain; char padding[LTTNG_HANDLE_PADDING1]; diff --git a/include/lttng/load-internal.h b/include/lttng/load-internal.h index 85f0afa54..78cf86a2d 100644 --- a/include/lttng/load-internal.h +++ b/include/lttng/load-internal.h @@ -22,6 +22,7 @@ #include #include +#include #include /* @@ -29,7 +30,7 @@ */ struct lttng_load_session_attr { /* Name of the session to load, empty string means all. */ - char session_name[NAME_MAX]; + char session_name[LTTNG_NAME_MAX]; /* URL of the session configuration file to load. */ char input_url[PATH_MAX]; /* Overwrite the session if it exists. */ diff --git a/include/lttng/save-internal.h b/include/lttng/save-internal.h index f4a56f866..e2528be64 100644 --- a/include/lttng/save-internal.h +++ b/include/lttng/save-internal.h @@ -21,6 +21,7 @@ #include #include +#include #include /* @@ -28,7 +29,7 @@ */ struct lttng_save_session_attr { /* Name of the session to save, empty string means all. */ - char session_name[NAME_MAX]; + char session_name[LTTNG_NAME_MAX]; /* Destination of the session configuration. See lttng(1) for URL format. */ char configuration_url[PATH_MAX]; /* Overwrite the session configuration file if it exists. */ diff --git a/include/lttng/session.h b/include/lttng/session.h index e0594d2e8..4e515ad77 100644 --- a/include/lttng/session.h +++ b/include/lttng/session.h @@ -32,7 +32,7 @@ extern "C" { */ #define LTTNG_SESSION_PADDING1 12 struct lttng_session { - char name[NAME_MAX]; + char name[LTTNG_NAME_MAX]; /* The path where traces are written */ char path[PATH_MAX]; uint32_t enabled; /* enabled/started: 1, disabled/stopped: 0 */ diff --git a/include/lttng/snapshot-internal.h b/include/lttng/snapshot-internal.h index a14564b3b..b7391c228 100644 --- a/include/lttng/snapshot-internal.h +++ b/include/lttng/snapshot-internal.h @@ -20,6 +20,7 @@ #include #include +#include /* * Object used for the snapshot API. This is opaque to the public library. @@ -37,7 +38,7 @@ struct lttng_snapshot_output { */ uint64_t max_size; /* Name of the output so it can be recognized easily when listing them. */ - char name[NAME_MAX]; + char name[LTTNG_NAME_MAX]; /* Destination of the output. See lttng(1) for URL format. */ char ctrl_url[PATH_MAX]; /* Destination of the output. See lttng(1) for URL format. */ diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index 0c7ef8d76..28e52696e 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -1068,12 +1068,12 @@ static int relay_create_session(struct lttcomm_relayd_hdr *recv_hdr, int ret = 0, send_ret; struct relay_session *session; struct lttcomm_relayd_status_session reply; - char session_name[NAME_MAX]; + char session_name[LTTNG_NAME_MAX]; char hostname[HOST_NAME_MAX]; uint32_t live_timer = 0; bool snapshot = false; - memset(session_name, 0, NAME_MAX); + memset(session_name, 0, LTTNG_NAME_MAX); memset(hostname, 0, HOST_NAME_MAX); memset(&reply, 0, sizeof(reply)); diff --git a/src/bin/lttng-relayd/session.h b/src/bin/lttng-relayd/session.h index 1a37cfee2..de1e44f0d 100644 --- a/src/bin/lttng-relayd/session.h +++ b/src/bin/lttng-relayd/session.h @@ -26,6 +26,7 @@ #include #include +#include #include /* @@ -38,7 +39,7 @@ struct relay_session { * It is used to match a set of streams to their session. */ uint64_t id; - char session_name[NAME_MAX]; + char session_name[LTTNG_NAME_MAX]; char hostname[HOST_NAME_MAX]; uint32_t live_timer; diff --git a/src/bin/lttng-relayd/stream.c b/src/bin/lttng-relayd/stream.c index 8825d094c..02bf9dd54 100644 --- a/src/bin/lttng-relayd/stream.c +++ b/src/bin/lttng-relayd/stream.c @@ -149,7 +149,7 @@ struct relay_stream *stream_create(struct ctf_trace *trace, DBG("Tracefile %s/%s created", stream->path_name, stream->channel_name); } - if (!strncmp(stream->channel_name, DEFAULT_METADATA_NAME, NAME_MAX)) { + if (!strncmp(stream->channel_name, DEFAULT_METADATA_NAME, LTTNG_NAME_MAX)) { stream->is_metadata = 1; } diff --git a/src/common/mi-lttng.h b/src/common/mi-lttng.h index c3976681e..55ea68d73 100644 --- a/src/common/mi-lttng.h +++ b/src/common/mi-lttng.h @@ -39,13 +39,13 @@ struct mi_writer { * Version information for the machine interface. */ struct mi_lttng_version { - char version[NAME_MAX]; /* Version number of package */ + char version[LTTNG_NAME_MAX]; /* Version number of package */ uint32_t version_major; /* LTTng-Tools major version number */ uint32_t version_minor; /* LTTng-Tools minor version number */ uint32_t version_patchlevel; /* LTTng-Tools patchlevel version number */ - char version_commit[NAME_MAX]; /* Commit hash of the current version */ - char version_name[NAME_MAX]; - char package_url[NAME_MAX]; /* Define to the home page for this package. */ + char version_commit[LTTNG_NAME_MAX]; /* Commit hash of the current version */ + char version_name[LTTNG_NAME_MAX]; + char package_url[LTTNG_NAME_MAX]; /* Define to the home page for this package. */ }; /* Strings related to command */ diff --git a/src/common/sessiond-comm/relayd.h b/src/common/sessiond-comm/relayd.h index ff56d3a26..1152d28e9 100644 --- a/src/common/sessiond-comm/relayd.h +++ b/src/common/sessiond-comm/relayd.h @@ -168,7 +168,7 @@ struct lttcomm_relayd_index { * Create session in 2.4 adds additionnal parameters for live reading. */ struct lttcomm_relayd_create_session_2_4 { - char session_name[NAME_MAX]; + char session_name[LTTNG_NAME_MAX]; char hostname[HOST_NAME_MAX]; uint32_t live_timer; uint32_t snapshot; diff --git a/src/lib/lttng-ctl/load.c b/src/lib/lttng-ctl/load.c index 3599503e5..29998cda3 100644 --- a/src/lib/lttng-ctl/load.c +++ b/src/lib/lttng-ctl/load.c @@ -84,7 +84,7 @@ int lttng_load_session_attr_set_session_name( size_t len; len = strlen(session_name); - if (len >= NAME_MAX) { + if (len >= LTTNG_NAME_MAX) { ret = -LTTNG_ERR_INVALID; goto error; } diff --git a/src/lib/lttng-ctl/save.c b/src/lib/lttng-ctl/save.c index 8f8cbb639..d2a7e67c5 100644 --- a/src/lib/lttng-ctl/save.c +++ b/src/lib/lttng-ctl/save.c @@ -83,7 +83,7 @@ int lttng_save_session_attr_set_session_name( size_t len; len = strlen(session_name); - if (len >= NAME_MAX) { + if (len >= LTTNG_NAME_MAX) { ret = -LTTNG_ERR_INVALID; goto error; }