sessiond: introduce ltt_session::locked_ref look-up functions
[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"
28f23191 16
c9e313bc 17#include <common/tracker.hpp>
11927a78 18
49cddecd 19#include <lttng/kernel.h>
2f77fc4b 20
b0880ae5 21struct notification_thread_handle;
999af9c1 22struct lttng_dynamic_buffer;
b0880ae5 23
a503e1ef
JG
24/*
25 * A callback (and associated user data) that should be run after a command
26 * has been executed. No locks should be taken while executing this handler.
27 *
28 * The command's reply should not be sent until the handler has run and
29 * completed successfully. On failure, the handler's return code should
30 * be the only reply sent to the client.
31 */
e665dfbc 32using completion_handler_function = enum lttng_error_code (*)(void *);
a503e1ef
JG
33struct cmd_completion_handler {
34 completion_handler_function run;
35 void *data;
36};
37
2f77fc4b
DG
38/*
39 * Init the command subsystem. Must be called before using any of the functions
40 * above. This is called in the main() of the session daemon.
41 */
0f4aa1a8 42void cmd_init();
2f77fc4b
DG
43
44/* Session commands */
28f23191
JG
45enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx,
46 int sock,
47 struct lttng_session_descriptor **return_descriptor);
0038180d 48int cmd_destroy_session(struct ltt_session *session, int *sock_fd);
2f77fc4b
DG
49
50/* Channel commands */
56a37563 51int cmd_disable_channel(struct ltt_session *session,
28f23191
JG
52 enum lttng_domain_type domain,
53 char *channel_name);
d9a970b7
JG
54int cmd_enable_channel(struct command_ctx *cmd_ctx,
55 ltt_session::locked_ref& session,
56 int sock,
57 int wpipe);
159b042f
JG
58
59/* Process attribute tracker commands */
28f23191
JG
60enum lttng_error_code
61cmd_process_attr_tracker_get_tracking_policy(struct ltt_session *session,
62 enum lttng_domain_type domain,
63 enum lttng_process_attr process_attr,
64 enum lttng_tracking_policy *policy);
65enum lttng_error_code
66cmd_process_attr_tracker_set_tracking_policy(struct ltt_session *session,
67 enum lttng_domain_type domain,
68 enum lttng_process_attr process_attr,
69 enum lttng_tracking_policy policy);
70enum lttng_error_code
71cmd_process_attr_tracker_inclusion_set_add_value(struct ltt_session *session,
72 enum lttng_domain_type domain,
73 enum lttng_process_attr process_attr,
74 const struct process_attr_value *value);
75enum lttng_error_code
76cmd_process_attr_tracker_inclusion_set_remove_value(struct ltt_session *session,
77 enum lttng_domain_type domain,
78 enum lttng_process_attr process_attr,
79 const struct process_attr_value *value);
80enum lttng_error_code
81cmd_process_attr_tracker_get_inclusion_set(struct ltt_session *session,
82 enum lttng_domain_type domain,
83 enum lttng_process_attr process_attr,
84 struct lttng_process_attr_values **values);
2f77fc4b
DG
85
86/* Event commands */
8ddd72ef 87int cmd_disable_event(struct command_ctx *cmd_ctx,
d9a970b7 88 ltt_session::locked_ref& locked_session,
28f23191
JG
89 struct lttng_event *event,
90 char *filter_expression,
91 struct lttng_bytecode *filter,
92 struct lttng_event_exclusion *exclusion);
26e1c61f 93int cmd_add_context(struct command_ctx *cmd_ctx,
d9a970b7 94 ltt_session::locked_ref& locked_session,
28f23191
JG
95 const struct lttng_event_context *event_context,
96 int kwpipe);
97int cmd_set_filter(struct ltt_session *session,
98 enum lttng_domain_type domain,
99 char *channel_name,
100 struct lttng_event *event,
101 struct lttng_bytecode *bytecode);
8ddd72ef 102int cmd_enable_event(struct command_ctx *cmd_ctx,
d9a970b7 103 ltt_session::locked_ref& session,
28f23191
JG
104 struct lttng_event *event,
105 char *filter_expression,
106 struct lttng_event_exclusion *exclusion,
107 struct lttng_bytecode *bytecode,
108 int wpipe);
2f77fc4b
DG
109
110/* Trace session action commands */
111int cmd_start_trace(struct ltt_session *session);
112int cmd_stop_trace(struct ltt_session *session);
113
114/* Consumer commands */
56a37563 115int cmd_register_consumer(struct ltt_session *session,
28f23191
JG
116 enum lttng_domain_type domain,
117 const char *sock_path,
118 struct consumer_data *cdata);
119int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri, struct lttng_uri *uris);
ffe60014 120int cmd_setup_relayd(struct ltt_session *session);
2f77fc4b
DG
121
122/* Listing commands */
28f23191 123ssize_t cmd_list_domains(struct ltt_session *session, struct lttng_domain **domains);
8ddd72ef 124enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
28f23191
JG
125 struct ltt_session *session,
126 char *channel_name,
127 struct lttng_payload *payload);
999af9c1 128enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
28f23191
JG
129 struct ltt_session *session,
130 struct lttng_payload *payload);
b178f53e 131void cmd_list_lttng_sessions(struct lttng_session *sessions,
28f23191
JG
132 size_t session_count,
133 uid_t uid,
134 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);
6dc3064a 139ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
28f23191
JG
140 struct lttng_snapshot_output **outputs);
141enum lttng_error_code cmd_list_syscalls(struct lttng_payload *reply_payload);
2f77fc4b 142
6d805429 143int cmd_data_pending(struct ltt_session *session);
49cddecd 144enum lttng_error_code cmd_kernel_tracer_status(enum lttng_kernel_tracer_status *status);
2f77fc4b 145
6dc3064a
DG
146/* Snapshot */
147int cmd_snapshot_add_output(struct ltt_session *session,
28f23191
JG
148 const struct lttng_snapshot_output *output,
149 uint32_t *id);
6dc3064a 150int cmd_snapshot_del_output(struct ltt_session *session,
28f23191 151 const struct lttng_snapshot_output *output);
6dc3064a 152int cmd_snapshot_record(struct ltt_session *session,
28f23191
JG
153 const struct lttng_snapshot_output *output,
154 int wait);
6dc3064a 155
28f23191 156int cmd_set_session_shm_path(struct ltt_session *session, const char *shm_path);
eded6438 157int cmd_regenerate_metadata(struct ltt_session *session);
c2561365 158int cmd_regenerate_statedump(struct ltt_session *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
5c408ad8 180int cmd_rotate_session(struct ltt_session *session,
28f23191
JG
181 struct lttng_rotate_session_return *rotate_return,
182 bool quiet_rotation,
183 enum lttng_trace_chunk_command_type command);
d68c9a04 184int cmd_rotate_get_info(struct ltt_session *session,
28f23191
JG
185 struct lttng_rotation_get_info_return *info_return,
186 uint64_t rotate_id);
66ea93b1 187int cmd_rotation_set_schedule(struct ltt_session *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.097571 seconds and 4 git commands to generate.