Generate session name and default output on sessiond's end
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.h
CommitLineData
2f77fc4b
DG
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"
2f77fc4b
DG
22#include "session.h"
23
b0880ae5
JG
24struct notification_thread_handle;
25
a503e1ef
JG
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 */
34typedef enum lttng_error_code (*completion_handler_function)(void *);
35struct cmd_completion_handler {
36 completion_handler_function run;
37 void *data;
38};
39
2f77fc4b
DG
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 */
44void cmd_init(void);
45
46/* Session commands */
b178f53e
JG
47enum lttng_error_code cmd_create_session(struct command_ctx *cmd_ctx, int sock,
48 struct lttng_session_descriptor **return_descriptor);
e32d7f27 49int cmd_destroy_session(struct ltt_session *session,
90936dcf 50 struct notification_thread_handle *notification_thread_handle);
2f77fc4b
DG
51
52/* Channel commands */
56a37563
JG
53int cmd_disable_channel(struct ltt_session *session,
54 enum lttng_domain_type domain, char *channel_name);
7972aab2 55int cmd_enable_channel(struct ltt_session *session,
56a37563
JG
56 struct lttng_domain *domain, struct lttng_channel *attr,
57 int wpipe);
58int cmd_track_pid(struct ltt_session *session, enum lttng_domain_type domain,
59 int pid);
60int cmd_untrack_pid(struct ltt_session *session, enum lttng_domain_type domain,
61 int pid);
2f77fc4b
DG
62
63/* Event commands */
56a37563
JG
64int cmd_disable_event(struct ltt_session *session,
65 enum lttng_domain_type domain,
6e911cad
MD
66 char *channel_name,
67 struct lttng_event *event);
56a37563 68int cmd_add_context(struct ltt_session *session, enum lttng_domain_type domain,
601d5acf 69 char *channel_name, struct lttng_event_context *ctx, int kwpipe);
56a37563 70int cmd_set_filter(struct ltt_session *session, enum lttng_domain_type domain,
178191b3 71 char *channel_name, struct lttng_event *event,
2f77fc4b 72 struct lttng_filter_bytecode *bytecode);
7972aab2 73int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain,
025faf73 74 char *channel_name, struct lttng_event *event,
6b453b5e 75 char *filter_expression,
db8f1377
JI
76 struct lttng_filter_bytecode *filter,
77 struct lttng_event_exclusion *exclusion,
78 int wpipe);
2f77fc4b
DG
79
80/* Trace session action commands */
81int cmd_start_trace(struct ltt_session *session);
82int cmd_stop_trace(struct ltt_session *session);
83
84/* Consumer commands */
56a37563
JG
85int cmd_register_consumer(struct ltt_session *session,
86 enum lttng_domain_type domain,
2f77fc4b 87 const char *sock_path, struct consumer_data *cdata);
bda32d56
JG
88int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri,
89 struct lttng_uri *uris);
ffe60014 90int cmd_setup_relayd(struct ltt_session *session);
2f77fc4b
DG
91
92/* Listing commands */
93ssize_t cmd_list_domains(struct ltt_session *session,
94 struct lttng_domain **domains);
56a37563
JG
95ssize_t cmd_list_events(enum lttng_domain_type domain,
96 struct ltt_session *session, char *channel_name,
b4e3ceb9 97 struct lttng_event **events, size_t *total_size);
56a37563
JG
98ssize_t cmd_list_channels(enum lttng_domain_type domain,
99 struct ltt_session *session, struct lttng_channel **channels);
2f77fc4b
DG
100ssize_t cmd_list_domains(struct ltt_session *session,
101 struct lttng_domain **domains);
b178f53e
JG
102void cmd_list_lttng_sessions(struct lttng_session *sessions,
103 size_t session_count, uid_t uid, gid_t gid);
56a37563 104ssize_t cmd_list_tracepoint_fields(enum lttng_domain_type domain,
2f77fc4b 105 struct lttng_event_field **fields);
56a37563
JG
106ssize_t cmd_list_tracepoints(enum lttng_domain_type domain,
107 struct lttng_event **events);
6dc3064a
DG
108ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
109 struct lttng_snapshot_output **outputs);
834978fd 110ssize_t cmd_list_syscalls(struct lttng_event **events);
a5dfbb9d 111ssize_t cmd_list_tracker_pids(struct ltt_session *session,
56a37563 112 enum lttng_domain_type domain, int32_t **pids);
2f77fc4b 113
6d805429 114int cmd_data_pending(struct ltt_session *session);
2f77fc4b 115
6dc3064a
DG
116/* Snapshot */
117int cmd_snapshot_add_output(struct ltt_session *session,
118 struct lttng_snapshot_output *output, uint32_t *id);
119int cmd_snapshot_del_output(struct ltt_session *session,
120 struct lttng_snapshot_output *output);
121int cmd_snapshot_record(struct ltt_session *session,
122 struct lttng_snapshot_output *output, int wait);
123
d7ba1388
MD
124int cmd_set_session_shm_path(struct ltt_session *session,
125 const char *shm_path);
eded6438 126int cmd_regenerate_metadata(struct ltt_session *session);
c2561365 127int cmd_regenerate_statedump(struct ltt_session *session);
d7ba1388 128
b0880ae5
JG
129int cmd_register_trigger(struct command_ctx *cmd_ctx, int sock,
130 struct notification_thread_handle *notification_thread_handle);
131int cmd_unregister_trigger(struct command_ctx *cmd_ctx, int sock,
132 struct notification_thread_handle *notification_thread_handle);
133
5c408ad8
JD
134int cmd_rotate_session(struct ltt_session *session,
135 struct lttng_rotate_session_return *rotate_return);
d68c9a04
JD
136int cmd_rotate_get_info(struct ltt_session *session,
137 struct lttng_rotation_get_info_return *info_return,
138 uint64_t rotate_id);
66ea93b1
JG
139int cmd_rotation_set_schedule(struct ltt_session *session,
140 bool activate, enum lttng_rotation_schedule_type schedule_type,
141 uint64_t value,
90936dcf 142 struct notification_thread_handle *notification_thread_handle);
5c408ad8 143
a503e1ef
JG
144const struct cmd_completion_handler *cmd_pop_completion_handler(void);
145
2f77fc4b 146#endif /* CMD_H */
This page took 0.067327 seconds and 5 git commands to generate.