2 * Copyright (C) 2017 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
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.
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
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.
18 #ifndef NOTIFICATION_THREAD_H
19 #define NOTIFICATION_THREAD_H
21 #include <urcu/wfcqueue.h>
22 #include <lttng/trigger/trigger.h>
24 enum notification_command_type
{
25 NOTIFICATION_COMMAND_TYPE_NEW_TRIGGER
,
28 struct notification_command
{
29 /* Futex on which to wait for command reply. */
31 enum lttng_error_code result
;
32 enum notification_command_type type
;
35 struct notification_new_trigger_command
{
36 struct notification_command parent
;
37 /* Set to NULL if ownership was transfered. */
38 struct lttng_trigger
*trigger
;
41 /* Data passed to the thread on initialization. */
42 struct notification_thread_data
{
44 * Queue of struct notification command.
45 * event_fd must be WRITE(2) to signal that a new command
48 struct notification_cmd_queue
{
50 struct cds_wfcq_head head
;
51 struct cds_wfcq_tail tail
;
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
);
60 void *thread_notification(void *data
);
62 int notification_thread_init_data(struct notification_thread_data
**data
);
63 void notification_thread_destroy_data(struct notification_thread_data
*data
);
65 #endif /* NOTIFICATION_THREAD_H */