Add the sessiond notification-handling subsystem
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread.h
1 /*
2 * Copyright (C) 2017 - Jérémie Galarneau <jeremie.galarneau@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 NOTIFICATION_THREAD_H
19 #define NOTIFICATION_THREAD_H
20
21 #include <urcu/list.h>
22 #include <urcu.h>
23 #include <urcu/rculfhash.h>
24 #include <lttng/trigger/trigger.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 notification_thread_handle {
31 /*
32 * Queue of struct notification command.
33 * event_fd must be WRITE(2) to signal that a new command
34 * has been enqueued.
35 */
36 struct {
37 int event_fd;
38 struct cds_list_head list;
39 pthread_mutex_t lock;
40 } cmd_queue;
41 /*
42 * Read side of pipes used to receive channel status info collected
43 * by the various consumer daemons.
44 */
45 struct {
46 int ust32_consumer;
47 int ust64_consumer;
48 int kernel_consumer;
49 } channel_monitoring_pipes;
50 };
51
52 struct notification_thread_state {
53 int notification_channel_socket;
54 struct lttng_poll_event events;
55 struct cds_lfht *client_socket_ht;
56 struct cds_lfht *channel_triggers_ht;
57 struct cds_lfht *channel_state_ht;
58 struct cds_lfht *notification_trigger_clients_ht;
59 struct cds_lfht *channels_ht;
60 struct cds_lfht *triggers_ht;
61 };
62
63 /* notification_thread_data takes ownership of the channel monitor pipes. */
64 struct notification_thread_handle *notification_thread_handle_create(
65 struct lttng_pipe *ust32_channel_monitor_pipe,
66 struct lttng_pipe *ust64_channel_monitor_pipe,
67 struct lttng_pipe *kernel_channel_monitor_pipe);
68 void notification_thread_handle_destroy(
69 struct notification_thread_handle *handle);
70
71 void *thread_notification(void *data);
72
73 #endif /* NOTIFICATION_THREAD_H */
This page took 0.030068 seconds and 4 git commands to generate.