clang-tidy: add a subset of cppcoreguidelines and other style checks
[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 "lttng-sessiond.hpp"
13#include "lttng/tracker.h"
14#include "session.hpp"
15#include <common/tracker.hpp>
16
17struct notification_thread_handle;
18struct lttng_dynamic_buffer;
19
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 */
28using completion_handler_function = enum lttng_error_code (*)(void *);
29struct cmd_completion_handler {
30 completion_handler_function run;
31 void *data;
32};
33
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 */
38void cmd_init(void);
39
40/* Session commands */
41enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx, int sock,
42 struct lttng_session_descriptor **return_descriptor);
43int cmd_destroy_session(struct ltt_session *session,
44 struct notification_thread_handle *notification_thread_handle,
45 int *sock_fd);
46
47/* Channel commands */
48int cmd_disable_channel(struct ltt_session *session,
49 enum lttng_domain_type domain, char *channel_name);
50int cmd_enable_channel(struct command_ctx *cmd_ctx, int sock, int wpipe);
51
52/* Process attribute tracker commands */
53enum lttng_error_code cmd_process_attr_tracker_get_tracking_policy(
54 struct ltt_session *session,
55 enum lttng_domain_type domain,
56 enum lttng_process_attr process_attr,
57 enum lttng_tracking_policy *policy);
58enum 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);
63enum lttng_error_code cmd_process_attr_tracker_inclusion_set_add_value(
64 struct ltt_session *session,
65 enum lttng_domain_type domain,
66 enum lttng_process_attr process_attr,
67 const struct process_attr_value *value);
68enum 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);
73enum 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);
78
79/* Event commands */
80int 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);
85int cmd_add_context(struct command_ctx *cmd_ctx,
86 const struct lttng_event_context *event_context,
87 int kwpipe);
88int cmd_set_filter(struct ltt_session *session, enum lttng_domain_type domain,
89 char *channel_name, struct lttng_event *event,
90 struct lttng_bytecode *bytecode);
91int cmd_enable_event(struct command_ctx *cmd_ctx,
92 struct lttng_event *event,
93 char *filter_expression,
94 struct lttng_event_exclusion *exclusion,
95 struct lttng_bytecode *bytecode,
96 int wpipe);
97
98/* Trace session action commands */
99int cmd_start_trace(struct ltt_session *session);
100int cmd_stop_trace(struct ltt_session *session);
101
102/* Consumer commands */
103int cmd_register_consumer(struct ltt_session *session,
104 enum lttng_domain_type domain,
105 const char *sock_path, struct consumer_data *cdata);
106int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri,
107 struct lttng_uri *uris);
108int cmd_setup_relayd(struct ltt_session *session);
109
110/* Listing commands */
111ssize_t cmd_list_domains(struct ltt_session *session,
112 struct lttng_domain **domains);
113enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
114 struct ltt_session *session,
115 char *channel_name,
116 struct lttng_payload *payload);
117enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
118 struct ltt_session *session,
119 struct lttng_payload *payload);
120void cmd_list_lttng_sessions(struct lttng_session *sessions,
121 size_t session_count, uid_t uid, gid_t gid);
122enum lttng_error_code cmd_list_tracepoint_fields(enum lttng_domain_type domain,
123 struct lttng_payload *reply);
124enum lttng_error_code cmd_list_tracepoints(enum lttng_domain_type domain,
125 struct lttng_payload *reply_payload);
126ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
127 struct lttng_snapshot_output **outputs);
128enum lttng_error_code cmd_list_syscalls(
129 struct lttng_payload *reply_payload);
130
131int cmd_data_pending(struct ltt_session *session);
132
133/* Snapshot */
134int cmd_snapshot_add_output(struct ltt_session *session,
135 const struct lttng_snapshot_output *output, uint32_t *id);
136int cmd_snapshot_del_output(struct ltt_session *session,
137 const struct lttng_snapshot_output *output);
138int cmd_snapshot_record(struct ltt_session *session,
139 const struct lttng_snapshot_output *output, int wait);
140
141int cmd_set_session_shm_path(struct ltt_session *session,
142 const char *shm_path);
143int cmd_regenerate_metadata(struct ltt_session *session);
144int cmd_regenerate_statedump(struct ltt_session *session);
145
146enum lttng_error_code cmd_register_trigger(
147 const struct lttng_credentials *cmd_creds,
148 struct lttng_trigger *trigger,
149 bool is_anonymous_trigger,
150 struct notification_thread_handle *notification_thread_handle,
151 struct lttng_trigger **return_trigger);
152enum lttng_error_code cmd_unregister_trigger(
153 const struct lttng_credentials *cmd_creds,
154 const struct lttng_trigger *trigger,
155 struct notification_thread_handle *notification_thread_handle);
156
157enum lttng_error_code cmd_list_triggers(struct command_ctx *cmd_ctx,
158 struct notification_thread_handle *notification_thread_handle,
159 struct lttng_triggers **return_triggers);
160enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cmd_creds,
161 const struct lttng_error_query *query,
162 struct lttng_error_query_results **_results,
163 struct notification_thread_handle *notification_thread);
164
165int cmd_rotate_session(struct ltt_session *session,
166 struct lttng_rotate_session_return *rotate_return,
167 bool quiet_rotation,
168 enum lttng_trace_chunk_command_type command);
169int cmd_rotate_get_info(struct ltt_session *session,
170 struct lttng_rotation_get_info_return *info_return,
171 uint64_t rotate_id);
172int cmd_rotation_set_schedule(struct ltt_session *session,
173 bool activate, enum lttng_rotation_schedule_type schedule_type,
174 uint64_t value,
175 struct notification_thread_handle *notification_thread_handle);
176
177const struct cmd_completion_handler *cmd_pop_completion_handler(void);
178int start_kernel_session(struct ltt_kernel_session *ksess);
179int stop_kernel_session(struct ltt_kernel_session *ksess);
180
181#endif /* CMD_H */
This page took 0.034849 seconds and 4 git commands to generate.