metadata_channel = consumer_find_channel(key);
if (!metadata_channel) {
- ERR("UST snapshot metadata channel not found for key %lu", key);
+ ERR("UST snapshot metadata channel not found for key %" PRIu64,
+ key);
ret = -1;
goto error;
}
channel = consumer_find_channel(key);
if (!channel) {
- ERR("UST snapshot channel not found for key %lu", key);
+ ERR("UST snapshot channel not found for key %" PRIu64, key);
ret = -1;
goto error;
}
assert(!channel->monitor);
- DBG("UST consumer snapshot channel %lu", key);
+ DBG("UST consumer snapshot channel %" PRIu64, key);
cds_list_for_each_entry(stream, &channel->streams.head, send_node) {
/* Lock stream because we are about to change its state. */
padded_len - len);
if (use_relayd) {
if (read_len != len) {
- ret = -1;
+ ret = -EPERM;
goto error_put_subbuf;
}
} else {
if (read_len != padded_len) {
- ret = -1;
+ ret = -EPERM;
goto error_put_subbuf;
}
}
goto end_channel_error;
}
+ /*
+ * Assign UST application UID to the channel. This value is ignored for
+ * per PID buffers. This is specific to UST thus setting this after the
+ * allocation.
+ */
+ channel->ust_app_uid = msg.u.ask_channel.ust_app_uid;
+
/* Build channel attributes from received message. */
attr.subbuf_size = msg.u.ask_channel.subbuf_size;
attr.num_subbuf = msg.u.ask_channel.num_subbuf;
request.session_id = channel->session_id;
request.session_id_per_pid = channel->session_id_per_pid;
- request.uid = channel->uid;
+ /*
+ * Request the application UID here so the metadata of that application can
+ * be sent back. The channel UID corresponds to the user UID of the session
+ * used for the rights on the stream file(s).
+ */
+ request.uid = channel->ust_app_uid;
request.key = channel->key;
+
DBG("Sending metadata request to sessiond, session id %" PRIu64
- ", per-pid %" PRIu64,
- channel->session_id,
- channel->session_id_per_pid);
+ ", per-pid %" PRIu64 ", app UID %u and channek key %" PRIu64,
+ request.session_id, request.session_id_per_pid, request.uid,
+ request.key);
pthread_mutex_lock(&ctx->metadata_socket_lock);
ret = lttcomm_send_unix_sock(ctx->consumer_metadata_socket, &request,