Fix: honor base path for network URIs
[lttng-tools.git] / src / bin / lttng-sessiond / consumer.c
index 155f2b053aca8dfdfc3653c4c9bfdd7eb8f71ada..3e23d3255b3fa3334b51d789c1d7bf8a516ecd3d 100644 (file)
@@ -315,7 +315,7 @@ error:
  * object reference is not needed anymore.
  */
 struct consumer_socket *consumer_find_socket_by_bitness(int bits,
-               struct consumer_output *consumer)
+               const struct consumer_output *consumer)
 {
        int consumer_fd;
        struct consumer_socket *socket = NULL;
@@ -348,7 +348,7 @@ end:
  * returned consumer_socket.
  */
 struct consumer_socket *consumer_find_socket(int key,
-               struct consumer_output *consumer)
+               const struct consumer_output *consumer)
 {
        struct lttng_ht_iter iter;
        struct lttng_ht_node_ulong *node;
@@ -405,7 +405,7 @@ void consumer_add_socket(struct consumer_socket *sock,
 }
 
 /*
- * Delte consumer socket to consumer output object. Read side lock must be
+ * Delete consumer socket to consumer output object. Read side lock must be
  * acquired before calling this function.
  */
 void consumer_del_socket(struct consumer_socket *sock,
@@ -893,10 +893,6 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
        msg->u.ask_channel.buffer_credentials.uid = UINT32_MAX;
        msg->u.ask_channel.buffer_credentials.gid = UINT32_MAX;
 
-       if (monitor) {
-               assert(trace_chunk);
-       }
-
         if (trace_chunk) {
                uint64_t chunk_id;
                enum lttng_trace_chunk_status chunk_status;
@@ -1079,7 +1075,8 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock,
                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)
+               const char *base_path, int session_live_timer,
+               const uint64_t *current_chunk_id, time_t session_creation_time)
 {
        int ret;
        struct lttcomm_consumer_msg msg;
@@ -1099,9 +1096,11 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock,
        if (type == LTTNG_STREAM_CONTROL) {
                ret = relayd_create_session(rsock,
                                &msg.u.relayd_sock.relayd_session_id,
-                               session_name, hostname, session_live_timer,
+                               session_name, hostname, base_path,
+                               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);
@@ -1439,7 +1438,7 @@ end:
  * Returns LTTNG_OK on success or else an LTTng error code.
  */
 enum lttng_error_code consumer_snapshot_channel(struct consumer_socket *socket,
-               uint64_t key, const struct snapshot_output *output, int metadata,
+               uint64_t key, const struct consumer_output *output, int metadata,
                uid_t uid, gid_t gid, const char *channel_path, int wait,
                uint64_t nb_packets_per_stream)
 {
@@ -1449,7 +1448,6 @@ enum lttng_error_code consumer_snapshot_channel(struct consumer_socket *socket,
 
        assert(socket);
        assert(output);
-       assert(output->consumer);
 
        DBG("Consumer snapshot channel key %" PRIu64, key);
 
@@ -1459,9 +1457,9 @@ enum lttng_error_code consumer_snapshot_channel(struct consumer_socket *socket,
        msg.u.snapshot_channel.nb_packets_per_stream = nb_packets_per_stream;
        msg.u.snapshot_channel.metadata = metadata;
 
-       if (output->consumer->type == CONSUMER_DST_NET) {
+       if (output->type == CONSUMER_DST_NET) {
                msg.u.snapshot_channel.relayd_id =
-                               output->consumer->net_seq_index;
+                               output->net_seq_index;
                msg.u.snapshot_channel.use_relayd = 1;
        } else {
                msg.u.snapshot_channel.relayd_id = (uint64_t) -1ULL;
@@ -1701,7 +1699,7 @@ int consumer_create_trace_chunk(struct consumer_socket *socket,
        const struct lttng_directory_handle *chunk_directory_handle;
        int chunk_dirfd;
        const char *chunk_name;
-       bool chunk_name_overriden;
+       bool chunk_name_overridden;
        uint64_t chunk_id;
        time_t creation_timestamp;
        char creation_timestamp_buffer[ISO8601_STR_LEN];
@@ -1721,14 +1719,14 @@ int consumer_create_trace_chunk(struct consumer_socket *socket,
        }
 
        chunk_status = lttng_trace_chunk_get_name(chunk, &chunk_name,
-                       &chunk_name_overriden);
+                       &chunk_name_overridden);
        if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK &&
                        chunk_status != LTTNG_TRACE_CHUNK_STATUS_NONE) {
                ERR("Failed to get name of trace chunk");
                ret = -LTTNG_ERR_FATAL;
                goto error;
        }
-       if (chunk_name_overriden) {
+       if (chunk_name_overridden) {
                ret = lttng_strncpy(msg.u.create_trace_chunk.override_name,
                                chunk_name,
                                sizeof(msg.u.create_trace_chunk.override_name));
This page took 0.026367 seconds and 5 git commands to generate.