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