#define LTTNG_UST_PROVIDER_MAJOR 2
#define LTTNG_UST_PROVIDER_MINOR 0
-struct lttng_channel;
+struct lttng_ust_channel_buffer;
struct lttng_ust_session;
struct lttng_ust_lib_ring_buffer_ctx;
struct lttng_ust_event_field;
struct lttng_ust_event_recorder_private *priv; /* Private event record interface */
unsigned int id;
- struct lttng_channel *chan;
+ struct lttng_ust_channel_buffer *chan;
struct lttng_ust_ctx *ctx;
/* End of base ABI. Fields below should be used after checking struct_size. */
};
struct lttng_ust_lib_ring_buffer_channel;
-struct lttng_ust_shm_handle;
struct lttng_ust_channel_ops_private;
/*
/* End of base ABI. Fields below should be used after checking struct_size. */
};
+enum lttng_ust_channel_type {
+ LTTNG_UST_CHANNEL_TYPE_BUFFER = 0,
+};
+
+struct lttng_ust_channel_common_private;
+
/*
* IMPORTANT: this structure is part of the ABI between the probe and
* UST. Fields need to be only added at the end, never reordered, never
* removed.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
*/
-struct lttng_channel {
- /*
- * The pointers located in this private data are NOT safe to be
- * dereferenced by the consumer. The only operations the
- * consumer process is designed to be allowed to do is to read
- * and perform subbuffer flush.
- */
- struct lttng_ust_lib_ring_buffer_channel *chan; /* Channel buffers */
+struct lttng_ust_channel_common {
+ uint32_t struct_size; /* Size of this structure. */
+
+ struct lttng_ust_channel_common_private *priv; /* Private channel interface */
+
+ enum lttng_ust_channel_type type;
+ void *child; /* Pointer to child, for inheritance by aggregation. */
+
int enabled;
- struct lttng_ust_ctx *ctx;
- /* Event ID management */
struct lttng_ust_session *session;
- int objd; /* Object associated to channel */
- struct cds_list_head node; /* Channel list in session */
+
+ /* End of base ABI. Fields below should be used after checking struct_size. */
+};
+
+struct lttng_ust_channel_buffer_private;
+
+/*
+ * IMPORTANT: this structure is part of the ABI between the probe and
+ * UST. Fields need to be only added at the end, never reordered, never
+ * removed.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
+ */
+struct lttng_ust_channel_buffer {
+ uint32_t struct_size; /* Size of this structure. */
+
+ struct lttng_ust_channel_common *parent; /* Inheritance by aggregation. */
+ struct lttng_ust_channel_buffer_private *priv; /* Private channel buffer interface */
+
+ struct lttng_ust_ctx *ctx;
struct lttng_ust_channel_ops *ops;
- int header_type; /* 0: unset, 1: compact, 2: large */
- struct lttng_ust_shm_handle *handle; /* shared-memory handle */
+ struct lttng_ust_lib_ring_buffer_channel *chan; /* Channel buffers */
+ struct lttng_ust_shm_handle *handle; /* shared-memory handle */
- /* Channel ID */
- unsigned int id;
- enum lttng_ust_abi_chan_type type;
- unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
- int tstate:1; /* Transient enable state */
+ /* End of base ABI. Fields below should be used after checking struct_size. */
};
/*
case LTTNG_UST_EVENT_TYPE_RECORDER: \
{ \
struct lttng_ust_event_recorder *__event_recorder = (struct lttng_ust_event_recorder *) __event->child; \
- struct lttng_channel *__chan = __event_recorder->chan; \
+ struct lttng_ust_channel_buffer *__chan = __event_recorder->chan; \
+ struct lttng_ust_channel_common *__chan_common = __chan->parent; \
\
- if (!_TP_SESSION_CHECK(session, __chan->session)) \
+ if (!_TP_SESSION_CHECK(session, __chan_common->session)) \
return; \
- if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->session->active))) \
+ if (caa_unlikely(!CMM_ACCESS_ONCE(__chan_common->session->active))) \
return; \
- if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->enabled))) \
+ if (caa_unlikely(!CMM_ACCESS_ONCE(__chan_common->enabled))) \
return; \
break; \
} \
{ \
size_t __event_len, __event_align; \
struct lttng_ust_event_recorder *__event_recorder = (struct lttng_ust_event_recorder *) __event->child; \
- struct lttng_channel *__chan = __event_recorder->chan; \
+ struct lttng_ust_channel_buffer *__chan = __event_recorder->chan; \
struct lttng_ust_lib_ring_buffer_ctx __ctx; \
struct lttng_ust_stack_ctx __lttng_ctx; \
\
memset(&__lttng_ctx, 0, sizeof(__lttng_ctx)); \
__lttng_ctx.struct_size = sizeof(struct lttng_ust_stack_ctx); \
__lttng_ctx.event_recorder = __event_recorder; \
- __lttng_ctx.chan_ctx = tp_rcu_dereference(__chan->ctx); \
+ __lttng_ctx.chan_ctx = tp_rcu_dereference(__chan->ctx); \
__lttng_ctx.event_ctx = tp_rcu_dereference(__event_recorder->ctx); \
lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_ctx, __event_len, \
__event_align, -1, __chan->handle); \
size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset);
void (*record)(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan);
+ struct lttng_ust_channel_buffer *chan);
void (*get_value)(struct lttng_ust_ctx_field *field,
struct lttng_ust_ctx_value *value);
void (*destroy)(struct lttng_ust_ctx_field *field);
size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset);
void (*record)(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan);
+ struct lttng_ust_channel_buffer *chan);
void (*get_value)(struct lttng_ust_ctx_field *field,
struct lttng_ust_ctx_value *value);
struct cds_hlist_node node;
size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
void (*record)(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan),
+ struct lttng_ust_channel_buffer *chan),
void (*get_value)(struct lttng_ust_ctx_field *field,
struct lttng_ust_ctx_value *value));
size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
void (*record)(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan),
+ struct lttng_ust_channel_buffer *chan),
void (*get_value)(struct lttng_ust_ctx_field *field,
struct lttng_ust_ctx_value *value));
* Channel representation within consumer.
*/
struct ustctl_consumer_channel {
- struct lttng_channel *chan; /* lttng channel buffers */
+ struct lttng_ust_channel_buffer *chan; /* lttng channel buffers */
/* initial attributes */
struct ustctl_consumer_channel_attr attr;
size_t len) /* metadata length */
{
struct lttng_ust_lib_ring_buffer_ctx ctx;
- struct lttng_channel *chan = channel->chan;
+ struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan;
const char *str = metadata_str;
int ret = 0, waitret;
size_t reserve_len, pos;
for (pos = 0; pos < len; pos += reserve_len) {
reserve_len = min_t(size_t,
- chan->ops->priv->packet_avail_size(chan->chan, chan->handle),
+ lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan, lttng_chan_buf->handle),
len - pos);
- lib_ring_buffer_ctx_init(&ctx, chan->chan, NULL, reserve_len,
- sizeof(char), -1, chan->handle);
+ lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len,
+ sizeof(char), -1, lttng_chan_buf->handle);
/*
* We don't care about metadata buffer's records lost
* count, because we always retry here. Report error if
*/
waitret = wait_cond_interruptible_timeout(
({
- ret = chan->ops->event_reserve(&ctx, 0);
+ ret = lttng_chan_buf->ops->event_reserve(&ctx, 0);
ret != -ENOBUFS || !ret;
}),
LTTNG_METADATA_TIMEOUT_MSEC);
ret = waitret;
goto end;
}
- chan->ops->event_write(&ctx, &str[pos], reserve_len);
- chan->ops->event_commit(&ctx);
+ lttng_chan_buf->ops->event_write(&ctx, &str[pos], reserve_len);
+ lttng_chan_buf->ops->event_commit(&ctx);
}
end:
return ret;
size_t len) /* metadata length */
{
struct lttng_ust_lib_ring_buffer_ctx ctx;
- struct lttng_channel *chan = channel->chan;
+ struct lttng_ust_channel_buffer *lttng_chan_buf = channel->chan;
const char *str = metadata_str;
ssize_t reserve_len;
int ret;
reserve_len = min_t(ssize_t,
- chan->ops->priv->packet_avail_size(chan->chan, chan->handle),
+ lttng_chan_buf->ops->priv->packet_avail_size(lttng_chan_buf->chan, lttng_chan_buf->handle),
len);
- lib_ring_buffer_ctx_init(&ctx, chan->chan, NULL, reserve_len,
- sizeof(char), -1, chan->handle);
- ret = chan->ops->event_reserve(&ctx, 0);
+ lib_ring_buffer_ctx_init(&ctx, lttng_chan_buf->chan, NULL, reserve_len,
+ sizeof(char), -1, lttng_chan_buf->handle);
+ ret = lttng_chan_buf->ops->event_reserve(&ctx, 0);
if (ret != 0) {
DBG("LTTng: event reservation failed");
assert(ret < 0);
reserve_len = ret;
goto end;
}
- chan->ops->event_write(&ctx, str, reserve_len);
- chan->ops->event_commit(&ctx);
+ lttng_chan_buf->ops->event_write(&ctx, str, reserve_len);
+ lttng_chan_buf->ops->event_commit(&ctx);
end:
return reserve_len;
size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
void (*record)(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan),
+ struct lttng_ust_channel_buffer *chan),
void (*get_value)(struct lttng_ust_ctx_field *field,
struct lttng_ust_ctx_value *value));
static
void cgroup_ns_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
ino_t cgroup_ns;
static
void cpu_id_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
int cpu;
static
void ip_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
void *ip;
static
void ipc_ns_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
ino_t ipc_ns;
static
void mnt_ns_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
ino_t mnt_ns;
static
void net_ns_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
ino_t net_ns;
static
void perf_counter_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
uint64_t value;
static
void pid_ns_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
ino_t pid_ns;
static
void procname_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
char *procname;
static
void pthread_id_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
unsigned long pthread_id;
static
void time_ns_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
ino_t time_ns;
static
void user_ns_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
ino_t user_ns;
static
void uts_ns_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
ino_t uts_ns;
static
void vegid_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
gid_t vegid;
static
void veuid_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
uid_t veuid;
static
void vgid_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
gid_t vgid;
static
void vpid_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
pid_t vpid = wrapper_getvpid();
static
void vsgid_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
gid_t vsgid;
static
void vsuid_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
uid_t vsuid;
static
void vtid_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
pid_t vtid = wrapper_getvtid();
static
void vuid_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
uid_t vuid;
size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
void (*record)(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan),
+ struct lttng_ust_channel_buffer *chan),
void (*get_value)(struct lttng_ust_ctx_field *field,
struct lttng_ust_ctx_value *value))
{
* Only used internally at session destruction.
*/
static
-void _lttng_channel_unmap(struct lttng_channel *lttng_chan)
+void _lttng_channel_unmap(struct lttng_ust_channel_buffer *lttng_chan)
{
struct lttng_ust_lib_ring_buffer_channel *chan;
struct lttng_ust_shm_handle *handle;
- cds_list_del(<tng_chan->node);
+ cds_list_del(<tng_chan->priv->node);
lttng_destroy_context(lttng_chan->ctx);
chan = lttng_chan->chan;
handle = lttng_chan->handle;
channel_destroy(chan, handle, 0);
+ free(lttng_chan->parent);
+ free(lttng_chan->priv);
free(lttng_chan);
}
void lttng_session_destroy(struct lttng_ust_session *session)
{
- struct lttng_channel *chan, *tmpchan;
+ struct lttng_ust_channel_buffer_private *chan, *tmpchan;
struct lttng_ust_event_recorder_private *event_recorder_priv, *tmpevent_recorder_priv;
struct lttng_enum *_enum, *tmp_enum;
struct lttng_event_enabler *event_enabler, *event_tmpenabler;
&session->priv->enums_head, node)
_lttng_enum_destroy(_enum);
cds_list_for_each_entry_safe(chan, tmpchan, &session->priv->chan_head, node)
- _lttng_channel_unmap(chan);
+ _lttng_channel_unmap(chan->pub);
cds_list_del(&session->priv->node);
lttng_destroy_context(session->priv->ctx);
free(session->priv);
int lttng_session_enable(struct lttng_ust_session *session)
{
int ret = 0;
- struct lttng_channel *chan;
+ struct lttng_ust_channel_buffer_private *chan;
int notify_socket;
if (session->active) {
/* don't change it if session stop/restart */
if (chan->header_type)
continue;
- ctx = chan->ctx;
+ ctx = chan->pub->ctx;
if (ctx) {
nr_fields = ctx->nr_fields;
fields = ctx->fields;
ret = ustcomm_register_channel(notify_socket,
session,
session->priv->objd,
- chan->objd,
+ chan->parent.objd,
nr_fields,
fields,
&chan_id,
return ret;
}
-int lttng_channel_enable(struct lttng_channel *channel)
+int lttng_channel_enable(struct lttng_ust_channel_common *lttng_channel)
{
int ret = 0;
- if (channel->enabled) {
+ if (lttng_channel->enabled) {
ret = -EBUSY;
goto end;
}
/* Set transient enabler state to "enabled" */
- channel->tstate = 1;
- lttng_session_sync_event_enablers(channel->session);
+ lttng_channel->priv->tstate = 1;
+ lttng_session_sync_event_enablers(lttng_channel->session);
/* Set atomically the state to "enabled" */
- CMM_ACCESS_ONCE(channel->enabled) = 1;
+ CMM_ACCESS_ONCE(lttng_channel->enabled) = 1;
end:
return ret;
}
-int lttng_channel_disable(struct lttng_channel *channel)
+int lttng_channel_disable(struct lttng_ust_channel_common *lttng_channel)
{
int ret = 0;
- if (!channel->enabled) {
+ if (!lttng_channel->enabled) {
ret = -EBUSY;
goto end;
}
/* Set atomically the state to "disabled" */
- CMM_ACCESS_ONCE(channel->enabled) = 0;
+ CMM_ACCESS_ONCE(lttng_channel->enabled) = 0;
/* Set transient enabler state to "enabled" */
- channel->tstate = 0;
- lttng_session_sync_event_enablers(channel->session);
+ lttng_channel->priv->tstate = 0;
+ lttng_session_sync_event_enablers(lttng_channel->session);
end:
return ret;
}
*/
static
int lttng_event_recorder_create(struct lttng_ust_event_desc *desc,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
struct lttng_ust_event_recorder *event_recorder;
struct lttng_ust_event_recorder_private *event_recorder_priv;
- struct lttng_ust_session *session = chan->session;
+ struct lttng_ust_session *session = chan->parent->session;
struct cds_hlist_head *head;
int ret = 0;
int notify_socket, loglevel;
const char *uri;
- head = borrow_hash_table_bucket(chan->session->priv->events_ht.table,
+ head = borrow_hash_table_bucket(chan->parent->session->priv->events_ht.table,
LTTNG_UST_EVENT_HT_SIZE, desc);
notify_socket = lttng_get_notify_socket(session->priv->owner);
ret = ustcomm_register_event(notify_socket,
session,
session->priv->objd,
- chan->objd,
+ chan->priv->parent.objd,
desc->name,
loglevel,
desc->signature,
goto sessiond_register_error;
}
- cds_list_add(&event_recorder_priv->node, &chan->session->priv->events_head);
+ cds_list_add(&event_recorder_priv->node, &chan->parent->session->priv->events_head);
cds_hlist_add_head(&event_recorder_priv->hlist, head);
return 0;
static
void lttng_create_event_recorder_if_missing(struct lttng_event_enabler *event_enabler)
{
- struct lttng_ust_session *session = event_enabler->chan->session;
+ struct lttng_ust_session *session = event_enabler->chan->parent->session;
struct lttng_ust_probe_desc *probe_desc;
struct lttng_ust_event_desc *desc;
struct lttng_ust_event_recorder_private *event_recorder_priv;
case LTTNG_UST_EVENT_TYPE_RECORDER:
{
struct lttng_ust_event_recorder *event_recorder = event->child;
- struct lttng_ust_session *session = event_recorder->chan->session;
+ struct lttng_ust_session *session = event_recorder->chan->parent->session;
unsigned int i;
/* Destroy enums of the current event. */
static
int lttng_event_enabler_ref_event_recorders(struct lttng_event_enabler *event_enabler)
{
- struct lttng_ust_session *session = event_enabler->chan->session;
+ struct lttng_ust_session *session = event_enabler->chan->parent->session;
struct lttng_ust_event_recorder_private *event_recorder_priv;
if (!lttng_event_enabler_as_enabler(event_enabler)->enabled)
struct lttng_event_enabler *lttng_event_enabler_create(
enum lttng_enabler_format_type format_type,
struct lttng_ust_abi_event *event_param,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
struct lttng_event_enabler *event_enabler;
event_enabler->chan = chan;
/* ctx left NULL */
event_enabler->base.enabled = 0;
- cds_list_add(&event_enabler->node, &event_enabler->chan->session->priv->enablers_head);
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+ cds_list_add(&event_enabler->node, &event_enabler->chan->parent->session->priv->enablers_head);
+ lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session);
return event_enabler;
}
int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler)
{
lttng_event_enabler_as_enabler(event_enabler)->enabled = 1;
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+ lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session);
return 0;
}
int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler)
{
lttng_event_enabler_as_enabler(event_enabler)->enabled = 0;
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+ lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session);
return 0;
}
_lttng_enabler_attach_filter_bytecode(
lttng_event_enabler_as_enabler(event_enabler), bytecode);
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+ lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session);
return 0;
}
_lttng_enabler_attach_exclusion(
lttng_event_enabler_as_enabler(event_enabler), excluder);
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+ lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent->session);
return 0;
}
* intesection of session and channel transient enable
* states.
*/
- enabled = enabled && session->priv->tstate && event_recorder_priv->pub->chan->tstate;
+ enabled = enabled && session->priv->tstate && event_recorder_priv->pub->chan->priv->parent.tstate;
CMM_STORE_SHARED(event_recorder_priv->pub->parent->enabled, enabled);
/*
size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
void (*record)(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan),
+ struct lttng_ust_channel_buffer *chan),
void (*get_value)(struct lttng_ust_ctx_field *field,
struct lttng_ust_ctx_value *value))
{
struct lttng_ust_session_private *session_priv;
cds_list_for_each_entry(session_priv, &sessions, node) {
- struct lttng_channel *chan;
+ struct lttng_ust_channel_buffer_private *chan;
struct lttng_ust_event_recorder_private *event_recorder_priv;
int ret;
if (ret)
abort();
cds_list_for_each_entry(chan, &session_priv->chan_head, node) {
- ret = lttng_ust_context_set_provider_rcu(&chan->ctx,
+ ret = lttng_ust_context_set_provider_rcu(&chan->pub->ctx,
name, get_size, record, get_value);
if (ret)
abort();
size_t (*get_size)(struct lttng_ust_ctx_field *field, size_t offset),
void (*record)(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan),
+ struct lttng_ust_channel_buffer *chan),
void (*get_value)(struct lttng_ust_ctx_field *field,
struct lttng_ust_ctx_value *value))
{
static inline
void ctx_record(struct lttng_ust_lib_ring_buffer_ctx *bufctx,
- struct lttng_channel *chan,
+ struct lttng_ust_channel_buffer *chan,
struct lttng_ust_ctx *ctx,
enum app_ctx_mode mode)
{
struct lttng_ust_lib_ring_buffer_ctx *ctx,
struct lttng_client_ctx *client_ctx)
{
- struct lttng_channel *lttng_chan = channel_get_private(chan);
+ struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan);
struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
size_t orig_offset = offset;
size_t padding;
- switch (lttng_chan->header_type) {
+ switch (lttng_chan->priv->header_type) {
case 1: /* compact */
padding = lib_ring_buffer_align(offset, lttng_alignof(uint32_t));
offset += padding;
struct lttng_ust_lib_ring_buffer_ctx *ctx,
uint32_t event_id)
{
- struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
+ struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan);
struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
if (caa_unlikely(ctx->rflags))
goto slow_path;
- switch (lttng_chan->header_type) {
+ switch (lttng_chan->priv->header_type) {
case 1: /* compact */
{
uint32_t id_time = 0;
struct lttng_ust_lib_ring_buffer_ctx *ctx,
uint32_t event_id)
{
- struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
+ struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan);
struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
- switch (lttng_chan->header_type) {
+ switch (lttng_chan->priv->header_type) {
case 1: /* compact */
if (!(ctx->rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTTNG_RFLAG_EXTENDED))) {
uint32_t id_time = 0;
lib_ring_buffer_offset_address(&buf->backend,
subbuf_idx * chan->backend.subbuf_size,
handle);
- struct lttng_channel *lttng_chan = channel_get_private(chan);
+ struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan);
uint64_t cnt = shmp_index(handle, buf->backend.buf_cnt, subbuf_idx)->seq_cnt;
assert(header);
if (!header)
return;
header->magic = CTF_MAGIC_NUMBER;
- memcpy(header->uuid, lttng_chan->uuid, sizeof(lttng_chan->uuid));
- header->stream_id = lttng_chan->id;
+ memcpy(header->uuid, lttng_chan->priv->uuid, sizeof(lttng_chan->priv->uuid));
+ header->stream_id = lttng_chan->priv->id;
header->stream_instance_id = buf->backend.cpu;
header->ctx.timestamp_begin = tsc;
header->ctx.timestamp_end = 0;
{
struct lttng_ust_lib_ring_buffer_channel *chan = shmp(handle,
buf->backend.chan);
- struct lttng_channel *lttng_chan = channel_get_private(chan);
+ struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan);
- *stream_id = lttng_chan->id;
+ *stream_id = lttng_chan->priv->id;
return 0;
}
};
static
-struct lttng_channel *_channel_create(const char *name,
+struct lttng_ust_channel_buffer *_channel_create(const char *name,
void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int switch_timer_interval,
{
struct lttng_ust_abi_channel_config chan_priv_init;
struct lttng_ust_shm_handle *handle;
- struct lttng_channel *lttng_chan;
+ struct lttng_ust_channel_buffer *lttng_chan_buf;
- lttng_chan = zmalloc(sizeof(struct lttng_channel));
- if (!lttng_chan)
+ lttng_chan_buf = lttng_ust_alloc_channel_buffer();
+ if (!lttng_chan_buf)
return NULL;
- memcpy(lttng_chan->uuid, uuid, LTTNG_UST_UUID_LEN);
- lttng_chan->id = chan_id;
+ memcpy(lttng_chan_buf->priv->uuid, uuid, LTTNG_UST_UUID_LEN);
+ lttng_chan_buf->priv->id = chan_id;
memset(&chan_priv_init, 0, sizeof(chan_priv_init));
memcpy(chan_priv_init.uuid, uuid, LTTNG_UST_UUID_LEN);
__alignof__(struct lttng_ust_abi_channel_config),
sizeof(struct lttng_ust_abi_channel_config),
&chan_priv_init,
- lttng_chan, buf_addr, subbuf_size, num_subbuf,
+ lttng_chan_buf, buf_addr, subbuf_size, num_subbuf,
switch_timer_interval, read_timer_interval,
stream_fds, nr_stream_fds, blocking_timeout);
if (!handle)
goto error;
- lttng_chan->handle = handle;
- lttng_chan->chan = shmp(handle, handle->chan);
- return lttng_chan;
+ lttng_chan_buf->handle = handle;
+ lttng_chan_buf->chan = shmp(handle, handle->chan);
+ return lttng_chan_buf;
error:
- free(lttng_chan);
+ lttng_ust_free_channel_common(lttng_chan_buf->parent);
return NULL;
}
static
-void lttng_channel_destroy(struct lttng_channel *chan)
+void lttng_channel_destroy(struct lttng_ust_channel_buffer *lttng_chan_buf)
{
- channel_destroy(chan->chan, chan->handle, 1);
- free(chan);
+ channel_destroy(lttng_chan_buf->chan, lttng_chan_buf->handle, 1);
+ lttng_ust_free_channel_common(lttng_chan_buf->parent);
}
static
int lttng_event_reserve(struct lttng_ust_lib_ring_buffer_ctx *ctx,
uint32_t event_id)
{
- struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
+ struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(ctx->chan);
struct lttng_ust_stack_ctx *lttng_ctx = ctx->priv;
struct lttng_client_ctx client_ctx;
int ret, cpu;
return -EPERM;
ctx->cpu = cpu;
- switch (lttng_chan->header_type) {
+ switch (lttng_chan->priv->header_type) {
case 1: /* compact */
if (event_id > 30)
ctx->rflags |= LTTNG_RFLAG_EXTENDED;
lib_ring_buffer_offset_address(&buf->backend,
subbuf_idx * chan->backend.subbuf_size,
handle);
- struct lttng_channel *lttng_chan = channel_get_private(chan);
+ struct lttng_ust_channel_buffer *lttng_chan = channel_get_private(chan);
assert(header);
if (!header)
return;
header->magic = TSDL_MAGIC_NUMBER;
- memcpy(header->uuid, lttng_chan->uuid, sizeof(lttng_chan->uuid));
+ memcpy(header->uuid, lttng_chan->priv->uuid, sizeof(lttng_chan->priv->uuid));
header->checksum = 0; /* 0 if unused */
header->content_size = 0xFFFFFFFF; /* in bits, for debugging */
header->packet_size = 0xFFFFFFFF; /* in bits, for debugging */
};
static
-struct lttng_channel *_channel_create(const char *name,
+struct lttng_ust_channel_buffer *_channel_create(const char *name,
void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int switch_timer_interval,
{
struct lttng_ust_abi_channel_config chan_priv_init;
struct lttng_ust_shm_handle *handle;
- struct lttng_channel *lttng_chan;
+ struct lttng_ust_channel_buffer *lttng_chan_buf;
- lttng_chan = zmalloc(sizeof(struct lttng_channel));
- if (!lttng_chan)
+ lttng_chan_buf = lttng_ust_alloc_channel_buffer();
+ if (!lttng_chan_buf)
return NULL;
- memcpy(lttng_chan->uuid, uuid, LTTNG_UST_UUID_LEN);
- lttng_chan->id = chan_id;
+ memcpy(lttng_chan_buf->priv->uuid, uuid, LTTNG_UST_UUID_LEN);
+ lttng_chan_buf->priv->id = chan_id;
memset(&chan_priv_init, 0, sizeof(chan_priv_init));
memcpy(chan_priv_init.uuid, uuid, LTTNG_UST_UUID_LEN);
chan_priv_init.id = chan_id;
handle = channel_create(&client_config, name,
- __alignof__(struct lttng_channel),
- sizeof(struct lttng_channel),
+ __alignof__(struct lttng_ust_channel_buffer),
+ sizeof(struct lttng_ust_channel_buffer),
&chan_priv_init,
- lttng_chan, buf_addr, subbuf_size, num_subbuf,
+ lttng_chan_buf, buf_addr, subbuf_size, num_subbuf,
switch_timer_interval, read_timer_interval,
stream_fds, nr_stream_fds, blocking_timeout);
if (!handle)
goto error;
- lttng_chan->handle = handle;
- lttng_chan->chan = shmp(handle, handle->chan);
- return lttng_chan;
+ lttng_chan_buf->handle = handle;
+ lttng_chan_buf->chan = shmp(handle, handle->chan);
+ return lttng_chan_buf;
error:
- free(lttng_chan);
+ lttng_ust_free_channel_common(lttng_chan_buf->parent);
return NULL;
}
static
-void lttng_channel_destroy(struct lttng_channel *chan)
+void lttng_channel_destroy(struct lttng_ust_channel_buffer *lttng_chan_buf)
{
- channel_destroy(chan->chan, chan->handle, 1);
- free(chan);
+ channel_destroy(lttng_chan_buf->chan, lttng_chan_buf->handle, 1);
+ lttng_ust_free_channel_common(lttng_chan_buf->parent);
}
static
#define LTTNG_PROC_NS_PATH_MAX 40
struct lttng_ust_session;
-struct lttng_channel;
-struct lttng_event;
+struct lttng_ust_channel_buffer;
struct lttng_ust_ctx_field;
struct lttng_ust_lib_ring_buffer_ctx;
struct lttng_ust_ctx_value;
+struct lttng_ust_event_recorder;
struct lttng_ust_event_notifier;
__attribute__((visibility("hidden")))
__attribute__((visibility("hidden")))
void lttng_ust_dummy_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan);
+ struct lttng_ust_channel_buffer *chan);
__attribute__((visibility("hidden")))
void lttng_ust_dummy_get_value(struct lttng_ust_ctx_field *field,
struct lttng_ust_ctx_value *value);
}
static
-int lttng_is_channel_ready(struct lttng_channel *lttng_chan)
+int lttng_is_channel_ready(struct lttng_ust_channel_buffer *lttng_chan)
{
struct lttng_ust_lib_ring_buffer_channel *chan;
unsigned int nr_streams, exp_streams;
int chan_objd;
struct lttng_ust_shm_handle *channel_handle;
struct lttng_ust_abi_channel_config *lttng_chan_config;
- struct lttng_channel *lttng_chan;
+ struct lttng_ust_channel_buffer *lttng_chan_buf;
struct lttng_ust_lib_ring_buffer_channel *chan;
struct lttng_ust_lib_ring_buffer_config *config;
void *chan_data;
goto active; /* Refuse to add channel to active session */
}
- lttng_chan = zmalloc(sizeof(struct lttng_channel));
- if (!lttng_chan) {
+ lttng_chan_buf = lttng_ust_alloc_channel_buffer();
+ if (!lttng_chan_buf) {
ret = -ENOMEM;
- goto lttng_chan_error;
+ goto lttng_chan_buf_error;
}
channel_handle = channel_handle_create(chan_data, len, wakeup_fd);
}
/* Initialize our lttng chan */
- lttng_chan->chan = chan;
- lttng_chan->tstate = 1;
- lttng_chan->enabled = 1;
- lttng_chan->ctx = NULL;
- lttng_chan->session = session;
- lttng_chan->ops = &transport->ops;
- memcpy(<tng_chan->chan->backend.config,
+ lttng_chan_buf->parent->enabled = 1;
+ lttng_chan_buf->parent->session = session;
+
+ lttng_chan_buf->priv->parent.tstate = 1;
+
+ lttng_chan_buf->ctx = NULL;
+ lttng_chan_buf->ops = &transport->ops;
+ lttng_chan_buf->chan = chan;
+ lttng_chan_buf->handle = channel_handle;
+
+ memcpy(&chan->backend.config,
transport->client_config,
- sizeof(lttng_chan->chan->backend.config));
- cds_list_add(<tng_chan->node, &session->priv->chan_head);
- lttng_chan->header_type = 0;
- lttng_chan->handle = channel_handle;
- lttng_chan->type = type;
+ sizeof(chan->backend.config));
+ cds_list_add(<tng_chan_buf->priv->node, &session->priv->chan_head);
+ lttng_chan_buf->priv->header_type = 0;
+ lttng_chan_buf->priv->type = type;
/* Copy fields from lttng ust chan config. */
- lttng_chan->id = lttng_chan_config->id;
- memcpy(lttng_chan->uuid, lttng_chan_config->uuid, LTTNG_UST_UUID_LEN);
- channel_set_private(chan, lttng_chan);
+ lttng_chan_buf->priv->id = lttng_chan_config->id;
+ memcpy(lttng_chan_buf->priv->uuid, lttng_chan_config->uuid, LTTNG_UST_UUID_LEN);
+ channel_set_private(chan, lttng_chan_buf);
/*
* We tolerate no failure path after channel creation. It will stay
* invariant for the rest of the session.
*/
- objd_set_private(chan_objd, lttng_chan);
- lttng_chan->objd = chan_objd;
+ objd_set_private(chan_objd, lttng_chan_buf);
+ lttng_chan_buf->priv->parent.objd = chan_objd;
/* The channel created holds a reference on the session */
objd_ref(session_objd);
return chan_objd;
notransport:
alloc_error:
channel_destroy(chan, channel_handle, 0);
- free(lttng_chan);
+ lttng_ust_free_channel_common(lttng_chan_buf->parent);
return ret;
handle_error:
- free(lttng_chan);
-lttng_chan_error:
+ lttng_ust_free_channel_common(lttng_chan_buf->parent);
+lttng_chan_buf_error:
active:
invalid:
return ret;
int lttng_abi_map_stream(int channel_objd, struct lttng_ust_abi_stream *info,
union lttng_ust_abi_args *uargs, void *owner)
{
- struct lttng_channel *channel = objd_private(channel_objd);
+ struct lttng_ust_channel_buffer *lttng_chan_buf = objd_private(channel_objd);
int ret;
- ret = channel_handle_add_stream(channel->handle,
+ ret = channel_handle_add_stream(lttng_chan_buf->handle,
uargs->stream.shm_fd, uargs->stream.wakeup_fd,
info->stream_nr, info->len);
if (ret)
void *owner,
enum lttng_enabler_format_type format_type)
{
- struct lttng_channel *channel = objd_private(channel_objd);
+ struct lttng_ust_channel_buffer *channel = objd_private(channel_objd);
struct lttng_event_enabler *enabler;
int event_objd, ret;
long lttng_channel_cmd(int objd, unsigned int cmd, unsigned long arg,
union lttng_ust_abi_args *uargs, void *owner)
{
- struct lttng_channel *channel = objd_private(objd);
+ struct lttng_ust_channel_buffer *lttng_chan_buf = objd_private(objd);
if (cmd != LTTNG_UST_ABI_STREAM) {
/*
* Check if channel received all streams.
*/
- if (!lttng_is_channel_ready(channel))
+ if (!lttng_is_channel_ready(lttng_chan_buf))
return -EPERM;
}
case LTTNG_UST_ABI_CONTEXT:
return lttng_abi_add_context(objd,
(struct lttng_ust_abi_context *) arg, uargs,
- &channel->ctx, channel->session);
+ <tng_chan_buf->ctx,
+ lttng_chan_buf->parent->session);
case LTTNG_UST_ABI_ENABLE:
- return lttng_channel_enable(channel);
+ return lttng_channel_enable(lttng_chan_buf->parent);
case LTTNG_UST_ABI_DISABLE:
- return lttng_channel_disable(channel);
+ return lttng_channel_disable(lttng_chan_buf->parent);
case LTTNG_UST_ABI_FLUSH_BUFFER:
- return channel->ops->priv->flush_buffer(channel->chan, channel->handle);
+ return lttng_chan_buf->ops->priv->flush_buffer(lttng_chan_buf->chan,
+ lttng_chan_buf->handle);
default:
return -EINVAL;
}
static
int lttng_channel_release(int objd)
{
- struct lttng_channel *channel = objd_private(objd);
+ struct lttng_ust_channel_buffer *lttng_chan_buf = objd_private(objd);
- if (channel)
- return lttng_ust_abi_objd_unref(channel->session->priv->objd, 0);
+ if (lttng_chan_buf)
+ return lttng_ust_abi_objd_unref(lttng_chan_buf->parent->session->priv->objd, 0);
return 0;
}
struct lttng_event_enabler *event_enabler = objd_private(objd);
if (event_enabler)
- return lttng_ust_abi_objd_unref(event_enabler->chan->objd, 0);
+ return lttng_ust_abi_objd_unref(event_enabler->chan->priv->parent.objd, 0);
return 0;
}
void lttng_ust_dummy_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *chan)
{
char sel_char = (char) LTTNG_UST_DYNAMIC_TYPE_NONE;
}
return 1;
}
+
+struct lttng_ust_channel_buffer *lttng_ust_alloc_channel_buffer(void)
+{
+ struct lttng_ust_channel_buffer *lttng_chan_buf;
+ struct lttng_ust_channel_common *lttng_chan_common;
+ struct lttng_ust_channel_buffer_private *lttng_chan_buf_priv;
+
+ lttng_chan_buf = zmalloc(sizeof(struct lttng_ust_channel_buffer));
+ if (!lttng_chan_buf)
+ goto lttng_chan_buf_error;
+ lttng_chan_buf->struct_size = sizeof(struct lttng_ust_channel_buffer);
+ lttng_chan_common = zmalloc(sizeof(struct lttng_ust_channel_common));
+ if (!lttng_chan_common)
+ goto lttng_chan_common_error;
+ lttng_chan_common->struct_size = sizeof(struct lttng_ust_channel_common);
+ lttng_chan_buf_priv = zmalloc(sizeof(struct lttng_ust_channel_buffer_private));
+ if (!lttng_chan_buf_priv)
+ goto lttng_chan_buf_priv_error;
+ lttng_chan_buf->parent = lttng_chan_common;
+ lttng_chan_common->type = LTTNG_UST_CHANNEL_TYPE_BUFFER;
+ lttng_chan_common->child = lttng_chan_buf;
+ lttng_chan_buf->priv = lttng_chan_buf_priv;
+ lttng_chan_common->priv = <tng_chan_buf_priv->parent;
+ lttng_chan_buf_priv->pub = lttng_chan_buf;
+ lttng_chan_buf_priv->parent.pub = lttng_chan_common;
+
+ return lttng_chan_buf;
+
+lttng_chan_buf_priv_error:
+ free(lttng_chan_common);
+lttng_chan_common_error:
+ free(lttng_chan_buf);
+lttng_chan_buf_error:
+ return NULL;
+}
+
+void lttng_ust_free_channel_common(struct lttng_ust_channel_common *chan)
+{
+ switch (chan->type) {
+ case LTTNG_UST_CHANNEL_TYPE_BUFFER:
+ {
+ struct lttng_ust_channel_buffer *chan_buf;
+
+ chan_buf = (struct lttng_ust_channel_buffer *)chan->child;
+ free(chan_buf->parent);
+ free(chan_buf->priv);
+ free(chan_buf);
+ break;
+ }
+ default:
+ abort();
+ }
+}
struct lttng_event_enabler {
struct lttng_enabler base;
struct cds_list_head node; /* per-session list of enablers */
- struct lttng_channel *chan;
+ struct lttng_ust_channel_buffer *chan;
/*
* Unused, but kept around to make it explicit that the tracer can do
* it.
uint64_t id; /* Enumeration ID in sessiond */
};
+struct lttng_ust_shm_handle;
+
struct lttng_ust_channel_ops_private {
struct lttng_ust_channel_ops *pub; /* Public channels ops interface */
- struct lttng_channel *(*channel_create)(const char *name,
+ struct lttng_ust_channel_buffer *(*channel_create)(const char *name,
void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int switch_timer_interval,
uint32_t chan_id,
const int *stream_fds, int nr_stream_fds,
int64_t blocking_timeout);
- void (*channel_destroy)(struct lttng_channel *chan);
+ void (*channel_destroy)(struct lttng_ust_channel_buffer *chan);
/*
* packet_avail_size returns the available size in the current
* packet. Note that the size returned is only a hint, since it
struct lttng_ust_shm_handle *handle);
};
+struct lttng_ust_channel_common_private {
+ struct lttng_ust_channel_common *pub; /* Public channel interface */
+
+ int objd; /* Object associated with channel. */
+ int tstate:1; /* Transient enable state */
+};
+
+struct lttng_ust_channel_buffer_private {
+ struct lttng_ust_channel_common_private parent;
+
+ struct lttng_ust_channel_buffer *pub; /* Public channel buffer interface */
+ struct cds_list_head node; /* Channel list in session */
+ int header_type; /* 0: unset, 1: compact, 2: large */
+ unsigned int id; /* Channel ID */
+ enum lttng_ust_abi_chan_type type;
+ unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
+};
+
/*
* IMPORTANT: this structure is part of the ABI between the consumer
* daemon and the UST library within traced applications. Changing it
struct lttng_event_enabler *lttng_event_enabler_create(
enum lttng_enabler_format_type format_type,
struct lttng_ust_abi_event *event_param,
- struct lttng_channel *chan);
+ struct lttng_ust_channel_buffer *chan);
/*
* Destroy a `struct lttng_event_enabler` object.
void lttng_handle_pending_statedump(void *owner);
__attribute__((visibility("hidden")))
-struct lttng_channel *lttng_channel_create(struct lttng_ust_session *session,
- const char *transport_name,
- void *buf_addr,
- size_t subbuf_size, size_t num_subbuf,
- unsigned int switch_timer_interval,
- unsigned int read_timer_interval,
- int **shm_fd, int **wait_fd,
- uint64_t **memory_map_size,
- struct lttng_channel *chan_priv_init);
+int lttng_channel_enable(struct lttng_ust_channel_common *lttng_channel);
__attribute__((visibility("hidden")))
-int lttng_channel_enable(struct lttng_channel *channel);
-
-__attribute__((visibility("hidden")))
-int lttng_channel_disable(struct lttng_channel *channel);
+int lttng_channel_disable(struct lttng_ust_channel_common *lttng_channel);
__attribute__((visibility("hidden")))
void lttng_transport_register(struct lttng_transport *transport);
__attribute__((visibility("hidden")))
void lttng_ust_abi_objd_table_owner_cleanup(void *owner);
+__attribute__((visibility("hidden")))
+struct lttng_ust_channel_buffer *lttng_ust_alloc_channel_buffer(void);
+
+__attribute__((visibility("hidden")))
+void lttng_ust_free_channel_common(struct lttng_ust_channel_common *chan);
+
#endif /* _LTTNG_UST_EVENTS_INTERNAL_H */
static
void test_record(struct lttng_ust_ctx_field *field,
struct lttng_ust_lib_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_ust_channel_buffer *lttng_chan_buf)
{
int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES;
char sel_char = (char) sel;
lib_ring_buffer_align_ctx(ctx, lttng_alignof(char));
- chan->ops->event_write(ctx, &sel_char, sizeof(sel_char));
+ lttng_chan_buf->ops->event_write(ctx, &sel_char, sizeof(sel_char));
switch (sel) {
case LTTNG_UST_DYNAMIC_TYPE_NONE:
break;
int8_t v = -8;
lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
- chan->ops->event_write(ctx, &v, sizeof(v));
+ lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
break;
}
case LTTNG_UST_DYNAMIC_TYPE_S16:
int16_t v = -16;
lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
- chan->ops->event_write(ctx, &v, sizeof(v));
+ lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
break;
}
case LTTNG_UST_DYNAMIC_TYPE_S32:
int32_t v = -32;
lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
- chan->ops->event_write(ctx, &v, sizeof(v));
+ lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
break;
}
case LTTNG_UST_DYNAMIC_TYPE_S64:
int64_t v = -64;
lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
- chan->ops->event_write(ctx, &v, sizeof(v));
+ lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
break;
}
case LTTNG_UST_DYNAMIC_TYPE_U8:
uint8_t v = 8;
lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
- chan->ops->event_write(ctx, &v, sizeof(v));
+ lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
break;
}
case LTTNG_UST_DYNAMIC_TYPE_U16:
uint16_t v = 16;
lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
- chan->ops->event_write(ctx, &v, sizeof(v));
+ lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
break;
}
case LTTNG_UST_DYNAMIC_TYPE_U32:
uint32_t v = 32;
lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
- chan->ops->event_write(ctx, &v, sizeof(v));
+ lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
break;
}
case LTTNG_UST_DYNAMIC_TYPE_U64:
uint64_t v = 64;
lib_ring_buffer_align_ctx(ctx, lttng_alignof(v));
- chan->ops->event_write(ctx, &v, sizeof(v));
+ lttng_chan_buf->ops->event_write(ctx, &v, sizeof(v));
break;
}
case LTTNG_UST_DYNAMIC_TYPE_FLOAT:
float f = 22322.0;
lib_ring_buffer_align_ctx(ctx, lttng_alignof(f));
- chan->ops->event_write(ctx, &f, sizeof(f));
+ lttng_chan_buf->ops->event_write(ctx, &f, sizeof(f));
break;
}
case LTTNG_UST_DYNAMIC_TYPE_DOUBLE:
double d = 2.0;
lib_ring_buffer_align_ctx(ctx, lttng_alignof(d));
- chan->ops->event_write(ctx, &d, sizeof(d));
+ lttng_chan_buf->ops->event_write(ctx, &d, sizeof(d));
break;
}
case LTTNG_UST_DYNAMIC_TYPE_STRING:
{
const char *str = "teststr";
- chan->ops->event_write(ctx, str, strlen(str) + 1);
+ lttng_chan_buf->ops->event_write(ctx, str, strlen(str) + 1);
break;
}
default: