#include <common/sessiond-comm/sessiond-comm.h>
#include <common/pipe.h>
#include <common/index/ctf-index.h>
+#include <common/buffer-view.h>
/* Commands for consumer */
enum lttng_consumer_command {
int live_timer_enabled;
timer_t live_timer;
int live_timer_error;
+ /* Channel is part of a live session ? */
+ bool is_live;
/* On-disk circular buffer */
uint64_t tracefile_size;
/* UID/GID of the user owning the session to which stream belongs */
uid_t uid;
gid_t gid;
- /* Network sequence number. Indicating on which relayd socket it goes. */
- uint64_t net_seq_idx;
+ /*
+ * Relayd id, indicating on which relayd socket it goes. Set to -1ULL if
+ * not the stream is not associated to a relay daemon.
+ */
+ uint64_t relayd_id;
/*
* Indicate if this stream was successfully sent to a relayd. This is set
* after the refcount of the relayd is incremented and is checked when the
*/
struct consumer_relayd_sock_pair {
/* Network sequence number. */
- uint64_t net_seq_idx;
+ uint64_t id;
/* Number of stream associated with this relayd */
int refcount;
/* Session id on both sides for the sockets. */
uint64_t relayd_session_id;
uint64_t sessiond_session_id;
+ struct lttng_consumer_local_data *ctx;
};
/*
*/
int lttng_consumer_poll_socket(struct pollfd *kconsumer_sockpoll);
-struct lttng_consumer_stream *consumer_allocate_stream(uint64_t channel_key,
+struct lttng_consumer_stream *consumer_allocate_stream(
+ struct lttng_consumer_channel *channel,
+ uint64_t channel_key,
uint64_t stream_key,
enum lttng_consumer_stream_state state,
const char *channel_name,
uint64_t session_id_per_pid,
unsigned int monitor,
unsigned int live_timer_interval,
+ bool is_in_live_session,
const char *root_shm_path,
const char *shm_path);
void consumer_del_stream(struct lttng_consumer_stream *stream,
/* lttng-relayd consumer command */
struct consumer_relayd_sock_pair *consumer_find_relayd(uint64_t key);
int consumer_send_relayd_stream(struct lttng_consumer_stream *stream, char *path);
-int consumer_send_relayd_streams_sent(uint64_t net_seq_idx);
+int consumer_send_relayd_streams_sent(uint64_t relayd_id);
void close_relayd_stream(struct lttng_consumer_stream *stream);
struct lttng_consumer_channel *consumer_find_channel(uint64_t key);
int consumer_handle_stream_before_relayd(struct lttng_consumer_stream *stream,
void lttng_consumer_destroy(struct lttng_consumer_local_data *ctx);
ssize_t lttng_consumer_on_read_subbuffer_mmap(
struct lttng_consumer_local_data *ctx,
- struct lttng_consumer_stream *stream, unsigned long len,
+ struct lttng_consumer_stream *stream,
+ const struct lttng_buffer_view *buffer,
unsigned long padding,
struct ctf_packet_index *index);
ssize_t lttng_consumer_on_read_subbuffer_splice(
ssize_t lttng_consumer_read_subbuffer(struct lttng_consumer_stream *stream,
struct lttng_consumer_local_data *ctx);
int lttng_consumer_on_recv_stream(struct lttng_consumer_stream *stream);
-int consumer_add_relayd_socket(uint64_t net_seq_idx, int sock_type,
+void consumer_add_relayd_socket(uint64_t relayd_id, int sock_type,
struct lttng_consumer_local_data *ctx, int sock,
struct pollfd *consumer_sockpoll, struct lttcomm_relayd_sock *relayd_sock,
uint64_t sessiond_id, uint64_t relayd_session_id);
int consumer_add_metadata_stream(struct lttng_consumer_stream *stream);
void consumer_del_stream_for_metadata(struct lttng_consumer_stream *stream);
int consumer_create_index_file(struct lttng_consumer_stream *stream);
+void lttng_consumer_cleanup_relayd(struct consumer_relayd_sock_pair *relayd);
#endif /* LIB_CONSUMER_H */