unsigned int switch_timer_interval,
unsigned int read_timer_interval,
int *shm_fd, int *wait_fd,
- uint64_t *memory_map_size);
+ uint64_t *memory_map_size,
+ struct ltt_channel *chan_priv_init);
void (*channel_destroy)(struct ltt_channel *ltt_chan);
struct lttng_ust_lib_ring_buffer *(*buffer_read_open)(struct channel *chan,
struct lttng_ust_shm_handle *handle,
unsigned int switch_timer_interval,
unsigned int read_timer_interval,
int *shm_fd, int *wait_fd,
- uint64_t *memory_map_size);
+ uint64_t *memory_map_size,
+ struct ltt_channel *chan_priv_init);
struct ltt_channel *ltt_global_channel_create(struct ltt_session *session,
int overwrite, 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)
+ uint64_t *memory_map_size,
+ struct ltt_channel *chan_priv_init)
{
struct ltt_channel *chan = NULL;
struct ltt_transport *transport;
transport_name);
goto notransport;
}
+ chan_priv_init->id = session->free_chan_id++;
+ chan_priv_init->session = session;
/*
* Note: the channel creation op already writes into the packet
* headers. Therefore the "chan" information used as input
chan = transport->ops.channel_create("[lttng]", buf_addr,
subbuf_size, num_subbuf, switch_timer_interval,
read_timer_interval, shm_fd, wait_fd,
- memory_map_size);
+ memory_map_size, chan_priv_init);
if (!chan)
goto create_error;
- chan->session = session;
- chan->id = session->free_chan_id++;
chan->enabled = 1;
chan->ops = &transport->ops;
cds_list_add(&chan->list, &session->chan);
unsigned int switch_timer_interval,
unsigned int read_timer_interval,
int *shm_fd, int *wait_fd,
- uint64_t *memory_map_size)
+ uint64_t *memory_map_size,
+ struct ltt_channel *chan_priv_init)
{
void *priv;
struct ltt_channel *ltt_chan = NULL;
handle = channel_create(&client_config, name,
&priv, __alignof__(*ltt_chan), sizeof(*ltt_chan),
+ chan_priv_init,
buf_addr, subbuf_size, num_subbuf,
switch_timer_interval, read_timer_interval,
shm_fd, wait_fd, memory_map_size);
unsigned int switch_timer_interval,
unsigned int read_timer_interval,
int *shm_fd, int *wait_fd,
- uint64_t *memory_map_size)
+ uint64_t *memory_map_size,
+ struct ltt_channel *chan_priv_init)
{
void *priv;
struct ltt_channel *ltt_chan = NULL;
handle = channel_create(&client_config, name,
&priv, __alignof__(*ltt_chan), sizeof(*ltt_chan),
+ chan_priv_init,
buf_addr, subbuf_size, num_subbuf,
switch_timer_interval, read_timer_interval,
shm_fd, wait_fd, memory_map_size);
struct ltt_channel *chan;
int chan_objd;
int ret = 0;
+ struct ltt_channel chan_priv_init;
chan_objd = objd_alloc(NULL, <tng_channel_ops);
if (chan_objd < 0) {
transport_name = "<unknown>";
break;
}
+ memset(&chan_priv_init, 0, sizeof(chan_priv_init));
+ /* Copy of session UUID for consumer (availability through shm) */
+ memcpy(chan_priv_init.uuid, session->uuid, sizeof(session->uuid));
+
/*
* We tolerate no failure path after channel creation. It will stay
* invariant for the rest of the session.
chan_param->read_timer_interval,
&chan_param->shm_fd,
&chan_param->wait_fd,
- &chan_param->memory_map_size);
+ &chan_param->memory_map_size,
+ &chan_priv_init);
if (!chan) {
ret = -EINVAL;
goto chan_error;
}
/* The channel created holds a reference on the session */
objd_ref(session_objd);
- /* Copy of session UUID for consumer (availability through shm) */
- memcpy(chan->uuid, session->uuid, sizeof(session->uuid));
return chan_objd;
void **priv_data,
size_t priv_data_align,
size_t priv_data_size,
+ void *priv_data_init,
void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int switch_timer_interval,
* @name: name of the channel
* @priv_data: ring buffer client private data area pointer (output)
* @priv_data_size: length, in bytes, of the private data area.
+ * @priv_data_init: initialization data for private data.
* @buf_addr: pointer the the beginning of the preallocated buffer contiguous
* address mapping. It is used only by RING_BUFFER_STATIC
* configuration. It can be set to NULL for other backends.
void **priv_data,
size_t priv_data_align,
size_t priv_data_size,
+ void *priv_data_init,
void *buf_addr, size_t subbuf_size,
size_t num_subbuf, unsigned int switch_timer_interval,
unsigned int read_timer_interval,
if (!shmp(handle, priv_data_alloc))
goto error_append;
*priv_data = channel_get_private(chan);
+ memcpy(*priv_data, priv_data_init, priv_data_size);
} else {
chan->priv_data_offset = -1;
*priv_data = NULL;