sessiond: fix: possible unaligned access in packed structure
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 15 Sep 2019 17:19:22 +0000 (13:19 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 19 Sep 2019 19:31:49 +0000 (15:31 -0400)
A number of (potentially) unaligned pointers are used in client
command handlers to pass command parameters to other internal
functions. Fixing those forces a number of const-correctness
changes where contexts are passed as arguments.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
13 files changed:
src/bin/lttng-sessiond/agent.c
src/bin/lttng-sessiond/agent.h
src/bin/lttng-sessiond/client.c
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/cmd.h
src/bin/lttng-sessiond/context.c
src/bin/lttng-sessiond/context.h
src/bin/lttng-sessiond/event.c
src/bin/lttng-sessiond/event.h
src/bin/lttng-sessiond/trace-kernel.c
src/bin/lttng-sessiond/trace-kernel.h
src/bin/lttng-sessiond/trace-ust.c
src/bin/lttng-sessiond/trace-ust.h

index 3b8acd2a2a0a57093c0d9822c7180a67f310b005..9ea899f57f7fb386c12713ef25b2e3f8ca6bd972 100644 (file)
@@ -708,7 +708,7 @@ void destroy_app_ctx(struct agent_app_ctx *ctx)
 }
 
 static
-struct agent_app_ctx *create_app_ctx(struct lttng_event_context *ctx)
+struct agent_app_ctx *create_app_ctx(const struct lttng_event_context *ctx)
 {
        struct agent_app_ctx *agent_ctx = NULL;
 
@@ -738,7 +738,7 @@ end:
  *
  * Return LTTNG_OK on success or else a LTTNG_ERR* code.
  */
-int agent_enable_context(struct lttng_event_context *ctx,
+int agent_enable_context(const struct lttng_event_context *ctx,
                enum lttng_domain_type domain)
 {
        int ret;
@@ -1166,7 +1166,7 @@ void agent_add_event(struct agent_event *event, struct agent *agt)
 /*
  * Unique add of a agent context to an agent object.
  */
-int agent_add_context(struct lttng_event_context *ctx, struct agent *agt)
+int agent_add_context(const struct lttng_event_context *ctx, struct agent *agt)
 {
        int ret = LTTNG_OK;
        struct agent_app_ctx *agent_ctx = NULL;
index c0808c48fe50ab0845aba4572d3607b576446f4e..ea5662754aef05fdecafe576b0abb97c2b9783eb 100644 (file)
@@ -153,9 +153,10 @@ void agent_delete_event(struct agent_event *event, struct agent *agt);
 void agent_destroy_event(struct agent_event *event);
 
 /* Agent context API.*/
-int agent_enable_context(struct lttng_event_context *ctx,
+int agent_enable_context(const struct lttng_event_context *ctx,
                enum lttng_domain_type domain);
-int agent_add_context(struct lttng_event_context *ctx, struct agent *agt);
+int agent_add_context(const struct lttng_event_context *ctx,
+               struct agent *agt);
 
 /* Agent app API. */
 struct agent_app *agent_create_app(pid_t pid, enum lttng_domain_type domain,
index fa7672b5834a370f3484ae43cb3d8f2306ba937a..956dab8c867413b5cc4e2c79c75cd5e8e1a3bd28 100644 (file)
@@ -410,7 +410,7 @@ error:
  * Should *NOT* be called with RCU read-side lock held.
  */
 static int create_ust_session(struct ltt_session *session,
-               struct lttng_domain *domain)
+               const struct lttng_domain *domain)
 {
        int ret;
        struct ltt_ust_session *lus = NULL;
@@ -950,7 +950,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                        /* Create UST session if none exist. */
                        if (cmd_ctx->session->ust_session == NULL) {
                                ret = create_ust_session(cmd_ctx->session,
-                                               &cmd_ctx->lsm->domain);
+                                               ALIGNED_CONST_PTR(cmd_ctx->lsm->domain));
                                if (ret != LTTNG_OK) {
                                        goto error;
                                }
@@ -1139,7 +1139,7 @@ skip_domain:
                ret = cmd_add_context(cmd_ctx->session,
                                cmd_ctx->lsm->domain.type,
                                cmd_ctx->lsm->u.context.channel_name,
-                               &cmd_ctx->lsm->u.context.ctx,
+                               ALIGNED_CONST_PTR(cmd_ctx->lsm->u.context.ctx),
                                kernel_poll_pipe[1]);
 
                cmd_ctx->lsm->u.context.ctx.u.app_ctx.provider_name = NULL;
@@ -1187,18 +1187,18 @@ error_add_context:
                                count -= (size_t) ret;
                        }
                }
-               /* FIXME: passing packed structure to non-packed pointer */
                ret = cmd_disable_event(cmd_ctx->session, cmd_ctx->lsm->domain.type,
                                cmd_ctx->lsm->u.disable.channel_name,
-                               &cmd_ctx->lsm->u.disable.event);
+                               ALIGNED_CONST_PTR(cmd_ctx->lsm->u.disable.event));
                break;
        }
        case LTTNG_ENABLE_CHANNEL:
        {
                cmd_ctx->lsm->u.channel.chan.attr.extended.ptr =
                                (struct lttng_channel_extended *) &cmd_ctx->lsm->u.channel.extended;
-               ret = cmd_enable_channel(cmd_ctx->session, &cmd_ctx->lsm->domain,
-                               &cmd_ctx->lsm->u.channel.chan,
+               ret = cmd_enable_channel(cmd_ctx->session,
+                               ALIGNED_CONST_PTR(cmd_ctx->lsm->domain),
+                               ALIGNED_CONST_PTR(cmd_ctx->lsm->u.channel.chan),
                                kernel_poll_pipe[1]);
                break;
        }
@@ -1320,7 +1320,7 @@ error_add_context:
                        }
                }
 
-               ev = lttng_event_copy(&cmd_ctx->lsm->u.enable.event);
+               ev = lttng_event_copy(ALIGNED_CONST_PTR(cmd_ctx->lsm->u.enable.event));
                if (!ev) {
                        DBG("Failed to copy event: %s",
                                        cmd_ctx->lsm->u.enable.event.name);
@@ -1344,7 +1344,8 @@ error_add_context:
                        }
                }
 
