Commit | Line | Data |
---|---|---|
de27ada2 JG |
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/wfcqueue.h> | |
22 | #include <lttng/trigger/trigger.h> | |
23 | ||
24 | enum notification_command_type { | |
25 | NOTIFICATION_COMMAND_TYPE_NEW_TRIGGER, | |
26 | }; | |
27 | ||
28 | struct notification_command { | |
29 | /* Futex on which to wait for command reply. */ | |
30 | int32_t futex; | |
31 | enum lttng_error_code result; | |
32 | enum notification_command_type type; | |
33 | }; | |
34 | ||
35 | struct notification_new_trigger_command { | |
36 | struct notification_command parent; | |
37 | /* Set to NULL if ownership was transfered. */ | |
38 | struct lttng_trigger *trigger; | |
39 | }; | |
40 | ||
41 | /* Data passed to the thread on initialization. */ | |
42 | struct notification_thread_data { | |
43 | /* | |
44 | * Queue of struct notification command. | |
45 | * event_fd must be WRITE(2) to signal that a new command | |
46 | * has been enqueued. | |
47 | */ | |
48 | struct notification_cmd_queue { | |
49 | int event_fd; | |
50 | struct cds_wfcq_head head; | |
51 | struct cds_wfcq_tail tail; | |
52 | } cmd_queue; | |
53 | }; | |
54 | ||
55 | struct notification_command *notification_new_trigger_command_create( | |
56 | struct lttng_trigger *trigger); | |
57 | struct notification_command *notification_new_trigger_command_destroy( | |
58 | struct lttng_trigger *trigger); | |
59 | ||
60 | void *thread_notification(void *data); | |
61 | ||
62 | int notification_thread_init_data(struct notification_thread_data **data); | |
63 | void notification_thread_destroy_data(struct notification_thread_data *data); | |
64 | ||
65 | #endif /* NOTIFICATION_THREAD_H */ |