Revert "lttng-ctl: Hide symbol introduced by fix"
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.hpp
... / ...
CommitLineData
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 "ctl-utils.hpp"
13#include "lttng-sessiond.hpp"
14#include "lttng/tracker.h"
15#include "session.hpp"
16#include "snapshot-output.hpp"
17
18#include <common/tracker.hpp>
19
20#include <lttng/kernel.h>
21
22struct notification_thread_handle;
23struct lttng_dynamic_buffer;
24
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 */
33using completion_handler_function = enum lttng_error_code (*)(void *);
34struct cmd_completion_handler {
35 completion_handler_function run;
36 void *data;
37};
38
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 */
43void cmd_init();
44
45/* Session commands */
46enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx,
47 int sock,
48 struct lttng_session_descriptor **return_descriptor);
49int cmd_destroy_session(const ltt_session::locked_ref& session, int *sock_fd);
50
51/* Channel commands */
52int cmd_disable_channel(const ltt_session::locked_ref& session,
53 enum lttng_domain_type domain,
54 char *channel_name);
55int cmd_enable_channel(struct command_ctx *cmd_ctx,
56 ltt_session::locked_ref& session,
57 int sock,
58 int wpipe);
59
60/* Process attribute tracker commands */
61enum lttng_error_code
62cmd_process_attr_tracker_get_tracking_policy(const ltt_session::locked_ref& session,
63 enum lttng_domain_type domain,
64 enum lttng_process_attr process_attr,
65 enum lttng_tracking_policy *policy);
66enum lttng_error_code
67cmd_process_attr_tracker_set_tracking_policy(const ltt_session::locked_ref& session,
68 enum lttng_domain_type domain,
69 enum lttng_process_attr process_attr,
70 enum lttng_tracking_policy policy);
71enum lttng_error_code
72cmd_process_attr_tracker_inclusion_set_add_value(const ltt_session::locked_ref& session,
73 enum lttng_domain_type domain,
74 enum lttng_process_attr process_attr,
75 const struct process_attr_value *value);
76enum lttng_error_code
77cmd_process_attr_tracker_inclusion_set_remove_value(const ltt_session::locked_ref& session,
78 enum lttng_domain_type domain,
79 enum lttng_process_attr process_attr,
80 const struct process_attr_value *value);
81enum lttng_error_code
82cmd_process_attr_tracker_get_inclusion_set(const ltt_session::locked_ref& session,
83 enum lttng_domain_type domain,
84 enum lttng_process_attr process_attr,
85 struct lttng_process_attr_values **values);
86
87/* Event commands */
88int cmd_disable_event(struct command_ctx *cmd_ctx,
89 ltt_session::locked_ref& locked_session,
90 struct lttng_event *event,
91 char *filter_expression,
92 struct lttng_bytecode *filter,
93 struct lttng_event_exclusion *exclusion);
94int cmd_add_context(struct command_ctx *cmd_ctx,
95 ltt_session::locked_ref& locked_session,
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);
103int cmd_enable_event(struct command_ctx *cmd_ctx,
104 ltt_session::locked_ref& session,
105 struct lttng_event *event,
106 char *filter_expression,
107 struct lttng_event_exclusion *exclusion,
108 struct lttng_bytecode *bytecode,
109 int wpipe);
110
111/* Trace session action commands */
112int cmd_start_trace(const ltt_session::locked_ref& session);
113int cmd_stop_trace(const ltt_session::locked_ref& session);
114
115/* Consumer commands */
116int cmd_register_consumer(const ltt_session::locked_ref& session,
117 enum lttng_domain_type domain,
118 const char *sock_path,
119 struct consumer_data *cdata);
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);
124
125/* Listing commands */
126ssize_t cmd_list_domains(const ltt_session::locked_ref& session, struct lttng_domain **domains);
127enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
128 const ltt_session::locked_ref& session,
129 char *channel_name,
130 struct lttng_payload *payload);
131enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
132 const ltt_session::locked_ref& session,
133 struct lttng_payload *payload);
134void cmd_list_lttng_sessions(lttng_session *sessions, size_t session_count, uid_t uid, gid_t gid);
135enum lttng_error_code cmd_list_tracepoint_fields(enum lttng_domain_type domain,
136 struct lttng_payload *reply);
137enum lttng_error_code cmd_list_tracepoints(enum lttng_domain_type domain,
138 struct lttng_payload *reply_payload);
139ssize_t cmd_snapshot_list_outputs(const ltt_session::locked_ref& session,
140 struct lttng_snapshot_output **outputs);
141enum lttng_error_code cmd_list_syscalls(struct lttng_payload *reply_payload);
142
143int cmd_data_pending(const ltt_session::locked_ref& session);
144enum lttng_error_code cmd_kernel_tracer_status(enum lttng_kernel_tracer_status *status);
145
146/* Snapshot */
147int cmd_snapshot_add_output(const ltt_session::locked_ref& session,
148 const struct lttng_snapshot_output *output,
149 uint32_t *id);
150int cmd_snapshot_del_output(const ltt_session::locked_ref& session,
151 const struct lttng_snapshot_output *output);
152int cmd_snapshot_record(const ltt_session::locked_ref& session,
153 const struct lttng_snapshot_output *output,
154 int wait);
155
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);
159
160lttng::ctl::trigger
161cmd_register_trigger(const struct lttng_credentials *cmd_creds,
162 struct lttng_trigger *trigger,
163 bool is_anonymous_trigger,
164 struct notification_thread_handle *notification_thread_handle);
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);
179
180int cmd_rotate_session(const ltt_session::locked_ref& session,
181 struct lttng_rotate_session_return *rotate_return,
182 bool quiet_rotation,
183 enum lttng_trace_chunk_command_type command);
184int cmd_rotate_get_info(const ltt_session::locked_ref& session,
185 struct lttng_rotation_get_info_return *info_return,
186 uint64_t rotate_id);
187int cmd_rotation_set_schedule(const ltt_session::locked_ref& session,
188 bool activate,
189 enum lttng_rotation_schedule_type schedule_type,
190 uint64_t value);
191
192const struct cmd_completion_handler *cmd_pop_completion_handler();
193int start_kernel_session(struct ltt_kernel_session *ksess);
194int stop_kernel_session(struct ltt_kernel_session *ksess);
195
196#endif /* CMD_H */
This page took 0.022676 seconds and 4 git commands to generate.