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