The registry indexing for per-pid sessions is done with a per-pid
session id. So for per-pid buffers, we need to send the per-pid session
id as well as the global session id to the consumer in order to give it
enough information if it needs to request metadata later.
This patch adds the session_id_per_pid to the channel creation message
and to the consumer. When the sessiond receives a metadata_request,
depending on the buffer type (per-pid or per-uid), it selects the right
id to do the registry lookup.
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
unsigned char *uuid,
uint32_t chan_id,
uint64_t tracefile_size,
unsigned char *uuid,
uint32_t chan_id,
uint64_t tracefile_size,
- uint64_t tracefile_count)
+ uint64_t tracefile_count,
+ uint64_t session_id_per_pid)
msg->u.ask_channel.output = output;
msg->u.ask_channel.type = type;
msg->u.ask_channel.session_id = session_id;
msg->u.ask_channel.output = output;
msg->u.ask_channel.type = type;
msg->u.ask_channel.session_id = session_id;
+ msg->u.ask_channel.session_id_per_pid = session_id_per_pid;
msg->u.ask_channel.uid = uid;
msg->u.ask_channel.gid = gid;
msg->u.ask_channel.relayd_id = relayd_id;
msg->u.ask_channel.uid = uid;
msg->u.ask_channel.gid = gid;
msg->u.ask_channel.relayd_id = relayd_id;
unsigned char *uuid,
uint32_t chan_id,
uint64_t tracefile_size,
unsigned char *uuid,
uint32_t chan_id,
uint64_t tracefile_size,
- uint64_t tracefile_count);
+ uint64_t tracefile_count,
+ uint64_t session_id_per_pid);
void consumer_init_stream_comm_msg(struct lttcomm_consumer_msg *msg,
enum lttng_consumer_command cmd,
uint64_t channel_key,
void consumer_init_stream_comm_msg(struct lttcomm_consumer_msg *msg,
enum lttng_consumer_command cmd,
uint64_t channel_key,
registry->uuid,
chan_id,
ua_chan->tracefile_size,
registry->uuid,
chan_id,
ua_chan->tracefile_size,
- ua_chan->tracefile_count);
+ ua_chan->tracefile_count,
+ ua_sess->id);
- DBG("Metadata request received for session %u, key %" PRIu64,
+ DBG("Metadata request received for session %" PRIu64 ", key %" PRIu64,
request.session_id, request.key);
reg_uid = buffer_reg_uid_find(request.session_id,
request.session_id, request.key);
reg_uid = buffer_reg_uid_find(request.session_id,
ust_reg = reg_uid->registry->reg.ust;
} else {
struct buffer_reg_pid *reg_pid =
ust_reg = reg_uid->registry->reg.ust;
} else {
struct buffer_reg_pid *reg_pid =
- buffer_reg_pid_find(request.session_id);
+ buffer_reg_pid_find(request.session_id_per_pid);
- DBG("PID registry not found for session id %u",
- request.session_id);
+ DBG("PID registry not found for session id %" PRIu64,
+ request.session_id_per_pid);
msg.cmd_type = LTTNG_ERR_UND;
(void) consumer_send_msg(socket, &msg);
msg.cmd_type = LTTNG_ERR_UND;
(void) consumer_send_msg(socket, &msg);
uint64_t relayd_id,
enum lttng_event_output output,
uint64_t tracefile_size,
uint64_t relayd_id,
enum lttng_event_output output,
uint64_t tracefile_size,
- uint64_t tracefile_count)
+ uint64_t tracefile_count,
+ uint64_t session_id_per_pid)
{
struct lttng_consumer_channel *channel;
{
struct lttng_consumer_channel *channel;
channel->key = key;
channel->refcount = 0;
channel->session_id = session_id;
channel->key = key;
channel->refcount = 0;
channel->session_id = session_id;
+ channel->session_id_per_pid = session_id_per_pid;
channel->uid = uid;
channel->gid = gid;
channel->relayd_id = relayd_id;
channel->uid = uid;
channel->gid = gid;
channel->relayd_id = relayd_id;
int refcount;
/* Tracing session id on the session daemon side. */
uint64_t session_id;
int refcount;
/* Tracing session id on the session daemon side. */
uint64_t session_id;
+ /*
+ * Session id when requesting metadata to the session daemon for
+ * a session with per-PID buffers.
+ */
+ uint64_t session_id_per_pid;
/* Channel trace file path name. */
char pathname[PATH_MAX];
/* Channel name. */
/* Channel trace file path name. */
char pathname[PATH_MAX];
/* Channel name. */
uint64_t relayd_id,
enum lttng_event_output output,
uint64_t tracefile_size,
uint64_t relayd_id,
enum lttng_event_output output,
uint64_t tracefile_size,
- uint64_t tracefile_count);
+ uint64_t tracefile_count,
+ uint64_t session_id_per_pid);
void consumer_del_stream(struct lttng_consumer_stream *stream,
struct lttng_ht *ht);
void consumer_del_metadata_stream(struct lttng_consumer_stream *stream,
void consumer_del_stream(struct lttng_consumer_stream *stream,
struct lttng_ht *ht);
void consumer_del_metadata_stream(struct lttng_consumer_stream *stream,
msg.u.channel.name, msg.u.channel.uid, msg.u.channel.gid,
msg.u.channel.relayd_id, msg.u.channel.output,
msg.u.channel.tracefile_size,
msg.u.channel.name, msg.u.channel.uid, msg.u.channel.gid,
msg.u.channel.relayd_id, msg.u.channel.output,
msg.u.channel.tracefile_size,
- msg.u.channel.tracefile_count);
+ msg.u.channel.tracefile_count, 0);
if (new_channel == NULL) {
lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_OUTFD_ERROR);
goto end_nosignal;
if (new_channel == NULL) {
lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_OUTFD_ERROR);
goto end_nosignal;
* per PID registry indexed by session id ignoring the other values.
*/
struct lttcomm_metadata_request_msg {
* per PID registry indexed by session id ignoring the other values.
*/
struct lttcomm_metadata_request_msg {
- unsigned int session_id; /* Tracing session id */
+ uint64_t session_id; /* Tracing session id */
+ uint64_t session_id_per_pid; /* Tracing session id for per-pid */
uint32_t bits_per_long; /* Consumer ABI */
uint32_t uid;
uint64_t key; /* Metadata channel key. */
uint32_t bits_per_long; /* Consumer ABI */
uint32_t uid;
uint64_t key; /* Metadata channel key. */
uint32_t chan_id; /* Channel ID on the tracer side. */
uint64_t tracefile_size; /* bytes */
uint32_t tracefile_count; /* number of tracefiles */
uint32_t chan_id; /* Channel ID on the tracer side. */
uint64_t tracefile_size; /* bytes */
uint32_t tracefile_count; /* number of tracefiles */
+ uint64_t session_id_per_pid; /* Per-pid session ID. */
} LTTNG_PACKED ask_channel;
struct {
uint64_t key;
} LTTNG_PACKED ask_channel;
struct {
uint64_t key;
static struct lttng_consumer_channel *allocate_channel(uint64_t session_id,
const char *pathname, const char *name, uid_t uid, gid_t gid,
int relayd_id, uint64_t key, enum lttng_event_output output,
static struct lttng_consumer_channel *allocate_channel(uint64_t session_id,
const char *pathname, const char *name, uid_t uid, gid_t gid,
int relayd_id, uint64_t key, enum lttng_event_output output,
- uint64_t tracefile_size, uint64_t tracefile_count)
+ uint64_t tracefile_size, uint64_t tracefile_count,
+ uint64_t session_id_per_pid)
{
assert(pathname);
assert(name);
{
assert(pathname);
assert(name);
- return consumer_allocate_channel(key, session_id, pathname, name, uid, gid,
- relayd_id, output, tracefile_size, tracefile_count);
+ return consumer_allocate_channel(key, session_id, pathname, name, uid,
+ gid, relayd_id, output, tracefile_size,
+ tracefile_count, session_id_per_pid);
msg.u.ask_channel.relayd_id, msg.u.ask_channel.key,
(enum lttng_event_output) msg.u.ask_channel.output,
msg.u.ask_channel.tracefile_size,
msg.u.ask_channel.relayd_id, msg.u.ask_channel.key,
(enum lttng_event_output) msg.u.ask_channel.output,
msg.u.ask_channel.tracefile_size,
- msg.u.ask_channel.tracefile_count);
+ msg.u.ask_channel.tracefile_count,
+ msg.u.ask_channel.session_id_per_pid);
if (!channel) {
goto end_channel_error;
}
if (!channel) {
goto end_channel_error;
}
}
request.session_id = channel->session_id;
}
request.session_id = channel->session_id;
+ request.session_id_per_pid = channel->session_id_per_pid;
request.uid = channel->uid;
request.key = channel->key;
request.uid = channel->uid;
request.key = channel->key;
- DBG("Sending metadata request to sessiond, session %" PRIu64,
- channel->session_id);
+ DBG("Sending metadata request to sessiond, session id %" PRIu64
+ ", per-pid %" PRIu64,
+ channel->session_id,
+ channel->session_id_per_pid);
ret = lttcomm_send_unix_sock(ctx->consumer_metadata_socket, &request,
sizeof(request));
ret = lttcomm_send_unix_sock(ctx->consumer_metadata_socket, &request,
sizeof(request));