char *session_name, char *hostname,
uint32_t *live_timer, bool *snapshot,
uint64_t *id_sessiond, lttng_uuid sessiond_uuid,
- bool *has_current_chunk, uint64_t *current_chunk_id)
+ bool *has_current_chunk, uint64_t *current_chunk_id,
+ time_t *creation_time)
{
int ret;
struct lttcomm_relayd_create_session_2_11 header;
header.live_timer = be32toh(header.live_timer);
header.current_chunk_id.value = be64toh(header.current_chunk_id.value);
header.current_chunk_id.is_set = !!header.current_chunk_id.is_set;
+ header.creation_time = be64toh(header.creation_time);
lttng_uuid_copy(sessiond_uuid, header.sessiond_uuid);
*snapshot = !!header.snapshot;
*current_chunk_id = header.current_chunk_id.value;
*has_current_chunk = header.current_chunk_id.is_set;
+ *creation_time = (time_t) header.creation_time;
ret = 0;
char *session_name, char *hostname,
uint32_t *live_timer, bool *snapshot,
uint64_t *id_sessiond, lttng_uuid sessiond_uuid,
- bool *has_current_chunk, uint64_t *current_chunk_id);
+ bool *has_current_chunk, uint64_t *current_chunk_id,
+ time_t *creation_time);
int cmd_recv_stream_2_11(const struct lttng_buffer_view *payload,
char **ret_path_name, char **ret_channel_name,
lttng_uuid sessiond_uuid = {};
LTTNG_OPTIONAL(uint64_t) id_sessiond = {};
LTTNG_OPTIONAL(uint64_t) current_chunk_id = {};
+ LTTNG_OPTIONAL(time_t) creation_time = {};
if (conn->minor < 4) {
/* From 2.1 to 2.3 */
hostname, &live_timer, &snapshot);
} else {
bool has_current_chunk;
+ uint64_t current_chunk_id_value;
+ time_t creation_time_value;
+ uint64_t id_sessiond_value;
/* From 2.11 to ... */
- ret = cmd_create_session_2_11(payload, session_name,
- hostname, &live_timer, &snapshot,
- &id_sessiond.value, sessiond_uuid,
- &has_current_chunk,
- ¤t_chunk_id.value);
+ ret = cmd_create_session_2_11(payload, session_name, hostname,
+ &live_timer, &snapshot, &id_sessiond_value,
+ sessiond_uuid, &has_current_chunk,
+ ¤t_chunk_id_value, &creation_time_value);
if (lttng_uuid_is_nil(sessiond_uuid)) {
/* The nil UUID is reserved for pre-2.11 clients. */
ERR("Illegal nil UUID announced by peer in create session command");
ret = -1;
goto send_reply;
}
- id_sessiond.is_set = true;
- current_chunk_id.is_set = has_current_chunk;
+ LTTNG_OPTIONAL_SET(&id_sessiond, id_sessiond_value);
+ LTTNG_OPTIONAL_SET(&creation_time, creation_time_value);
+ if (has_current_chunk) {
+ LTTNG_OPTIONAL_SET(¤t_chunk_id,
+ current_chunk_id_value);
+ }
}
if (ret < 0) {
snapshot, sessiond_uuid,
id_sessiond.is_set ? &id_sessiond.value : NULL,
current_chunk_id.is_set ? ¤t_chunk_id.value : NULL,
+ creation_time.is_set ? &creation_time.value : NULL,
conn->major, conn->minor);
if (!session) {
ret = -1;
* Return allocated session or else NULL.
*/
struct relay_session *session_create(const char *session_name,
- const char *hostname, uint32_t live_timer,
- bool snapshot, const lttng_uuid sessiond_uuid,
- uint64_t *id_sessiond, uint64_t *current_chunk_id,
- uint32_t major, uint32_t minor)
+ const char *hostname,
+ uint32_t live_timer,
+ bool snapshot,
+ const lttng_uuid sessiond_uuid,
+ const uint64_t *id_sessiond,
+ const uint64_t *current_chunk_id,
+ const time_t *creation_time,
+ uint32_t major,
+ uint32_t minor)
{
int ret;
struct relay_session *session;
}
lttng_ht_add_unique_u64(sessions_ht, &session->session_n);
+ if (creation_time) {
+ LTTNG_OPTIONAL_SET(&session->creation_time, *creation_time);
+ }
return session;
error:
* the other cases.
*/
lttng_uuid sessiond_uuid;
+ LTTNG_OPTIONAL(time_t) creation_time;
char session_name[LTTNG_NAME_MAX];
char hostname[LTTNG_HOST_NAME_MAX];
uint32_t live_timer;
};
struct relay_session *session_create(const char *session_name,
- const char *hostname, uint32_t live_timer,
- bool snapshot, const lttng_uuid sessiond_uuid,
- uint64_t *id_sessiond, uint64_t *current_chunk_id,
- uint32_t major, uint32_t minor);
+ const char *hostname,
+ uint32_t live_timer,
+ bool snapshot,
+ const lttng_uuid sessiond_uuid,
+ const uint64_t *id_sessiond,
+ const uint64_t *current_chunk_id,
+ const time_t *creation_time,
+ uint32_t major,
+ uint32_t minor);
struct relay_session *session_get_by_id(uint64_t id);
bool session_get(struct relay_session *session);
void session_put(struct relay_session *session);
struct consumer_socket *consumer_sock,
const char *session_name, const char *hostname,
int session_live_timer,
- const uint64_t *current_chunk_id)
+ const uint64_t *current_chunk_id,
+ time_t session_creation_time)
{
int ret;
struct lttcomm_relayd_sock *rsock = NULL;
ret = consumer_send_relayd_socket(consumer_sock, rsock, consumer,
relayd_uri->stype, session_id,
session_name, hostname, session_live_timer,
- current_chunk_id);
+ current_chunk_id, session_creation_time);
if (ret < 0) {
status = LTTNG_ERR_ENABLE_CONSUMER_FAIL;
goto close_sock;
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)
+ const uint64_t *current_chunk_id, time_t session_creation_time)
{
enum lttng_error_code status = LTTNG_OK;
status = send_consumer_relayd_socket(session_id,
&consumer->dst.net.control, consumer, sock,
session_name, hostname, session_live_timer,
- current_chunk_id);
+ current_chunk_id, session_creation_time);
if (status != LTTNG_OK) {
goto error;
}
status = send_consumer_relayd_socket(session_id,
&consumer->dst.net.data, consumer, sock,
session_name, hostname, session_live_timer,
- current_chunk_id);
+ current_chunk_id, session_creation_time);
if (status != LTTNG_OK) {
goto error;
}
usess->consumer, socket,
session->name, session->hostname,
session->live_timer,
- current_chunk_id.is_set ? ¤t_chunk_id.value : NULL);
+ current_chunk_id.is_set ? ¤t_chunk_id.value : NULL,
+ session->creation_time);
pthread_mutex_unlock(socket->lock);
if (ret != LTTNG_OK) {
goto error;
ksess->consumer, socket,
session->name, session->hostname,
session->live_timer,
- current_chunk_id.is_set ? ¤t_chunk_id.value : NULL);
+ current_chunk_id.is_set ? ¤t_chunk_id.value : NULL,
+ session->creation_time);
pthread_mutex_unlock(socket->lock);
if (ret != LTTNG_OK) {
goto error;
snap_output->consumer, socket,
session->name, session->hostname,
session->live_timer,
- current_chunk_id.is_set ? ¤t_chunk_id.value : NULL);
+ current_chunk_id.is_set ? ¤t_chunk_id.value : NULL,
+ session->creation_time);
pthread_mutex_unlock(socket->lock);
if (status != LTTNG_OK) {
rcu_read_unlock();
struct lttcomm_relayd_sock *rsock, struct consumer_output *consumer,
enum lttng_stream_type type, uint64_t session_id,
const char *session_name, const char *hostname,
- int session_live_timer, const uint64_t *current_chunk_id)
+ int session_live_timer, const uint64_t *current_chunk_id,
+ time_t session_creation_time)
{
int ret;
struct lttcomm_consumer_msg msg;
&msg.u.relayd_sock.relayd_session_id,
session_name, hostname, session_live_timer,
consumer->snapshot, session_id,
- sessiond_uuid, current_chunk_id);
+ sessiond_uuid, current_chunk_id,
+ session_creation_time);
if (ret < 0) {
/* Close the control socket. */
(void) relayd_close(rsock);
struct lttcomm_relayd_sock *rsock, struct consumer_output *consumer,
enum lttng_stream_type type, uint64_t session_id,
const char *session_name, const char *hostname,
- int session_live_timer, const uint64_t *current_chunk_id);
+ int session_live_timer, const uint64_t *current_chunk_id,
+ time_t session_creation_time);
int consumer_send_channel_monitor_pipe(struct consumer_socket *consumer_sock,
int pipe);
int consumer_send_destroy_relayd(struct consumer_socket *sock,
const char *session_name, const char *hostname,
int session_live_timer, unsigned int snapshot,
uint64_t sessiond_session_id, const lttng_uuid sessiond_uuid,
- const uint64_t *current_chunk_id)
+ const uint64_t *current_chunk_id,
+ time_t creation_time)
{
int ret;
struct lttcomm_relayd_create_session_2_11 *msg = NULL;
htobe64(*current_chunk_id));
}
+ msg->creation_time = htobe64((uint64_t) creation_time);
+
/* Send command */
ret = send_command(rsock, RELAYD_CREATE_SESSION, msg, msg_length, 0);
if (ret < 0) {
int session_live_timer,
unsigned int snapshot, uint64_t sessiond_session_id,
const lttng_uuid sessiond_uuid,
- const uint64_t *current_chunk_id)
+ const uint64_t *current_chunk_id,
+ time_t creation_time)
{
int ret;
struct lttcomm_relayd_status_session reply;
ret = relayd_create_session_2_11(rsock, session_name,
hostname, session_live_timer, snapshot,
sessiond_session_id, sessiond_uuid,
- current_chunk_id);
+ current_chunk_id, creation_time);
}
if (ret < 0) {
int session_live_timer,
unsigned int snapshot, uint64_t sessiond_session_id,
const lttng_uuid sessiond_uuid,
- const uint64_t *current_chunk_id);
+ const uint64_t *current_chunk_id,
+ time_t creation_time);
int relayd_add_stream(struct lttcomm_relayd_sock *sock, const char *channel_name,
const char *pathname, uint64_t *stream_id,
uint64_t tracefile_size, uint64_t tracefile_count,
lttng_uuid sessiond_uuid;
/* Sessiond session id */
uint64_t session_id;
- LTTNG_OPTIONAL_COMM(uint64_t) current_chunk_id;
+ /* Session creation time, in seconds since UNIX Epoch. */
+ uint64_t creation_time;
+ LTTNG_OPTIONAL_COMM(uint64_t) LTTNG_PACKED current_chunk_id;
/* Contains the session_name and hostname */
char names[];
} LTTNG_PACKED;