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>
Conflicts:
src/bin/lttng-sessiond/consumer.c
src/bin/lttng-sessiond/consumer.h
src/bin/lttng-sessiond/ust-consumer.c
src/common/consumer.c
src/common/consumer.h
src/common/kernel-consumer/kernel-consumer.c
src/common/sessiond-comm/sessiond-comm.h
src/common/ust-consumer/ust-consumer.c
uint32_t chan_id,
uint64_t tracefile_size,
uint64_t tracefile_count,
uint32_t chan_id,
uint64_t tracefile_size,
uint64_t tracefile_count,
+ uint64_t session_id_per_pid,
unsigned int monitor)
{
assert(msg);
unsigned int monitor)
{
assert(msg);
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;
uint32_t chan_id,
uint64_t tracefile_size,
uint64_t tracefile_count,
uint32_t chan_id,
uint64_t tracefile_size,
uint64_t tracefile_count,
+ uint64_t session_id_per_pid,
unsigned int monitor);
void consumer_init_stream_comm_msg(struct lttcomm_consumer_msg *msg,
enum lttng_consumer_command cmd,
unsigned int monitor);
void consumer_init_stream_comm_msg(struct lttcomm_consumer_msg *msg,
enum lttng_consumer_command cmd,
chan_id,
ua_chan->tracefile_size,
ua_chan->tracefile_count,
chan_id,
ua_chan->tracefile_size,
ua_chan->tracefile_count,
ua_sess->output_traces);
health_code_update();
ua_sess->output_traces);
health_code_update();
- 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);
enum lttng_event_output output,
uint64_t tracefile_size,
uint64_t tracefile_count,
enum lttng_event_output output,
uint64_t tracefile_size,
uint64_t tracefile_count,
+ uint64_t session_id_per_pid,
unsigned int monitor)
{
struct lttng_consumer_channel *channel;
unsigned int monitor)
{
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. */
enum lttng_event_output output,
uint64_t tracefile_size,
uint64_t tracefile_count,
enum lttng_event_output output,
uint64_t tracefile_size,
uint64_t tracefile_count,
+ uint64_t session_id_per_pid,
unsigned int monitor);
void consumer_del_stream(struct lttng_consumer_stream *stream,
struct lttng_ht *ht);
unsigned int monitor);
void consumer_del_stream(struct lttng_consumer_stream *stream,
struct lttng_ht *ht);
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,
msg.u.channel.monitor);
if (new_channel == NULL) {
lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_OUTFD_ERROR);
msg.u.channel.monitor);
if (new_channel == NULL) {
lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_OUTFD_ERROR);
* 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. */
/* Tells the consumer if the stream should be or not monitored. */
uint32_t monitor;
} LTTNG_PACKED ask_channel;
/* Tells the consumer if the stream should be or not monitored. */
uint32_t monitor;
} LTTNG_PACKED ask_channel;
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,
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 session_id_per_pid, unsigned int monitor)
{
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, monitor);
+ return consumer_allocate_channel(key, session_id, pathname, name, uid,
+ gid, relayd_id, output, tracefile_size,
+ tracefile_count, session_id_per_pid, monitor);
(enum lttng_event_output) msg.u.ask_channel.output,
msg.u.ask_channel.tracefile_size,
msg.u.ask_channel.tracefile_count,
(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.session_id_per_pid,
msg.u.ask_channel.monitor);
if (!channel) {
goto end_channel_error;
msg.u.ask_channel.monitor);
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));