fix: relayd: unaligned access in trace_chunk_registry_ht_key_hash
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.hpp
1 /*
2 * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 */
7
8 #ifndef CMD_H
9 #define CMD_H
10
11 #include "context.hpp"
12 #include "lttng-sessiond.hpp"
13 #include "lttng/tracker.h"
14 #include "session.hpp"
15
16 #include <common/tracker.hpp>
17
18 #include <lttng/kernel.h>
19
20 struct notification_thread_handle;
21 struct lttng_dynamic_buffer;
22
23 /*
24 * A callback (and associated user data) that should be run after a command
25 * has been executed. No locks should be taken while executing this handler.
26 *
27 * The command's reply should not be sent until the handler has run and
28 * completed successfully. On failure, the handler's return code should
29 * be the only reply sent to the client.
30 */
31 using completion_handler_function = enum lttng_error_code (*)(void *);
32 struct cmd_completion_handler {
33 completion_handler_function run;
34 void *data;
35 };
36
37 /*
38 * Init the command subsystem. Must be called before using any of the functions
39 * above. This is called in the main() of the session daemon.
40 */
41 void cmd_init();
42
43 /* Session commands */
44 enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx,
45 int sock,
46 struct lttng_session_descriptor **return_descriptor);
47 int cmd_destroy_session(struct ltt_session *session, int *sock_fd);
48
49 /* Channel commands */
50 int cmd_disable_channel(struct ltt_session *session,
51 enum lttng_domain_type domain,
52 char *channel_name);
53 int cmd_enable_channel(struct command_ctx *cmd_ctx, int sock, int wpipe);
54
55 /* Process attribute tracker commands */
56 enum lttng_error_code
57 cmd_process_attr_tracker_get_tracking_policy(struct ltt_session *session,
58 enum lttng_domain_type domain,
59 enum lttng_process_attr process_attr,
60 enum lttng_tracking_policy *policy);
61 enum lttng_error_code
62 cmd_process_attr_tracker_set_tracking_policy(struct ltt_session *session,
63 enum lttng_domain_type domain,
64 enum lttng_process_attr process_attr,
65 enum lttng_tracking_policy policy);
66 enum lttng_error_code
67 cmd_process_attr_tracker_inclusion_set_add_value(struct ltt_session *session,
68 enum lttng_domain_type domain,
69 enum lttng_process_attr process_attr,
70 const struct process_attr_value *value);
71 enum lttng_error_code
72 cmd_process_attr_tracker_inclusion_set_remove_value(struct ltt_session *session,
73 enum lttng_domain_type domain,
74 enum lttng_process_attr process_attr,
75 const struct process_attr_value *value);
76 enum lttng_error_code
77 cmd_process_attr_tracker_get_inclusion_set(struct ltt_session *session,
78 enum lttng_domain_type domain,
79 enum lttng_process_attr process_attr,
80 struct lttng_process_attr_values **values);
81
82 /* Event commands */
83 int cmd_disable_event(struct command_ctx *cmd_ctx,
84 struct lttng_event *event,
85 char *filter_expression,
86 struct lttng_bytecode *filter,
87 struct lttng_event_exclusion *exclusion);
88 int cmd_add_context(struct command_ctx *cmd_ctx,
89 const struct lttng_event_context *event_context,
90 int kwpipe);
91 int cmd_set_filter(struct ltt_session *session,
92 enum lttng_domain_type domain,
93 char *channel_name,
94 struct lttng_event *event,
95 struct lttng_bytecode *bytecode);
96 int cmd_enable_event(struct command_ctx *cmd_ctx,
97 struct lttng_event *event,
98 char *filter_expression,
99 struct lttng_event_exclusion *exclusion,
100 struct lttng_bytecode *bytecode,
101 int wpipe);
102
103 /* Trace session action commands */
104 int cmd_start_trace(struct ltt_session *session);
105 int cmd_stop_trace(struct ltt_session *session);
106
107 /* Consumer commands */
108 int cmd_register_consumer(struct ltt_session *session,
109 enum lttng_domain_type domain,
110 const char *sock_path,
111 struct consumer_data *cdata);
112 int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri, struct lttng_uri *uris);
113 int cmd_setup_relayd(struct ltt_session *session);
114
115 /* Listing commands */
116 ssize_t cmd_list_domains(struct ltt_session *session, struct lttng_domain **domains);
117 enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
118 struct ltt_session *session,
119 char *channel_name,
120 struct lttng_payload *payload);
121 enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
122 struct ltt_session *session,
123 struct lttng_payload *payload);
124 void cmd_list_lttng_sessions(struct lttng_session *sessions,
125 size_t session_count,
126 uid_t uid,
127 gid_t gid);
128 enum lttng_error_code cmd_list_tracepoint_fields(enum lttng_domain_type domain,
129 struct lttng_payload *reply);
130 enum lttng_error_code cmd_list_tracepoints(enum lttng_domain_type domain,
131 struct lttng_payload *reply_payload);
132 ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
133 struct lttng_snapshot_output **outputs);
134 enum lttng_error_code cmd_list_syscalls(struct lttng_payload *reply_payload);
135
136 int cmd_data_pending(struct ltt_session *session);
137 enum lttng_error_code cmd_kernel_tracer_status(enum lttng_kernel_tracer_status *status);
138
139 /* Snapshot */
140 int cmd_snapshot_add_output(struct ltt_session *session,
141 const struct lttng_snapshot_output *output,
142 uint32_t *id);
143 int cmd_snapshot_del_output(struct ltt_session *session,
144 const struct lttng_snapshot_output *output);
145 int cmd_snapshot_record(struct ltt_session *session,
146 const struct lttng_snapshot_output *output,
147 int wait);
148
149 int cmd_set_session_shm_path(struct ltt_session *session, const char *shm_path);
150 int cmd_regenerate_metadata(struct ltt_session *session);
151 int cmd_regenerate_statedump(struct ltt_session *session);
152
153 enum lttng_error_code
154 cmd_register_trigger(const struct lttng_credentials *cmd_creds,
155 struct lttng_trigger *trigger,
156 bool is_anonymous_trigger,
157 struct notification_thread_handle *notification_thread_handle,
158 struct lttng_trigger **return_trigger);
159 enum lttng_error_code
160 cmd_unregister_trigger(const struct lttng_credentials *cmd_creds,
161 const struct lttng_trigger *trigger,
162 struct notification_thread_handle *notification_thread_handle);
163
164 enum lttng_error_code
165 cmd_list_triggers(struct command_ctx *cmd_ctx,
166 struct notification_thread_handle *notification_thread_handle,
167 struct lttng_triggers **return_triggers);
168 enum lttng_error_code
169 cmd_execute_error_query(const struct lttng_credentials *cmd_creds,
170 const struct lttng_error_query *query,
171 struct lttng_error_query_results **_results,
172 struct notification_thread_handle *notification_thread);
173
174 int cmd_rotate_session(struct ltt_session *session,
175 struct lttng_rotate_session_return *rotate_return,
176 bool quiet_rotation,
177 enum lttng_trace_chunk_command_type command);
178 int cmd_rotate_get_info(struct ltt_session *session,
179 struct lttng_rotation_get_info_return *info_return,
180 uint64_t rotate_id);
181 int cmd_rotation_set_schedule(struct ltt_session *session,
182 bool activate,
183 enum lttng_rotation_schedule_type schedule_type,
184 uint64_t value);
185
186 const struct cmd_completion_handler *cmd_pop_completion_handler();
187 int start_kernel_session(struct ltt_kernel_session *ksess);
188 int stop_kernel_session(struct ltt_kernel_session *ksess);
189
190 #endif /* CMD_H */
This page took 0.032718 seconds and 4 git commands to generate.