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