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