From 38057ed1e3358090cd03b81ce8414b032eb56f43 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Mon, 18 Jul 2011 17:17:25 -0400 Subject: [PATCH] Change lttng.h API char to const char Signed-off-by: David Goulet --- include/lttng/lttng.h | 25 ++++++++++++++----------- liblttngctl/liblttngctl.c | 25 +++++++++++++------------ 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/include/lttng/lttng.h b/include/lttng/lttng.h index 2b14231eb..c1cbd4e3b 100644 --- a/include/lttng/lttng.h +++ b/include/lttng/lttng.h @@ -197,7 +197,7 @@ struct lttng_session { /* * Create tracing session using a name and a path where trace will be written. */ -extern int lttng_create_session(char *name, char *path); +extern int lttng_create_session(const char *name, const char *path); /* * Destroy tracing session. @@ -205,7 +205,7 @@ extern int lttng_create_session(char *name, char *path); * The session will not be useable anymore, tracing will stopped for all * registered trace and tracing buffers will be flushed. */ -extern int lttng_destroy_session(char *name); +extern int lttng_destroy_session(const char *name); /* * List tracing sessions. @@ -232,7 +232,7 @@ extern int lttng_set_tracing_group(const char *name); * it's not done, you'll get an error saying that the session is not found. * It avoids the use of a session name on every API call. */ -extern void lttng_set_session_name(char *name); +extern void lttng_set_session_name(const char *name); /* * Return a human readable error message of a lttng-tools error code. @@ -244,12 +244,12 @@ extern const char *lttng_get_readable_code(int code); /* * Start tracing for *all* registered trace (kernel and user-space). */ -extern int lttng_start_tracing(char *session_name); +extern int lttng_start_tracing(const char *session_name); /* * Stop tracing for *all* registered trace (kernel and user-space). */ -extern int lttng_stop_tracing(char *session_name); +extern int lttng_stop_tracing(const char *session_name); /* * Add context to event for a specific channel. @@ -260,7 +260,8 @@ extern int lttng_stop_tracing(char *session_name); */ extern int lttng_add_context(struct lttng_domain *domain, - struct lttng_event_context *ctx, char *event_name, char *channel_name); + struct lttng_event_context *ctx, const char *event_name, + const char *channel_name); /* * Create or enable a kernel event. @@ -271,29 +272,31 @@ extern int lttng_add_context(struct lttng_domain *domain, * If channel_name is NULL, the default channel is used (channel0). */ extern int lttng_enable_event(struct lttng_domain *domain, struct lttng_event *ev, - char *channel_name); + const char *channel_name); /* * Create or enable a kernel channel. * * If name is NULL, the default channel is enabled (channel0). */ -extern int lttng_enable_channel(struct lttng_domain *domain, struct lttng_channel *chan); +extern int lttng_enable_channel(struct lttng_domain *domain, + struct lttng_channel *chan); /* * Disable kernel event. * * If channel_name is NULL, the default channel is used (channel0). */ -extern int lttng_disable_event(struct lttng_domain *domain, char *name, - char *channel_name); +extern int lttng_disable_event(struct lttng_domain *domain, const char *name, + const char *channel_name); /* * Disable kernel channel. * * If channel_name is NULL, the default channel is disabled (channel0). */ -extern int lttng_disable_channel(struct lttng_domain *domain, char *name); +extern int lttng_disable_channel(struct lttng_domain *domain, + const char *name); /* * List kernel events. diff --git a/liblttngctl/liblttngctl.c b/liblttngctl/liblttngctl.c index 38c9945b9..e693123b9 100644 --- a/liblttngctl/liblttngctl.c +++ b/liblttngctl/liblttngctl.c @@ -268,7 +268,7 @@ end: /* * Start tracing for all trace of the session. */ -int lttng_start_tracing(char *session_name) +int lttng_start_tracing(const char *session_name) { strncpy(lsm.session_name, session_name, NAME_MAX); return ask_sessiond(LTTNG_START_TRACE, NULL); @@ -277,7 +277,7 @@ int lttng_start_tracing(char *session_name) /* * Stop tracing for all trace of the session. */ -int lttng_stop_tracing(char *session_name) +int lttng_stop_tracing(const char *session_name) { strncpy(lsm.session_name, session_name, NAME_MAX); return ask_sessiond(LTTNG_STOP_TRACE, NULL); @@ -287,8 +287,8 @@ int lttng_stop_tracing(char *session_name) * lttng_add_context */ int lttng_add_context(struct lttng_domain *domain, - struct lttng_event_context *ctx, char *event_name, char *channel_name) - + struct lttng_event_context *ctx, const char *event_name, + const char *channel_name) { int ret; @@ -321,7 +321,7 @@ int lttng_add_context(struct lttng_domain *domain, * lttng_enable_event */ int lttng_enable_event(struct lttng_domain *domain, - struct lttng_event *ev, char *channel_name) + struct lttng_event *ev, const char *channel_name) { int ret; @@ -354,8 +354,8 @@ int lttng_enable_event(struct lttng_domain *domain, /* * Disable an event in the kernel tracer. */ -int lttng_disable_event(struct lttng_domain *domain, char *name, - char *channel_name) +int lttng_disable_event(struct lttng_domain *domain, const char *name, + const char *channel_name) { int ret; @@ -388,7 +388,8 @@ int lttng_disable_event(struct lttng_domain *domain, char *name, /* * Enable recording for a channel for the kernel tracer. */ -int lttng_enable_channel(struct lttng_domain *domain, struct lttng_channel *chan) +int lttng_enable_channel(struct lttng_domain *domain, + struct lttng_channel *chan) { int ret; @@ -412,7 +413,7 @@ int lttng_enable_channel(struct lttng_domain *domain, struct lttng_channel *chan /* * Disable recording for the channel for the kernel tracer. */ -int lttng_disable_channel(struct lttng_domain *domain, char *name) +int lttng_disable_channel(struct lttng_domain *domain, const char *name) { int ret; @@ -473,7 +474,7 @@ const char *lttng_get_readable_code(int code) /* * Create a brand new session using name. */ -int lttng_create_session(char *name, char *path) +int lttng_create_session(const char *name, const char *path) { strncpy(lsm.session_name, name, NAME_MAX); strncpy(lsm.path, path, PATH_MAX); @@ -483,7 +484,7 @@ int lttng_create_session(char *name, char *path) /* * Destroy session using name. */ -int lttng_destroy_session(char *name) +int lttng_destroy_session(const char *name) { strncpy(lsm.session_name, name, NAME_MAX); return ask_sessiond(LTTNG_DESTROY_SESSION, NULL); @@ -510,7 +511,7 @@ int lttng_list_sessions(struct lttng_session **sessions) /* * Set session name for the current lsm. */ -void lttng_set_session_name(char *name) +void lttng_set_session_name(const char *name) { strncpy(lsm.session_name, name, NAME_MAX); } -- 2.34.1