/*
- * Copyright (C) 2011 Julien Desfossez <julien.desfossez@polymtl.ca>
+ * Copyright (C) 2011 EfficiOS Inc.
* Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
* Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
* Copyright (C) 2018 Jérémie Galarneau <jeremie.galarneau@efficios.com>
#include <limits.h>
#include <poll.h>
+#include <stdint.h>
#include <unistd.h>
#include <urcu/list.h>
SYNC_METADATA_STATUS_ERROR,
};
-extern struct lttng_consumer_global_data consumer_data;
+extern struct lttng_consumer_global_data the_consumer_data;
struct stream_list {
struct cds_list_head head;
/* For UST */
uid_t ust_app_uid; /* Application UID. */
- struct ustctl_consumer_channel *uchan;
+ struct lttng_ust_ctl_consumer_channel *uchan;
unsigned char uuid[LTTNG_UUID_STR_LEN];
/*
* Temporary stream list used to store the streams once created and waiting
} info;
};
+enum get_next_subbuffer_status {
+ GET_NEXT_SUBBUFFER_STATUS_OK,
+ GET_NEXT_SUBBUFFER_STATUS_NO_DATA,
+ GET_NEXT_SUBBUFFER_STATUS_ERROR,
+};
+
/*
* Perform any operation required to acknowledge
* the wake-up of a consumer stream (e.g. consume a byte on a wake-up pipe).
*
* Stream and channel locks are acquired during this call.
*/
-typedef int (*get_next_subbuffer_cb)(struct lttng_consumer_stream *,
- struct stream_subbuffer *);
+typedef enum get_next_subbuffer_status (*get_next_subbuffer_cb)(
+ struct lttng_consumer_stream *, struct stream_subbuffer *);
/*
* Populate the stream_subbuffer's info member. The info to populate
*/
typedef void (*unlock_cb)(struct lttng_consumer_stream *);
+/*
+ * Assert that the stream and channel lock and any other stream type specific
+ * lock that need to be acquired during the processing of a read_subbuffer
+ * operation is acquired.
+ */
+typedef void (*assert_locked_cb)(struct lttng_consumer_stream *);
+
/*
* Invoked when a subbuffer's metadata version does not match the last
* known metadata version.
struct lttng_ht_node_u64 node_channel_id;
/* HT node used in consumer_data.stream_list_ht */
struct lttng_ht_node_u64 node_session_id;
+ /*
+ * List used by channels to reference streams that are not yet globally
+ * visible.
+ */
+ struct cds_list_head send_node;
/* Pointer to associated channel. */
struct lttng_consumer_channel *chan;
/*
/* Stream name. Format is: <channel_name>_<cpu_number> */
char name[LTTNG_SYMBOL_NAME_LEN];
/* Internal state of libustctl. */
- struct ustctl_consumer_stream *ustream;
- struct cds_list_head send_node;
+ struct lttng_ust_ctl_consumer_stream *ustream;
/* On-disk circular buffer */
uint64_t tracefile_size_current;
uint64_t tracefile_count_current;
send_live_beacon_cb send_live_beacon;
on_sleep_cb on_sleep;
unlock_cb unlock;
+ assert_locked_cb assert_locked;
} read_subbuffer_ops;
struct metadata_bucket *metadata_bucket;
};
struct lttng_consumer_local_data *ctx,
bool locked_by_caller);
int lttng_consumer_on_recv_stream(struct lttng_consumer_stream *stream);
-void consumer_add_relayd_socket(uint64_t net_seq_idx, 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);
+void consumer_add_relayd_socket(uint64_t net_seq_idx,
+ int sock_type,
+ struct lttng_consumer_local_data *ctx,
+ int sock,
+ struct pollfd *consumer_sockpoll,
+ uint64_t sessiond_id,
+ uint64_t relayd_session_id,
+ uint32_t relayd_version_major,
+ uint32_t relayd_version_minor,
+ enum lttcomm_sock_proto relayd_socket_protocol);
void consumer_flag_relayd_for_destroy(
struct consumer_relayd_sock_pair *relayd);
int consumer_data_pending(uint64_t id);
enum lttcomm_return_code lttng_consumer_open_channel_packets(
struct lttng_consumer_channel *channel);
int consumer_metadata_wakeup_pipe(const struct lttng_consumer_channel *channel);
+void lttng_consumer_sigbus_handle(void *addr);
#endif /* LIB_CONSUMER_H */