Generate session name and default output on sessiond's end
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.h
1 /*
2 * Copyright (C) 2012 - David Goulet <dgoulet@efficios.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18 #ifndef CMD_H
19 #define CMD_H
20
21 #include "context.h"
22 #include "session.h"
23
24 struct notification_thread_handle;
25
26 /*
27 * A callback (and associated user data) that should be run after a command
28 * has been executed. No locks should be taken while executing this handler.
29 *
30 * The command's reply should not be sent until the handler has run and
31 * completed successfully. On failure, the handler's return code should
32 * be the only reply sent to the client.
33 */
34 typedef enum lttng_error_code (*completion_handler_function)(void *);
35 struct cmd_completion_handler {
36 completion_handler_function run;
37 void *data;
38 };
39
40 /*
41 * Init the command subsystem. Must be called before using any of the functions
42 * above. This is called in the main() of the session daemon.
43 */
44 void cmd_init(void);
45
46 /* Session commands */
47 enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx, int sock,
48 struct lttng_session_descriptor **return_descriptor);
49 int cmd_destroy_session(struct ltt_session *session,
50 struct notification_thread_handle *notification_thread_handle);
51
52 /* Channel commands */
53 int cmd_disable_channel(struct ltt_session *session,
54 enum lttng_domain_type domain, char *channel_name);
55 int cmd_enable_channel(struct ltt_session *session,
56 struct lttng_domain *domain, struct lttng_channel *attr,
57 int wpipe);
58 int cmd_track_pid(struct ltt_session *session, enum lttng_domain_type domain,
59 int pid);
60 int cmd_untrack_pid(struct ltt_session *session, enum lttng_domain_type domain,
61 int pid);
62
63 /* Event commands */
64 int cmd_disable_event(struct ltt_session *session,
65 enum lttng_domain_type domain,
66 char *channel_name,
67 struct lttng_event *event);
68 int cmd_add_context(struct ltt_session *session, enum lttng_domain_type domain,
69 char *channel_name, struct lttng_event_context *ctx, int kwpipe);
70 int cmd_set_filter(struct ltt_session *session, enum lttng_domain_type domain,
71 char *channel_name, struct lttng_event *event,
72 struct lttng_filter_bytecode *bytecode);
73 int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain,
74 char *channel_name, struct lttng_event *event,
75 char *filter_expression,
76 struct lttng_filter_bytecode *filter,
77 struct lttng_event_exclusion *exclusion,
78 int wpipe);
79
80 /* Trace session action commands */
81 int cmd_start_trace(struct ltt_session *session);
82 int cmd_stop_trace(struct ltt_session *session);
83
84 /* Consumer commands */
85 int cmd_register_consumer(struct ltt_session *session,
86 enum lttng_domain_type domain,
87 const char *sock_path, struct consumer_data *cdata);
88 int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri,
89 struct lttng_uri *uris);
90 int cmd_setup_relayd(struct ltt_session *session);
91
92 /* Listing commands */
93 ssize_t cmd_list_domains(struct ltt_session *session,
94 struct lttng_domain **domains);
95 ssize_t cmd_list_events(enum lttng_domain_type domain,
96 struct ltt_session *session, char *channel_name,
97 struct lttng_event **events, size_t *total_size);
98 ssize_t cmd_list_channels(enum lttng_domain_type domain,
99 struct ltt_session *session, struct lttng_channel **channels);
100 ssize_t cmd_list_domains(struct ltt_session *session,
101 struct lttng_domain **domains);
102 void cmd_list_lttng_sessions(struct lttng_session *sessions,
103 size_t session_count, uid_t uid, gid_t gid);
104 ssize_t cmd_list_tracepoint_fields(enum lttng_domain_type domain,
105 struct lttng_event_field **fields);
106 ssize_t cmd_list_tracepoints(enum lttng_domain_type domain,
107 struct lttng_event **events);
108 ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
109 struct lttng_snapshot_output **outputs);
110 ssize_t cmd_list_syscalls(struct lttng_event **events);
111 ssize_t cmd_list_tracker_pids(struct ltt_session *session,
112 enum lttng_domain_type domain, int32_t **pids);
113
114 int cmd_data_pending(struct ltt_session *session);
115
116 /* Snapshot */
117 int cmd_snapshot_add_output(struct ltt_session *session,
118 struct lttng_snapshot_output *output, uint32_t *id);
119 int cmd_snapshot_del_output(struct ltt_session *session,
120 struct lttng_snapshot_output *output);
121 int cmd_snapshot_record(struct ltt_session *session,
122 struct lttng_snapshot_output *output, int wait);
123
124 int cmd_set_session_shm_path(struct ltt_session *session,
125 const char *shm_path);
126 int cmd_regenerate_metadata(struct ltt_session *session);
127 int cmd_regenerate_statedump(struct ltt_session *session);
128
129 int cmd_register_trigger(struct command_ctx *cmd_ctx, int sock,
130 struct notification_thread_handle *notification_thread_handle);
131 int cmd_unregister_trigger(struct command_ctx *cmd_ctx, int sock,
132 struct notification_thread_handle *notification_thread_handle);
133
134 int cmd_rotate_session(struct ltt_session *session,
135 struct lttng_rotate_session_return *rotate_return);
136 int cmd_rotate_get_info(struct ltt_session *session,
137 struct lttng_rotation_get_info_return *info_return,
138 uint64_t rotate_id);
139 int cmd_rotation_set_schedule(struct ltt_session *session,
140 bool activate, enum lttng_rotation_schedule_type schedule_type,
141 uint64_t value,
142 struct notification_thread_handle *notification_thread_handle);
143
144 const struct cmd_completion_handler *cmd_pop_completion_handler(void);
145
146 #endif /* CMD_H */
This page took 0.031018 seconds and 4 git commands to generate.