-               ret = cmd_enable_event(cmd_ctx->session, &cmd_ctx->lsm->domain,
+               ret = cmd_enable_event(cmd_ctx->session,
+                               ALIGNED_CONST_PTR(cmd_ctx->lsm->domain),
                                cmd_ctx->lsm->u.enable.channel_name,
                                ev,
                                filter_expression, bytecode, exclusion,
@@ -1716,7 +1717,8 @@ error_add_context:
                struct lttcomm_lttng_output_id reply;
 
                ret = cmd_snapshot_add_output(cmd_ctx->session,
-                               &cmd_ctx->lsm->u.snapshot_output.output, &snapshot_id);
+                               ALIGNED_CONST_PTR(cmd_ctx->lsm->u.snapshot_output.output),
+                               &snapshot_id);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -1735,7 +1737,7 @@ error_add_context:
        case LTTNG_SNAPSHOT_DEL_OUTPUT:
        {
                ret = cmd_snapshot_del_output(cmd_ctx->session,
-                               &cmd_ctx->lsm->u.snapshot_output.output);
+                               ALIGNED_CONST_PTR(cmd_ctx->lsm->u.snapshot_output.output));
                break;
        }
        case LTTNG_SNAPSHOT_LIST_OUTPUT:
@@ -1764,7 +1766,7 @@ error_add_context:
        case LTTNG_SNAPSHOT_RECORD:
        {
                ret = cmd_snapshot_record(cmd_ctx->session,
-                               &cmd_ctx->lsm->u.snapshot_record.output,
+                               ALIGNED_CONST_PTR(cmd_ctx->lsm->u.snapshot_record.output),
                                cmd_ctx->lsm->u.snapshot_record.wait);
                break;
        }
