SoW-2019-0002: Dynamic Snapshot
[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 "session.h"
13 #include "lttng-sessiond.h"
14
15 struct notification_thread_handle;
16
17 /*
18 * A callback (and associated user data) that should be run after a command
19 * has been executed. No locks should be taken while executing this handler.
20 *
21 * The command's reply should not be sent until the handler has run and
22 * completed successfully. On failure, the handler's return code should
23 * be the only reply sent to the client.
24 */
25 typedef enum lttng_error_code (*completion_handler_function)(void *);
26 struct cmd_completion_handler {
27 completion_handler_function run;
28 void *data;
29 };
30
31 /*
32 * Init the command subsystem. Must be called before using any of the functions
33 * above. This is called in the main() of the session daemon.
34 */
35 void cmd_init(void);
36
37 /* Session commands */
38 enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx, int sock,
39 struct lttng_session_descriptor **return_descriptor);
40 int cmd_destroy_session(struct ltt_session *session,
41 struct notification_thread_handle *notification_thread_handle,
42 int *sock_fd);
43
44 /* Channel commands */
45 int cmd_disable_channel(struct ltt_session *session,
46 enum lttng_domain_type domain, char *channel_name);
47 int cmd_enable_channel(struct ltt_session *session,
48 const struct lttng_domain *domain, const struct lttng_channel *attr,
49 int wpipe);
50 int cmd_track_id(struct ltt_session *session,
51 enum lttng_tracker_type tracker_type,
52 enum lttng_domain_type domain,
53 const struct lttng_tracker_id *id);
54 int cmd_untrack_id(struct ltt_session *session,
55 enum lttng_tracker_type tracker_type,
56 enum lttng_domain_type domain,
57 const struct lttng_tracker_id *id);
58
59 /* Event commands */
60 int cmd_disable_event(struct ltt_session *session,
61 enum lttng_domain_type domain,
62 const char *channel_name,
63 const struct lttng_event *event);
64 int cmd_add_context(struct ltt_session *session, enum lttng_domain_type domain,
65 char *channel_name, const struct lttng_event_context *ctx, int kwpipe);
66 int cmd_set_filter(struct ltt_session *session, enum lttng_domain_type domain,
67 char *channel_name, struct lttng_event *event,
68 struct lttng_filter_bytecode *bytecode);
69 int cmd_enable_event(struct ltt_session *session, const struct lttng_domain *domain,
70 char *channel_name, struct lttng_event *event,
71 char *filter_expression,
72 struct lttng_filter_bytecode *filter,
73 struct lttng_event_exclusion *exclusion,
74 int wpipe);
75
76 /* Trace session action commands */
77 int cmd_start_trace(struct ltt_session *session);
78 int cmd_stop_trace(struct ltt_session *session);
79
80 /* Consumer commands */
81 int cmd_register_consumer(struct ltt_session *session,
82 enum lttng_domain_type domain,
83 const char *sock_path, struct consumer_data *cdata);
84 int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri,
85 struct lttng_uri *uris);
86 int cmd_setup_relayd(struct ltt_session *session);
87
88 /* Listing commands */
89 ssize_t cmd_list_domains(struct ltt_session *session,
90 struct lttng_domain **domains);
91 ssize_t cmd_list_events(enum lttng_domain_type domain,
92 struct ltt_session *session, char *channel_name,
93 struct lttng_event **events, size_t *total_size);
94 ssize_t cmd_list_channels(enum lttng_domain_type domain,
95 struct ltt_session *session, struct lttng_channel **channels);
96 ssize_t cmd_list_domains(struct ltt_session *session,
97 struct lttng_domain **domains);
98 void cmd_list_lttng_sessions(struct lttng_session *sessions,
99 size_t session_count, uid_t uid, gid_t gid);
100 ssize_t cmd_list_tracepoint_fields(enum lttng_domain_type domain,
101 struct lttng_event_field **fields);
102 ssize_t cmd_list_tracepoints(enum lttng_domain_type domain,
103 struct lttng_event **events);
104 ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
105 struct lttng_snapshot_output **outputs);
106 ssize_t cmd_list_syscalls(struct lttng_event **events);
107 int cmd_list_tracker_ids(enum lttng_tracker_type tracker_type,
108 struct ltt_session *session,
109 enum lttng_domain_type domain,
110 struct lttng_tracker_ids **ids);
111
112 int cmd_data_pending(struct ltt_session *session);
113
114 /* Snapshot */
115 int cmd_snapshot_add_output(struct ltt_session *session,
116 const struct lttng_snapshot_output *output, uint32_t *id);
117 int cmd_snapshot_del_output(struct ltt_session *session,
118 const struct lttng_snapshot_output *output);
119 int cmd_snapshot_record(struct ltt_session *session,
120 const struct lttng_snapshot_output *output, int wait);
121
122 int cmd_set_session_shm_path(struct ltt_session *session,
123 const char *shm_path);
124 int cmd_regenerate_metadata(struct ltt_session *session);
125 int cmd_regenerate_statedump(struct ltt_session *session);
126
127 int cmd_register_trigger(struct command_ctx *cmd_ctx, int sock,
128 struct notification_thread_handle *notification_thread_handle,
129 struct lttng_trigger **return_trigger);
130 int cmd_unregister_trigger(struct command_ctx *cmd_ctx, int sock,
131 struct notification_thread_handle *notification_thread_handle);
132
133 int cmd_list_triggers(struct command_ctx *cmd_ctx, int sock,
134 struct notification_thread_handle *notification_thread_handle,
135 struct lttng_triggers **return_triggers);
136
137 int cmd_rotate_session(struct ltt_session *session,
138 struct lttng_rotate_session_return *rotate_return,
139 bool quiet_rotation,
140 enum lttng_trace_chunk_command_type command);
141 int cmd_rotate_get_info(struct ltt_session *session,
142 struct lttng_rotation_get_info_return *info_return,
143 uint64_t rotate_id);
144 int cmd_rotation_set_schedule(struct ltt_session *session,
145 bool activate, enum lttng_rotation_schedule_type schedule_type,
146 uint64_t value,
147 struct notification_thread_handle *notification_thread_handle);
148
149 const struct cmd_completion_handler *cmd_pop_completion_handler(void);
150 int start_kernel_session(struct ltt_kernel_session *ksess);
151 int stop_kernel_session(struct ltt_kernel_session *ksess);
152
153 #endif /* CMD_H */
This page took 0.047112 seconds and 5 git commands to generate.