Fix: liblttng-ctl comm: lttng_event_context is not packed
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.h
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.h"
12 #include "lttng-sessiond.h"
13 #include "lttng/tracker.h"
14 #include "session.h"
15 #include <common/tracker.h>
16
17 struct notification_thread_handle;
18 struct 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 */
28 typedef enum lttng_error_code (*completion_handler_function)(void *);
29 struct 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 */
38 void cmd_init(void);
39
40 /* Session commands */
41 enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx, int sock,
42 struct lttng_session_descriptor **return_descriptor);
43 int cmd_destroy_session(struct ltt_session *session,
44 struct notification_thread_handle *notification_thread_handle,
45 int *sock_fd);
46
47 /* Channel commands */
48 int cmd_disable_channel(struct ltt_session *session,
49 enum lttng_domain_type domain, char *channel_name);
50 int cmd_enable_channel(struct command_ctx *cmd_ctx, int sock, int wpipe);
51
52 /* Process attribute tracker commands */
53 enum 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);
58 enum 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);
63 enum 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);
68 enum 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);
73 enum 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 */
80 int cmd_disable_event(struct command_ctx *cmd_ctx, int sock);
81 int cmd_add_context(struct command_ctx *cmd_ctx, int sock, int kwpipe);
82 int cmd_set_filter(struct ltt_session *session, enum lttng_domain_type domain,
83 char *channel_name, struct lttng_event *event,
84 struct lttng_filter_bytecode *bytecode);
85 int cmd_enable_event(struct command_ctx *cmd_ctx, int sock, int wpipe);
86
87 /* Trace session action commands */
88 int cmd_start_trace(struct ltt_session *session);
89 int cmd_stop_trace(struct ltt_session *session);
90
91 /* Consumer commands */
92 int cmd_register_consumer(struct ltt_session *session,
93 enum lttng_domain_type domain,
94 const char *sock_path, struct consumer_data *cdata);
95 int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri,
96 struct lttng_uri *uris);
97 int cmd_setup_relayd(struct ltt_session *session);
98
99 /* Listing commands */
100 ssize_t cmd_list_domains(struct ltt_session *session,
101 struct lttng_domain **domains);
102 enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
103 struct ltt_session *session,
104 char *channel_name,
105 struct lttng_dynamic_buffer *payload,
106 unsigned int *nb_events);
107 enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
108 struct ltt_session *session,
109 struct lttng_dynamic_buffer *buffer,
110 uint32_t *nb_channel);
111 ssize_t cmd_list_domains(struct ltt_session *session,
112 struct lttng_domain **domains);
113 void cmd_list_lttng_sessions(struct lttng_session *sessions,
114 size_t session_count, uid_t uid, gid_t gid);
115 ssize_t cmd_list_tracepoint_fields(enum lttng_domain_type domain,
116 struct lttng_event_field **fields);
117 enum lttng_error_code cmd_list_tracepoints(enum lttng_domain_type domain,
118 struct lttng_dynamic_buffer *buffer,
119 unsigned int *nb_tracepoints);
120 ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
121 struct lttng_snapshot_output **outputs);
122 enum lttng_error_code cmd_list_syscalls(
123 struct lttng_dynamic_buffer *buffer, unsigned int *nb_syscalls);
124
125 int cmd_data_pending(struct ltt_session *session);
126
127 /* Snapshot */
128 int cmd_snapshot_add_output(struct ltt_session *session,
129 const struct lttng_snapshot_output *output, uint32_t *id);
130 int cmd_snapshot_del_output(struct ltt_session *session,
131 const struct lttng_snapshot_output *output);
132 int cmd_snapshot_record(struct ltt_session *session,
133 const struct lttng_snapshot_output *output, int wait);
134
135 int cmd_set_session_shm_path(struct ltt_session *session,
136 const char *shm_path);
137 int cmd_regenerate_metadata(struct ltt_session *session);
138 int cmd_regenerate_statedump(struct ltt_session *session);
139
140 int cmd_register_trigger(struct command_ctx *cmd_ctx, int sock,
141 struct notification_thread_handle *notification_thread_handle);
142 int cmd_unregister_trigger(struct command_ctx *cmd_ctx, int sock,
143 struct notification_thread_handle *notification_thread_handle);
144
145 int cmd_rotate_session(struct ltt_session *session,
146 struct lttng_rotate_session_return *rotate_return,
147 bool quiet_rotation,
148 enum lttng_trace_chunk_command_type command);
149 int cmd_rotate_get_info(struct ltt_session *session,
150 struct lttng_rotation_get_info_return *info_return,
151 uint64_t rotate_id);
152 int cmd_rotation_set_schedule(struct ltt_session *session,
153 bool activate, enum lttng_rotation_schedule_type schedule_type,
154 uint64_t value,
155 struct notification_thread_handle *notification_thread_handle);
156
157 const struct cmd_completion_handler *cmd_pop_completion_handler(void);
158 int start_kernel_session(struct ltt_kernel_session *ksess);
159 int stop_kernel_session(struct ltt_kernel_session *ksess);
160
161 #endif /* CMD_H */
This page took 0.032028 seconds and 4 git commands to generate.