X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=include%2Flttng%2Flttng-consumer.h;h=81fd83e0ff4845574f4ddf3762129a2935bf7138;hp=7ca94cc1da5818a5c25c00d37298a97cc7ec8a2e;hb=886459c6c3217ac70b249e2a717622edd9e7b4dc;hpb=3bd1e0819b577ffcb44acd7c2f8e02ff09654b7b diff --git a/include/lttng/lttng-consumer.h b/include/lttng/lttng-consumer.h index 7ca94cc1d..81fd83e0f 100644 --- a/include/lttng/lttng-consumer.h +++ b/include/lttng/lttng-consumer.h @@ -22,14 +22,15 @@ #include #include +#include #include #include /* * When the receiving thread dies, we need to have a way to make the polling * thread exit eventually. If all FDs hang up (normal case when the - * ltt-sessiond stops), we can exit cleanly, but if there is a problem and for - * whatever reason some FDs remain open, the consumer should still exit + * lttng-sessiond stops), we can exit cleanly, but if there is a problem and + * for whatever reason some FDs remain open, the consumer should still exit * eventually. * * If the timeout is reached, it means that during this period no events @@ -68,7 +69,8 @@ struct lttng_consumer_stream_list { enum lttng_consumer_type { LTTNG_CONSUMER_UNKNOWN = 0, LTTNG_CONSUMER_KERNEL, - LTTNG_CONSUMER_UST, + LTTNG_CONSUMER64_UST, + LTTNG_CONSUMER32_UST, }; struct lttng_consumer_channel { @@ -81,12 +83,15 @@ struct lttng_consumer_channel { int wait_fd; void *mmap_base; size_t mmap_len; - struct shm_handle *handle; + struct lttng_ust_shm_handle *handle; int nr_streams; + int shm_fd_is_copy; + int wait_fd_is_copy; + int cpucount; }; /* Forward declaration for UST. */ -struct lib_ring_buffer; +struct lttng_ust_lib_ring_buffer; /* * Internal representation of the streams, sessiond_key is used to identify @@ -110,9 +115,15 @@ struct lttng_consumer_stream { void *mmap_base; size_t mmap_len; enum lttng_event_output output; /* splice or mmap */ + int shm_fd_is_copy; + int wait_fd_is_copy; /* For UST */ - struct lib_ring_buffer *buf; + struct lttng_ust_lib_ring_buffer *buf; int cpu; + int hangup_flush_done; + /* UID/GID of the user owning the session to which stream belongs */ + uid_t uid; + gid_t gid; }; /* @@ -121,7 +132,8 @@ struct lttng_consumer_stream { */ struct lttng_consumer_local_data { /* function to call when data is available on a buffer */ - int (*on_buffer_ready)(struct lttng_consumer_stream *stream); + int (*on_buffer_ready)(struct lttng_consumer_stream *stream, + struct lttng_consumer_local_data *ctx); /* * function to call when we receive a new channel, it receives a * newly allocated channel, depending on the return code of this @@ -257,7 +269,9 @@ extern struct lttng_consumer_stream *consumer_allocate_stream( enum lttng_consumer_stream_state state, uint64_t mmap_len, enum lttng_event_output output, - const char *path_name); + const char *path_name, + uid_t uid, + gid_t gid); extern int consumer_add_stream(struct lttng_consumer_stream *stream); extern void consumer_del_stream(struct lttng_consumer_stream *stream); extern void consumer_change_stream_state(int stream_key, @@ -272,7 +286,8 @@ int consumer_add_channel(struct lttng_consumer_channel *channel); extern struct lttng_consumer_local_data *lttng_consumer_create( enum lttng_consumer_type type, - int (*buffer_ready)(struct lttng_consumer_stream *stream), + int (*buffer_ready)(struct lttng_consumer_stream *stream, + struct lttng_consumer_local_data *ctx), int (*recv_channel)(struct lttng_consumer_channel *channel), int (*recv_stream)(struct lttng_consumer_stream *stream), int (*update_stream)(int sessiond_key, uint32_t state)); @@ -294,4 +309,8 @@ extern void *lttng_consumer_thread_receive_fds(void *data); extern int lttng_consumer_recv_cmd(struct lttng_consumer_local_data *ctx, int sock, struct pollfd *consumer_sockpoll); +int 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); + #endif /* _LTTNG_CONSUMER_H */