struct consumer_output *consumer,
struct consumer_socket *consumer_sock,
const char *session_name, const char *hostname,
- int session_live_timer,
+ const char *base_path, int session_live_timer,
const uint64_t *current_chunk_id,
- time_t session_creation_time)
+ time_t session_creation_time,
+ bool session_name_contains_creation_time)
{
int ret;
struct lttcomm_relayd_sock *rsock = NULL;
/* Send relayd socket to consumer. */
ret = consumer_send_relayd_socket(consumer_sock, rsock, consumer,
relayd_uri->stype, session_id,
- session_name, hostname, session_live_timer,
- current_chunk_id, session_creation_time);
+ session_name, hostname, base_path,
+ session_live_timer, current_chunk_id,
+ session_creation_time, session_name_contains_creation_time);
if (ret < 0) {
status = LTTNG_ERR_ENABLE_CONSUMER_FAIL;
goto close_sock;
enum lttng_domain_type domain,
unsigned int session_id, struct consumer_output *consumer,
struct consumer_socket *sock, const char *session_name,
- const char *hostname, int session_live_timer,
- const uint64_t *current_chunk_id, time_t session_creation_time)
+ const char *hostname, const char *base_path, int session_live_timer,
+ const uint64_t *current_chunk_id, time_t session_creation_time,
+ bool session_name_contains_creation_time)
{
enum lttng_error_code status = LTTNG_OK;
if (!sock->control_sock_sent) {
status = send_consumer_relayd_socket(session_id,
&consumer->dst.net.control, consumer, sock,
- session_name, hostname, session_live_timer,
- current_chunk_id, session_creation_time);
+ session_name, hostname, base_path, session_live_timer,
+ current_chunk_id, session_creation_time,
+ session_name_contains_creation_time);
if (status != LTTNG_OK) {
goto error;
}
if (!sock->data_sock_sent) {
status = send_consumer_relayd_socket(session_id,
&consumer->dst.net.data, consumer, sock,
- session_name, hostname, session_live_timer,
- current_chunk_id, session_creation_time);
+ session_name, hostname, base_path, session_live_timer,
+ current_chunk_id, session_creation_time,
+ session_name_contains_creation_time);
if (status != LTTNG_OK) {
goto error;
}
ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_UST, session->id,
usess->consumer, socket,
session->name, session->hostname,
+ session->base_path,
session->live_timer,
current_chunk_id.is_set ? ¤t_chunk_id.value : NULL,
- session->creation_time);
+ session->creation_time,
+ session->name_contains_creation_time);
pthread_mutex_unlock(socket->lock);
if (ret != LTTNG_OK) {
goto error;
ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_KERNEL, session->id,
ksess->consumer, socket,
session->name, session->hostname,
+ session->base_path,
session->live_timer,
current_chunk_id.is_set ? ¤t_chunk_id.value : NULL,
- session->creation_time);
+ session->creation_time,
+ session->name_contains_creation_time);
pthread_mutex_unlock(socket->lock);
if (ret != LTTNG_OK) {
goto error;
const char *session_name;
struct ltt_session *new_session = NULL;
enum lttng_session_descriptor_status descriptor_status;
+ const char *base_path;
session_lock_list();
if (home_path) {
ret_code = LTTNG_ERR_INVALID;
goto end;
}
+ ret = lttng_session_descriptor_get_base_path(descriptor, &base_path);
+ if (ret) {
+ ret_code = LTTNG_ERR_INVALID;
+ goto end;
+ }
ret_code = session_create(session_name, creds->uid, creds->gid,
- &new_session);
+ base_path, &new_session);
if (ret_code != LTTNG_OK) {
goto end;
}
struct lttng_ht_iter iter;
struct consumer_socket *socket;
LTTNG_OPTIONAL(uint64_t) current_chunk_id = {};
+ const char *base_path;
assert(output);
assert(session);
goto error;
}
+ /*
+ * The snapshot record URI base path overrides the session
+ * base path.
+ */
+ if (output->dst.net.control.subdir[0] != '\0') {
+ base_path = output->dst.net.control.subdir;
+ } else {
+ base_path = session->base_path;
+ }
+
/*
* For each consumer socket, create and send the relayd object of the
* snapshot output.
status = send_consumer_relayd_sockets(0, session->id,
output, socket,
session->name, session->hostname,
+ base_path,
session->live_timer,
current_chunk_id.is_set ? ¤t_chunk_id.value : NULL,
- session->creation_time);
+ session->creation_time,
+ session->name_contains_creation_time);
pthread_mutex_unlock(socket->lock);
if (status != LTTNG_OK) {
rcu_read_unlock();