Cleanup: rotation-thread: enforce conding standard following 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 "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, int *sock_fd);
44
45/* Channel commands */
46int cmd_disable_channel(struct ltt_session *session,
47 enum lttng_domain_type domain, char *channel_name);
48int cmd_enable_channel(struct command_ctx *cmd_ctx, int sock, int wpipe);
49
50/* Process attribute tracker commands */
51enum lttng_error_code cmd_process_attr_tracker_get_tracking_policy(
52 struct ltt_session *session,
53 enum lttng_domain_type domain,
54 enum lttng_process_attr process_attr,
55 enum lttng_tracking_policy *policy);
56enum lttng_error_code cmd_process_attr_tracker_set_tracking_policy(
57 struct ltt_session *session,
58 enum lttng_domain_type domain,
59 enum lttng_process_attr process_attr,
60 enum lttng_tracking_policy policy);
61enum lttng_error_code cmd_process_attr_tracker_inclusion_set_add_value(
62 struct ltt_session *session,
63 enum lttng_domain_type domain,
64 enum lttng_process_attr process_attr,
65 const struct process_attr_value *value);
66enum lttng_error_code cmd_process_attr_tracker_inclusion_set_remove_value(
67 struct ltt_session *session,
68 enum lttng_domain_type domain,
69 enum lttng_process_attr process_attr,
70 const struct process_attr_value *value);
71enum lttng_error_code cmd_process_attr_tracker_get_inclusion_set(
72 struct ltt_session *session,
73 enum lttng_domain_type domain,
74 enum lttng_process_attr process_attr,
75 struct lttng_process_attr_values **values);
76
77/* Event commands */
78int cmd_disable_event(struct command_ctx *cmd_ctx,
79 struct lttng_event *event,
80 char *filter_expression,
81 struct lttng_bytecode *filter,
82 struct lttng_event_exclusion *exclusion);
83int cmd_add_context(struct command_ctx *cmd_ctx,
84 const struct lttng_event_context *event_context,
85 int kwpipe);
86int cmd_set_filter(struct ltt_session *session, enum lttng_domain_type domain,
87 char *channel_name, struct lttng_event *event,
88 struct lttng_bytecode *bytecode);
89int cmd_enable_event(struct command_ctx *cmd_ctx,
90 struct lttng_event *event,
91 char *filter_expression,
92 struct lttng_event_exclusion *exclusion,
93 struct lttng_bytecode *bytecode,
94 int wpipe);
95
96/* Trace session action commands */
97int cmd_start_trace(struct ltt_session *session);
98int cmd_stop_trace(struct ltt_session *session);
99
100/* Consumer commands */
101int cmd_register_consumer(struct ltt_session *session,
102 enum lttng_domain_type domain,
103 const char *sock_path, struct consumer_data *cdata);
104int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri,
105 struct lttng_uri *uris);
106int cmd_setup_relayd(struct ltt_session *session);
107
108/* Listing commands */
109ssize_t cmd_list_domains(struct ltt_session *session,
110 struct lttng_domain **domains);
111enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
112 struct ltt_session *session,
113 char *channel_name,
114 struct lttng_payload *payload);
115enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
116 struct ltt_session *session,
117 struct lttng_payload *payload);
118void cmd_list_lttng_sessions(struct lttng_session *sessions,
119 size_t session_count, uid_t uid, gid_t gid);
120enum lttng_error_code cmd_list_tracepoint_fields(enum lttng_domain_type domain,
121 struct lttng_payload *reply);
122enum lttng_error_code cmd_list_tracepoints(enum lttng_domain_type domain,
123 struct lttng_payload *reply_payload);
124ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
125 struct lttng_snapshot_output **outputs);
126enum lttng_error_code cmd_list_syscalls(
127 struct lttng_payload *reply_payload);
128
129int cmd_data_pending(struct ltt_session *session);
130
131/* Snapshot */
132int cmd_snapshot_add_output(struct ltt_session *session,
133 const struct lttng_snapshot_output *output, uint32_t *id);
134int cmd_snapshot_del_output(struct ltt_session *session,
135 const struct lttng_snapshot_output *output);
136int cmd_snapshot_record(struct ltt_session *session,
137 const struct lttng_snapshot_output *output, int wait);
138
139int cmd_set_session_shm_path(struct ltt_session *session,
140 const char *shm_path);
141int cmd_regenerate_metadata(struct ltt_session *session);
142int cmd_regenerate_statedump(struct ltt_session *session);
143
144enum lttng_error_code cmd_register_trigger(
145 const struct lttng_credentials *cmd_creds,
146 struct lttng_trigger *trigger,
147 bool is_anonymous_trigger,
148 struct notification_thread_handle *notification_thread_handle,
149 struct lttng_trigger **return_trigger);
150enum lttng_error_code cmd_unregister_trigger(
151 const struct lttng_credentials *cmd_creds,
152 const struct lttng_trigger *trigger,
153 struct notification_thread_handle *notification_thread_handle);
154
155enum lttng_error_code cmd_list_triggers(struct command_ctx *cmd_ctx,
156 struct notification_thread_handle *notification_thread_handle,
157 struct lttng_triggers **return_triggers);
158enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cmd_creds,
159 const struct lttng_error_query *query,
160 struct lttng_error_query_results **_results,
161 struct notification_thread_handle *notification_thread);
162
163int cmd_rotate_session(struct ltt_session *session,
164 struct lttng_rotate_session_return *rotate_return,
165 bool quiet_rotation,
166 enum lttng_trace_chunk_command_type command);
167int cmd_rotate_get_info(struct ltt_session *session,
168 struct lttng_rotation_get_info_return *info_return,
169 uint64_t rotate_id);
170int cmd_rotation_set_schedule(struct ltt_session *session,
171 bool activate, enum lttng_rotation_schedule_type schedule_type,
172 uint64_t value);
173
174const struct cmd_completion_handler *cmd_pop_completion_handler(void);
175int start_kernel_session(struct ltt_kernel_session *ksess);
176int stop_kernel_session(struct ltt_kernel_session *ksess);
177
178#endif /* CMD_H */
This page took 0.02286 seconds and 4 git commands to generate.