index c17be934af50f6a589b7e1feef51fddbd70dbcea..c2231f1b07f128de561fd1849ed845c00fc91483 100644 (file)
@@ -107,7 +107,7 @@ static uint64_t relayd_net_seq_idx;
 
 static int validate_ust_event_name(const char *);
 static int cmd_enable_event_internal(struct ltt_session *session,
-               struct lttng_domain *domain,
+               const struct lttng_domain *domain,
                char *channel_name, struct lttng_event *event,
                char *filter_expression,
                struct lttng_filter_bytecode *filter,
@@ -1482,27 +1482,29 @@ error:
  * The wpipe arguments is used as a notifier for the kernel thread.
  */
 int cmd_enable_channel(struct ltt_session *session,
-               struct lttng_domain *domain, struct lttng_channel *attr, int wpipe)
+               const struct lttng_domain *domain, const struct lttng_channel *_attr, int wpipe)
 {
        int ret;
        struct ltt_ust_session *usess = session->ust_session;
        struct lttng_ht *chan_ht;
        size_t len;
+       struct lttng_channel attr;
 
        assert(session);
-       assert(attr);
+       assert(_attr);
        assert(domain);
 
-       len = lttng_strnlen(attr->name, sizeof(attr->name));
+       attr = *_attr;
+       len = lttng_strnlen(attr.name, sizeof(attr.name));
 
        /* Validate channel name */
-       if (attr->name[0] == '.' ||
-               memchr(attr->name, '/', len) != NULL) {
+       if (attr.name[0] == '.' ||
+               memchr(attr.name, '/', len) != NULL) {
                ret = LTTNG_ERR_INVALID_CHANNEL_NAME;
                goto end;
        }
 
-       DBG("Enabling channel %s for session %s", attr->name, session->name);
+       DBG("Enabling channel %s for session %s", attr.name, session->name);
 
        rcu_read_lock();
 
@@ -1521,8 +1523,8 @@ int cmd_enable_channel(struct ltt_session *session,
         * beacons for inactive streams.
         */
        if (session->live_timer > 0) {
-               attr->attr.live_timer_interval = session->live_timer;
-               attr->attr.switch_timer_interval = 0;
+               attr.attr.live_timer_interval = session->live_timer;
+               attr.attr.switch_timer_interval = 0;
        }
 
        /* Check for feature support */
@@ -1534,8 +1536,8 @@ int cmd_enable_channel(struct ltt_session *session,
                        WARN("Kernel tracer does not support buffer monitoring. "
                                        "Setting the monitor interval timer to 0 "
                                        "(disabled) for channel '%s' of session '%s'",
-                                       attr-> name, session->name);
-                       lttng_channel_set_monitor_timer_interval(attr, 0);
+                                       attr.name, session->name);
+                       lttng_channel_set_monitor_timer_interval(&attr, 0);
                }
                break;
        }
@@ -1560,16 +1562,16 @@ int cmd_enable_channel(struct ltt_session *session,
        {
                struct ltt_kernel_channel *kchan;
 
-               kchan = trace_kernel_get_channel_by_name(attr->name,
+               kchan = trace_kernel_get_channel_by_name(attr.name,
                                session->kernel_session);
                if (kchan == NULL) {
                        if (session->snapshot.nb_output > 0 ||
                                        session->snapshot_mode) {
                                /* Enforce mmap output for snapshot sessions. */
-                               attr->attr.output = LTTNG_EVENT_MMAP;
+                               attr.attr.output = LTTNG_EVENT_MMAP;
                        }
-                       ret = channel_kernel_create(session->kernel_session, attr, wpipe);
-                       if (attr->name[0] != '\0') {
+                       ret = channel_kernel_create(session->kernel_session, &attr, wpipe);
+                       if (attr.name[0] != '\0') {
                                session->kernel_session->has_non_default_channel = 1;
                        }
                } else {
@@ -1599,19 +1601,19 @@ int cmd_enable_channel(struct ltt_session *session,
                 * adhered to.
                 */
                if (domain->type == LTTNG_DOMAIN_JUL) {
-                       if (strncmp(attr->name, DEFAULT_JUL_CHANNEL_NAME,
+                       if (strncmp(attr.name, DEFAULT_JUL_CHANNEL_NAME,
                                        LTTNG_SYMBOL_NAME_LEN)) {
                                ret = LTTNG_ERR_INVALID_CHANNEL_NAME;
                                goto error;
                        }
                } else if (domain->type == LTTNG_DOMAIN_LOG4J) {
-                       if (strncmp(attr->name, DEFAULT_LOG4J_CHANNEL_NAME,
+                       if (strncmp(attr.name, DEFAULT_LOG4J_CHANNEL_NAME,
                                        LTTNG_SYMBOL_NAME_LEN)) {
                                ret = LTTNG_ERR_INVALID_CHANNEL_NAME;
                                goto error;
                        }
                } else if (domain->type == LTTNG_DOMAIN_PYTHON) {
-                       if (strncmp(attr->name, DEFAULT_PYTHON_CHANNEL_NAME,
+                       if (strncmp(attr.name, DEFAULT_PYTHON_CHANNEL_NAME,
                                        LTTNG_SYMBOL_NAME_LEN)) {
                                ret = LTTNG_ERR_INVALID_CHANNEL_NAME;
                                goto error;
@@ -1620,10 +1622,10 @@ int cmd_enable_channel(struct ltt_session *session,
 
                chan_ht = usess->domain_global.channels;
 
-               uchan = trace_ust_find_channel_by_name(chan_ht, attr->name);
+               uchan = trace_ust_find_channel_by_name(chan_ht, attr.name);
                if (uchan == NULL) {
-                       ret = channel_ust_create(usess, attr, domain->buf_type);
-                       if (attr->name[0] != '\0') {
+                       ret = channel_ust_create(usess, &attr, domain->buf_type);
+                       if (attr.name[0] != '\0') {
                                usess->has_non_default_channel = 1;
                        }
                } else {
@@ -1636,7 +1638,7 @@ int cmd_enable_channel(struct ltt_session *session,
                goto error;
        }
 
-       if (ret == LTTNG_OK && attr->attr.output != LTTNG_EVENT_MMAP) {
+       if (ret == LTTNG_OK && attr.attr.output != LTTNG_EVENT_MMAP) {
                session->has_non_mmap_channel = true;
        }
 error:
@@ -1649,11 +1651,11 @@ end:
  * Command LTTNG_DISABLE_EVENT processed by the client thread.
  */
 int cmd_disable_event(struct ltt_session *session,
-               enum lttng_domain_type domain, char *channel_name,
-               struct lttng_event *event)
+               enum lttng_domain_type domain, const char *channel_name,
+               const struct lttng_event *event)
 {
        int ret;
-       char *event_name;
+       const char *event_name;
 
        DBG("Disable event command for event \'%s\'", event->name);
 
@@ -1826,7 +1828,7 @@ error:
  * Command LTTNG_ADD_CONTEXT processed by the client thread.
  */
 int cmd_add_context(struct ltt_session *session, enum lttng_domain_type domain,
-               char *channel_name, struct lttng_event_context *ctx, int kwpipe)
+               char *channel_name, const struct lttng_event_context *ctx, int kwpipe)
 {
        int ret, chan_kern_created = 0, chan_ust_created = 0;
        char *app_ctx_provider_name = NULL, *app_ctx_name = NULL;
@@ -1997,7 +1999,7 @@ end:
  * enable the events through which all "agent" events are funeled.
  */
 static int _cmd_enable_event(struct ltt_session *session,
-               struct lttng_domain *domain,
+               const struct lttng_domain *domain,
                char *channel_name, struct lttng_event *event,
                char *filter_expression,
                struct lttng_filter_bytecode *filter,
@@ -2394,7 +2396,8 @@ error:
  * Command LTTNG_ENABLE_EVENT processed by the client thread.
  * We own filter, exclusion, and filter_expression.
  */
-int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain,
+int cmd_enable_event(struct ltt_session *session,
+               const struct lttng_domain *domain,
                char *channel_name, struct lttng_event *event,
                char *filter_expression,
                struct lttng_filter_bytecode *filter,
@@ -2411,7 +2414,7 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain,
  * reserved names.
  */
 static int cmd_enable_event_internal(struct ltt_session *session,
-               struct lttng_domain *domain,
+               const struct lttng_domain *domain,
                char *channel_name, struct lttng_event *event,
                char *filter_expression,
                struct lttng_filter_bytecode *filter,
@@ -3712,7 +3715,7 @@ error:
  * Return LTTNG_OK on success or else a LTTNG_ERR code.
  */
 int cmd_snapshot_add_output(struct ltt_session *session,
-               struct lttng_snapshot_output *output, uint32_t *id)
+               const struct lttng_snapshot_output *output, uint32_t *id)
 {
        int ret;
        struct snapshot_output *new_output;
@@ -3780,7 +3783,7 @@ error:
  * Return LTTNG_OK on success or else a LTTNG_ERR code.
  */
 int cmd_snapshot_del_output(struct ltt_session *session,
-               struct lttng_snapshot_output *output)
+               const struct lttng_snapshot_output *output)
 {
        int ret;
        struct snapshot_output *sout = NULL;
@@ -4608,7 +4611,7 @@ error:
  * Return LTTNG_OK on success or else a LTTNG_ERR code.
  */
 int cmd_snapshot_record(struct ltt_session *session,
-               struct lttng_snapshot_output *output, int wait)
+               const struct lttng_snapshot_output *output, int wait)
 {
        enum lttng_error_code cmd_ret = LTTNG_OK;
        int ret;
index 5ac24a5069cfc4b000307641aa124d39c070e2af..32fb7fa608af0d4e08fc74c95d156261c7dadd18 100644 (file)
@@ -54,7 +54,7 @@ int cmd_destroy_session(struct ltt_session *session,
 int cmd_disable_channel(struct ltt_session *session,
                enum lttng_domain_type domain, char *channel_name);
 int cmd_enable_channel(struct ltt_session *session,
-               struct lttng_domain *domain, struct lttng_channel *attr,
+               const struct lttng_domain *domain, const struct lttng_channel *attr,
                int wpipe);
 int cmd_track_pid(struct ltt_session *session, enum lttng_domain_type domain,
                int pid);
@@ -64,14 +64,14 @@ int cmd_untrack_pid(struct ltt_session *session, enum lttng_domain_type domain,
 /* Event commands */
 int cmd_disable_event(struct ltt_session *session,
                enum lttng_domain_type domain,
-               char *channel_name,
-               struct lttng_event *event);
+               const char *channel_name,
+               const struct lttng_event *event);
 int cmd_add_context(struct ltt_session *session, enum lttng_domain_type domain,
-               char *channel_name, struct lttng_event_context *ctx, int kwpipe);
+               char *channel_name, const struct lttng_event_context *ctx, int kwpipe);
 int cmd_set_filter(struct ltt_session *session, enum lttng_domain_type domain,
                char *channel_name, struct lttng_event *event,
                struct lttng_filter_bytecode *bytecode);
-int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain,
+int cmd_enable_event(struct ltt_session *session, const struct lttng_domain *domain,
                char *channel_name, struct lttng_event *event,
                char *filter_expression,
                struct lttng_filter_bytecode *filter,
@@ -116,11 +116,11 @@ int cmd_data_pending(struct ltt_session *session);
 
 /* Snapshot */
 int cmd_snapshot_add_output(struct ltt_session *session,
-               struct lttng_snapshot_output *output, uint32_t *id);
+               const struct lttng_snapshot_output *output, uint32_t *id);
 int cmd_snapshot_del_output(struct ltt_session *session,
-               struct lttng_snapshot_output *output);
+               const struct lttng_snapshot_output *output);
 int cmd_snapshot_record(struct ltt_session *session,
-               struct lttng_snapshot_output *output, int wait);
+               const struct lttng_snapshot_output *output, int wait);
 
 int cmd_set_session_shm_path(struct ltt_session *session,
                const char *shm_path);
index 3861d22c1e3b7cf28275badf86fb388fddfd2bd0..8a43cb7c14e9ab5f336f867d8f88df6e7a71cf11 100644 (file)
@@ -107,7 +107,8 @@ error:
  */
 static int add_uctx_to_channel(struct ltt_ust_session *usess,
                enum lttng_domain_type domain,
-               struct ltt_ust_channel *uchan, struct lttng_event_context *ctx)
+               struct ltt_ust_channel *uchan,
+               const struct lttng_event_context *ctx)
 {
        int ret;
        struct ltt_ust_context *uctx = NULL;
@@ -196,7 +197,7 @@ duplicate:
  * Add kernel context to tracer.
  */
 int context_kernel_add(struct ltt_kernel_session *ksession,
-               struct lttng_event_context *ctx, char *channel_name)
+               const struct lttng_event_context *ctx, char *channel_name)
 {
        int ret;
        struct ltt_kernel_channel *kchan;
@@ -313,7 +314,8 @@ error:
  * Add UST context to tracer.
  */
 int context_ust_add(struct ltt_ust_session *usess,
-               enum lttng_domain_type domain, struct lttng_event_context *ctx,
+               enum lttng_domain_type domain,
+               const struct lttng_event_context *ctx,
                char *channel_name)
 {
        int ret = LTTNG_OK;
index 01b35167e484b11ebe3a104d65a1e24828fe24b5..e9de999c471d109320bfb439264fe9e07bc39b9e 100644 (file)
 #include "ust-ctl.h"
 
 int context_kernel_add(struct ltt_kernel_session *ksession,
-               struct lttng_event_context *ctx, char *channel_name);
+               const struct lttng_event_context *ctx, char *channel_name);
 int context_ust_add(struct ltt_ust_session *usess,
-               enum lttng_domain_type domain, struct lttng_event_context *ctx,
+               enum lttng_domain_type domain,
+               const struct lttng_event_context *ctx,
                char *channel_name);
 
 #endif /* _LTT_CONTEXT_H */
index f4b976f3b7ec27dfefa45bed373c5d01fbf10736..f32db4429d0333b28f5b25f2967130c10bc6a5a3 100644 (file)
@@ -69,7 +69,7 @@ static void add_unique_ust_event(struct lttng_ht *ht,
  * If event_name is NULL all events of the specified type are disabled.
  */
 int event_kernel_disable_event(struct ltt_kernel_channel *kchan,
-               char *event_name, enum lttng_event_type type)
+               const char *event_name, enum lttng_event_type type)
 {
        int ret, error = 0, found = 0;
        struct ltt_kernel_event *kevent;
@@ -259,7 +259,7 @@ error:
  * Disable UST tracepoint of a channel from a UST session.
  */
 int event_ust_disable_tracepoint(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, char *event_name)
+               struct ltt_ust_channel *uchan, const char *event_name)
 {
        int ret;
        struct ltt_ust_event *uevent;
@@ -672,7 +672,7 @@ error:
  * Return LTTNG_OK on success or else a LTTNG_ERR* code.
  */
 int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt,
-               char *event_name)
+               const char *event_name)
 {
        int ret = LTTNG_OK;
        struct agent_event *aevent;
index 45dd1fcbb3e1a6dda40254f008ac4893e9bf1d70..d0b1b9dab471dcc8b040c8a3c98e3c0d59b5cd75 100644 (file)
@@ -23,7 +23,7 @@
 struct agent;
 
 int event_kernel_disable_event(struct ltt_kernel_channel *kchan,
-               char *event_name, enum lttng_event_type event_type);
+               const char *event_name, enum lttng_event_type event_type);
 
 int event_kernel_enable_event(struct ltt_kernel_channel *kchan,
                struct lttng_event *event, char *filter_expression,
@@ -36,7 +36,7 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess,
                struct lttng_event_exclusion *exclusion,
                bool internal_event);
 int event_ust_disable_tracepoint(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, char *event_name);
+               struct ltt_ust_channel *uchan, const char *event_name);
 
 int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan);
@@ -49,7 +49,7 @@ int event_agent_enable_all(struct ltt_ust_session *usess, struct agent *agt,
                char *filter_expression);
 
 int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt,
-               char *event_name);
+               const char *event_name);
 int event_agent_disable_all(struct ltt_ust_session *usess, struct agent *agt);
 
 const char *event_get_default_agent_ust_name(enum lttng_domain_type domain);
index 36af00b2d09a4ba3d5b97e0b74eed509fedd64c2..e0491c95b3fba9112b95f33bafb78550e3b04e49 100644 (file)
@@ -39,7 +39,7 @@
  * Find the channel name for the given kernel session.
  */
 struct ltt_kernel_channel *trace_kernel_get_channel_by_name(
-               char *name, struct ltt_kernel_session *session)
+               const char *name, struct ltt_kernel_session *session)
 {
        struct ltt_kernel_channel *chan;
 
index 3b211740ab5c632cbae9db9ddb50c3eafa7e98b7..e439c31cd34c0f012790242d3066f695a3afa893 100644 (file)
@@ -135,7 +135,7 @@ struct ltt_kernel_event *trace_kernel_find_event(
                enum lttng_event_type type,
                struct lttng_filter_bytecode *filter);
 struct ltt_kernel_channel *trace_kernel_get_channel_by_name(
-               char *name, struct ltt_kernel_session *session);
+               const char *name, struct ltt_kernel_session *session);
 
 /*
  * Create functions malloc() the data structure.
index 569599af28c5e7fb6658855f99276d9ef92ea736..cc166fd6f9413824e3a22f37016f73e704560dc8 100644 (file)
@@ -171,7 +171,7 @@ no_match:
  * lock MUST be acquired before calling this.
  */
 struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
-               char *name)
+               const char *name)
 {
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
@@ -574,8 +574,8 @@ int trace_ust_context_type_event_to_ust(
 /*
  * Return 1 if contexts match, 0 otherwise.
  */
-int trace_ust_match_context(struct ltt_ust_context *uctx,
-               struct lttng_event_context *ctx)
+int trace_ust_match_context(const struct ltt_ust_context *uctx,
+               const struct lttng_event_context *ctx)
 {
        int utype;
 
@@ -624,7 +624,7 @@ int trace_ust_match_context(struct ltt_ust_context *uctx,
  * Return pointer to structure or NULL.
  */
 struct ltt_ust_context *trace_ust_create_context(
-               struct lttng_event_context *ctx)
+               const struct lttng_event_context *ctx)
 {
        struct ltt_ust_context *uctx = NULL;
        int utype;
index 9316fa8174df1db069fec8cc2d91f61444f182ec..89088ec0324d95103919b2913f6b47b840b49955 100644 (file)
@@ -187,7 +187,7 @@ struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
                enum lttng_ust_loglevel_type loglevel_type, int loglevel_value,
                struct lttng_event_exclusion *exclusion);
 struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
-               char *name);
+               const char *name);
 struct agent *trace_ust_find_agent(struct ltt_ust_session *session,
                enum lttng_domain_type domain_type);
 
@@ -203,9 +203,9 @@ enum lttng_error_code trace_ust_create_event(struct lttng_event *ev,
                struct lttng_event_exclusion *exclusion,
                bool internal_event, struct ltt_ust_event **ust_event);
 struct ltt_ust_context *trace_ust_create_context(
-               struct lttng_event_context *ctx);
-int trace_ust_match_context(struct ltt_ust_context *uctx,
-               struct lttng_event_context *ctx);
+               const struct lttng_event_context *ctx);
+int trace_ust_match_context(const struct ltt_ust_context *uctx,
+               const struct lttng_event_context *ctx);
 void trace_ust_delete_channel(struct lttng_ht *ht,
                struct ltt_ust_channel *channel);
 
@@ -241,7 +241,7 @@ static inline int trace_ust_ht_match_event_by_name(struct cds_lfht_node *node,
 }
 static inline
 struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
-               char *name)
+               const char *name)
 {
        return NULL;
 }
@@ -288,13 +288,13 @@ void trace_ust_free_session(struct ltt_ust_session *session)
 
 static inline
 struct ltt_ust_context *trace_ust_create_context(
-               struct lttng_event_context *ctx)
+               const struct lttng_event_context *ctx)
 {
        return NULL;
 }
 static inline
-int trace_ust_match_context(struct ltt_ust_context *uctx,
-               struct lttng_event_context *ctx)
+int trace_ust_match_context(const struct ltt_ust_context *uctx,
+               const struct lttng_event_context *ctx)
 {
        return 0;
 }
This page took 0.039439 seconds and 4 git commands to generate.