580ddbbb4f07054301773fe1e59d3de1f5070f22
[deliverable/lttng-tools.git] / src / bin / lttng-sessiond / rotation-thread.h
1 /*
2 * Copyright (C) 2017 - Julien Desfossez <jdesfossez@efficios.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18 #ifndef ROTATION_THREAD_H
19 #define ROTATION_THREAD_H
20
21 #include <urcu/list.h>
22 #include <urcu.h>
23 #include <urcu/rculfhash.h>
24 #include <lttng/domain.h>
25 #include <common/pipe.h>
26 #include <common/compat/poll.h>
27 #include <common/hashtable/hashtable.h>
28 #include <pthread.h>
29
30 struct rotation_channel_key {
31 uint64_t key;
32 enum lttng_domain_type domain;
33 };
34
35 struct rotation_channel_info {
36 union {
37 struct ltt_kernel_channel *kchan;
38 struct ltt_ust_channel *uchan;
39 } chan;
40 struct ltt_session *session;
41 struct rotation_channel_key channel_key;
42 struct cds_lfht_node rotate_channels_ht_node;
43 };
44
45 struct rotation_thread_handle {
46 /*
47 * Read side of pipes used to receive channel status info collected
48 * by the various consumer daemons.
49 */
50 int ust32_consumer;
51 int ust64_consumer;
52 int kernel_consumer;
53 int thread_quit_pipe;
54 };
55
56 struct rotation_thread_state {
57 struct lttng_poll_event events;
58 };
59
60 /* rotation_thread_data takes ownership of the channel rotate pipes. */
61 struct rotation_thread_handle *rotation_thread_handle_create(
62 struct lttng_pipe *ust32_channel_rotate_pipe,
63 struct lttng_pipe *ust64_channel_rotate_pipe,
64 struct lttng_pipe *kernel_channel_rotate_pipe,
65 int thread_quit_pipe);
66
67 void rotation_thread_handle_destroy(
68 struct rotation_thread_handle *handle);
69
70 void rotation_thread_quit(struct rotation_thread_handle *handle);
71
72 int rotate_add_channel_pending(uint64_t key, enum lttng_domain_type domain,
73 struct ltt_session *session);
74
75 void *thread_rotation(void *data);
76
77 #endif /* ROTATION_THREAD_H */
This page took 0.03137 seconds and 4 git commands to generate.