}
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;
*
* 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;
/*
* 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;
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,
* 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;
/* 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;
}
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;
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;
}
}
}
- 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);
}
}
- 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,
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;
}
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:
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;
}
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,
* 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();
* 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 */
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;
}
{
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 {
* 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;
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 {
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:
* 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);
* 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;
* 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,
* 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,
* 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,
* 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;
* 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;
* 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;
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);
/* 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,
/* 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);
*/
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;
* 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;
* 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;
#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 */
* 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;
* 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;
* 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;
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,
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);
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);
* 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;
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.
* 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;
/*
* 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;
* 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;
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);
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);
}
static inline
struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
- char *name)
+ const char *name)
{
return NULL;
}
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;
}