Fix: notification thread: RCU-safe reclaim of hash table nodes
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-commands.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_COMMANDS_H
19 #define NOTIFICATION_THREAD_COMMANDS_H
20
21 #include <lttng/domain.h>
22 #include <lttng/lttng-error.h>
23 #include <urcu/rculfhash.h>
24 #include "notification-thread.h"
25 #include <common/waiter.h>
26
27 struct notification_thread_data;
28 struct lttng_trigger;
29
30 enum notification_thread_command_type {
31 NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER,
32 NOTIFICATION_COMMAND_TYPE_UNREGISTER_TRIGGER,
33 NOTIFICATION_COMMAND_TYPE_ADD_CHANNEL,
34 NOTIFICATION_COMMAND_TYPE_REMOVE_CHANNEL,
35 NOTIFICATION_COMMAND_TYPE_QUIT,
36 };
37
38 struct channel_key {
39 uint64_t key;
40 enum lttng_domain_type domain;
41 };
42
43 struct channel_info {
44 struct channel_key key;
45 char *session_name;
46 uid_t uid;
47 gid_t gid;
48 char *channel_name;
49 uint64_t capacity;
50 struct cds_lfht_node channels_ht_node;
51 /* call_rcu delayed reclaim. */
52 struct rcu_head rcu_node;
53 };
54
55 struct notification_thread_command {
56 struct cds_list_head cmd_list_node;
57
58 enum notification_thread_command_type type;
59 union {
60 /* Register/Unregister trigger. */
61 struct lttng_trigger *trigger;
62 /* Add channel. */
63 struct channel_info add_channel;
64 /* Remove channel. */
65 struct {
66 uint64_t key;
67 enum lttng_domain_type domain;
68 } remove_channel;
69 } parameters;
70
71 /* lttng_waiter on which to wait for command reply (optional). */
72 struct lttng_waiter reply_waiter;
73 enum lttng_error_code reply_code;
74 };
75
76 enum lttng_error_code notification_thread_command_register_trigger(
77 struct notification_thread_handle *handle,
78 struct lttng_trigger *trigger);
79
80 enum lttng_error_code notification_thread_command_unregister_trigger(
81 struct notification_thread_handle *handle,
82 struct lttng_trigger *trigger);
83
84 enum lttng_error_code notification_thread_command_add_channel(
85 struct notification_thread_handle *handle,
86 char *session_name, uid_t uid, gid_t gid,
87 char *channel_name, uint64_t key,
88 enum lttng_domain_type domain, uint64_t capacity);
89
90 enum lttng_error_code notification_thread_command_remove_channel(
91 struct notification_thread_handle *handle,
92 uint64_t key, enum lttng_domain_type domain);
93
94 void notification_thread_command_quit(
95 struct notification_thread_handle *handle);
96
97 #endif /* NOTIFICATION_THREAD_COMMANDS_H */
This page took 0.035398 seconds and 5 git commands to generate.