X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Fconsumer%2Fconsumer.h;h=7f8d14704d23ec6a8ad967ecc951f09d6d017ced;hb=b66cbf1731486ab4dc7e0b2e1c3fa05cc5360c19;hp=5064362c8a95ef539f9c56cb9fae8cf853c193e3;hpb=fa29bfbf73e837b936d80b4d5a1206dfb8496f07;p=lttng-tools.git diff --git a/src/common/consumer/consumer.h b/src/common/consumer/consumer.h index 5064362c8..7f8d14704 100644 --- a/src/common/consumer/consumer.h +++ b/src/common/consumer/consumer.h @@ -160,7 +160,7 @@ struct lttng_consumer_channel { /* 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 @@ -299,6 +299,12 @@ struct stream_subbuffer { } 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). @@ -321,8 +327,8 @@ typedef int (*on_sleep_cb)(struct lttng_consumer_stream *, * * 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 @@ -540,7 +546,7 @@ struct lttng_consumer_stream { /* Stream name. Format is: _ */ char name[LTTNG_SYMBOL_NAME_LEN]; /* Internal state of libustctl. */ - struct ustctl_consumer_stream *ustream; + struct lttng_ust_ctl_consumer_stream *ustream; struct cds_list_head send_node; /* On-disk circular buffer */ uint64_t tracefile_size_current; @@ -792,30 +798,30 @@ struct lttng_consumer_global_data { * This is nested OUTSIDE the stream lock. * This is nested OUTSIDE the consumer_relayd_sock_pair lock. */ - pthread_mutex_t lock; + pthread_mutex_t lock {}; /* * Number of streams in the data stream hash table declared outside. * Protected by consumer_data.lock. */ - int stream_count; + int stream_count = 0; /* Channel hash table protected by consumer_data.lock. */ - struct lttng_ht *channel_ht; + struct lttng_ht *channel_ht = nullptr; /* Channel hash table indexed by session id. */ - struct lttng_ht *channels_by_session_id_ht; + struct lttng_ht *channels_by_session_id_ht = nullptr; /* * Flag specifying if the local array of FDs needs update in the * poll function. Protected by consumer_data.lock. */ - unsigned int need_update; - enum lttng_consumer_type type; + unsigned int need_update = 1; + enum lttng_consumer_type type = LTTNG_CONSUMER_UNKNOWN; /* * Relayd socket(s) hashtable indexed by network sequence number. Each * stream has an index which associate the right relayd socket to use. */ - struct lttng_ht *relayd_ht; + struct lttng_ht *relayd_ht = nullptr; /* * This hash table contains all streams (metadata and data) indexed by @@ -824,17 +830,17 @@ struct lttng_consumer_global_data { * * This HT uses the "node_session_id" of the consumer stream. */ - struct lttng_ht *stream_list_ht; + struct lttng_ht *stream_list_ht = nullptr; /* * This HT uses the "node_channel_id" of the consumer stream. */ - struct lttng_ht *stream_per_chan_id_ht; + struct lttng_ht *stream_per_chan_id_ht = nullptr; /* * Trace chunk registry indexed by (session_id, chunk_id). */ - struct lttng_trace_chunk_registry *chunk_registry; + struct lttng_trace_chunk_registry *chunk_registry = nullptr; }; /* @@ -849,8 +855,12 @@ extern int consumer_quit; */ extern int consumer_quit; -/* Flag used to temporarily pause data consumption from testpoints. */ -extern int data_consumption_paused; +/* + * Flag used to temporarily pause data consumption from testpoints. + * + * This variable is dlsym-ed from a test, so needs to be exported. + */ +LTTNG_EXPORT extern int data_consumption_paused; /* Return a human-readable consumer type string that is suitable for logging. */ static inline @@ -1053,5 +1063,6 @@ int lttng_consumer_clear_channel(struct lttng_consumer_channel *channel); 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 */