2 * Copyright (C) 2014 - Jonathan Rajotte <jonathan.r.julien@gmail.com>
3 * - Olivier Cotte <olivier.cotte@polymtl.ca>
4 * Copyright (C) 2016 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License, version 2 only, as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include <common/error.h>
26 #include <common/macros.h>
27 #include <common/config/session-config.h>
28 #include <lttng/lttng.h>
30 /* Don't want to reference snapshot-internal.h here */
31 struct lttng_snapshot_output
;
33 /* Instance of a machine interface writer. */
35 struct config_writer
*writer
;
36 enum lttng_mi_output_type type
;
40 * Version information for the machine interface.
42 struct mi_lttng_version
{
43 char version
[LTTNG_NAME_MAX
]; /* Version number of package */
44 uint32_t version_major
; /* LTTng-Tools major version number */
45 uint32_t version_minor
; /* LTTng-Tools minor version number */
46 uint32_t version_patchlevel
; /* LTTng-Tools patchlevel version number */
47 char version_commit
[LTTNG_NAME_MAX
]; /* Commit hash of the current version */
48 char version_name
[LTTNG_NAME_MAX
];
49 char package_url
[LTTNG_NAME_MAX
]; /* Define to the home page for this package. */
52 /* Strings related to command */
53 extern const char * const mi_lttng_element_command
;
54 extern const char * const mi_lttng_element_command_action
;
55 extern const char * const mi_lttng_element_command_add_context
;
56 extern const char * const mi_lttng_element_command_create
;
57 extern const char * const mi_lttng_element_command_destroy
;
58 extern const char * const mi_lttng_element_command_disable_channel
;
59 extern const char * const mi_lttng_element_command_disable_event
;
60 extern const char * const mi_lttng_element_command_enable_channels
;
61 extern const char * const mi_lttng_element_command_enable_event
;
62 extern const char * const mi_lttng_element_command_list
;
63 extern const char * const mi_lttng_element_command_load
;
64 extern const char * const mi_lttng_element_command_metadata
;
65 extern const char * const mi_lttng_element_command_metadata_action
;
66 extern const char * const mi_lttng_element_command_regenerate
;
67 extern const char * const mi_lttng_element_command_regenerate_action
;
68 extern const char * const mi_lttng_element_command_name
;
69 extern const char * const mi_lttng_element_command_output
;
70 extern const char * const mi_lttng_element_command_save
;
71 extern const char * const mi_lttng_element_command_set_session
;
72 extern const char * const mi_lttng_element_command_snapshot
;
73 extern const char * const mi_lttng_element_command_snapshot_add
;
74 extern const char * const mi_lttng_element_command_snapshot_del
;
75 extern const char * const mi_lttng_element_command_snapshot_list
;
76 extern const char * const mi_lttng_element_command_snapshot_record
;
77 extern const char * const mi_lttng_element_command_start
;
78 extern const char * const mi_lttng_element_command_stop
;
79 extern const char * const mi_lttng_element_command_success
;
80 extern const char * const mi_lttng_element_command_track
;
81 extern const char * const mi_lttng_element_command_untrack
;
82 extern const char * const mi_lttng_element_command_version
;
83 extern const char * const mi_lttng_element_command_rotate
;
84 extern const char * const mi_lttng_element_command_enable_rotation
;
85 extern const char * const mi_lttng_element_command_disable_rotation
;
87 /* Strings related to version command */
88 extern const char * const mi_lttng_element_version
;
89 extern const char * const mi_lttng_element_version_commit
;
90 extern const char * const mi_lttng_element_version_description
;
91 extern const char * const mi_lttng_element_version_license
;
92 extern const char * const mi_lttng_element_version_major
;
93 extern const char * const mi_lttng_element_version_minor
;
94 extern const char * const mi_lttng_element_version_patch_level
;
95 extern const char * const mi_lttng_element_version_str
;
96 extern const char * const mi_lttng_element_version_web
;
98 /* String related to a lttng_event_field */
99 extern const char * const mi_lttng_element_event_field
;
100 extern const char * const mi_lttng_element_event_fields
;
102 /* String related to lttng_event_perf_counter_ctx */
103 extern const char * const mi_lttng_element_perf_counter_context
;
105 /* Strings related to pid */
106 extern const char * const mi_lttng_element_pid_id
;
108 /* Strings related to save command */
109 extern const char * const mi_lttng_element_save
;
111 /* Strings related to load command */
112 extern const char * const mi_lttng_element_load
;
113 LTTNG_HIDDEN
const char * const mi_lttng_element_load_overrides
;
114 LTTNG_HIDDEN
const char * const mi_lttng_element_load_override_url
;
116 /* General element of mi_lttng */
117 extern const char * const mi_lttng_element_empty
;
118 extern const char * const mi_lttng_element_id
;
119 extern const char * const mi_lttng_element_nowrite
;
120 extern const char * const mi_lttng_element_success
;
121 extern const char * const mi_lttng_element_type_enum
;
122 extern const char * const mi_lttng_element_type_float
;
123 extern const char * const mi_lttng_element_type_integer
;
124 extern const char * const mi_lttng_element_type_other
;
125 extern const char * const mi_lttng_element_type_string
;
127 /* String related to loglevel */
128 extern const char * const mi_lttng_loglevel_str_alert
;
129 extern const char * const mi_lttng_loglevel_str_crit
;
130 extern const char * const mi_lttng_loglevel_str_debug
;
131 extern const char * const mi_lttng_loglevel_str_debug_function
;
132 extern const char * const mi_lttng_loglevel_str_debug_line
;
133 extern const char * const mi_lttng_loglevel_str_debug_module
;
134 extern const char * const mi_lttng_loglevel_str_debug_process
;
135 extern const char * const mi_lttng_loglevel_str_debug_program
;
136 extern const char * const mi_lttng_loglevel_str_debug_system
;
137 extern const char * const mi_lttng_loglevel_str_debug_unit
;
138 extern const char * const mi_lttng_loglevel_str_emerg
;
139 extern const char * const mi_lttng_loglevel_str_err
;
140 extern const char * const mi_lttng_loglevel_str_info
;
141 extern const char * const mi_lttng_loglevel_str_notice
;
142 extern const char * const mi_lttng_loglevel_str_unknown
;
143 extern const char * const mi_lttng_loglevel_str_warning
;
145 /* String related to loglevel JUL */
146 extern const char * const mi_lttng_loglevel_str_jul_all
;
147 extern const char * const mi_lttng_loglevel_str_jul_config
;
148 extern const char * const mi_lttng_loglevel_str_jul_fine
;
149 extern const char * const mi_lttng_loglevel_str_jul_finer
;
150 extern const char * const mi_lttng_loglevel_str_jul_finest
;
151 extern const char * const mi_lttng_loglevel_str_jul_info
;
152 extern const char * const mi_lttng_loglevel_str_jul_off
;
153 extern const char * const mi_lttng_loglevel_str_jul_severe
;
154 extern const char * const mi_lttng_loglevel_str_jul_warning
;
156 /* String related to loglevel Log4j */
157 extern const char * const mi_lttng_loglevel_str_log4j_off
;
158 extern const char * const mi_lttng_loglevel_str_log4j_fatal
;
159 extern const char * const mi_lttng_loglevel_str_log4j_error
;
160 extern const char * const mi_lttng_loglevel_str_log4j_warn
;
161 extern const char * const mi_lttng_loglevel_str_log4j_info
;
162 extern const char * const mi_lttng_loglevel_str_log4j_debug
;
163 extern const char * const mi_lttng_loglevel_str_log4j_trace
;
164 extern const char * const mi_lttng_loglevel_str_log4j_all
;
166 /* String related to loglevel Python */
167 extern const char * const mi_lttng_loglevel_str_python_critical
;
168 extern const char * const mi_lttng_loglevel_str_python_error
;
169 extern const char * const mi_lttng_loglevel_str_python_warning
;
170 extern const char * const mi_lttng_loglevel_str_python_info
;
171 extern const char * const mi_lttng_loglevel_str_python_debug
;
172 extern const char * const mi_lttng_loglevel_str_python_notset
;
174 /* String related to loglevel type */
175 extern const char * const mi_lttng_loglevel_type_all
;
176 extern const char * const mi_lttng_loglevel_type_range
;
177 extern const char * const mi_lttng_loglevel_type_single
;
178 extern const char * const mi_lttng_loglevel_type_unknown
;
180 /* String related to a lttng_snapshot */
181 extern const char * const mi_lttng_element_snapshot_ctrl_url
;
182 extern const char * const mi_lttng_element_snapshot_data_url
;
183 extern const char * const mi_lttng_element_snapshot_max_size
;
184 extern const char * const mi_lttng_element_snapshot_n_ptr
;
185 extern const char * const mi_lttng_element_snapshot_session_name
;
186 extern const char * const mi_lttng_element_snapshots
;
188 /* String related to track/untrack command */
189 const char * const mi_lttng_element_track_untrack_all_wildcard
;
191 LTTNG_HIDDEN
const char * const mi_lttng_element_session_name
;
193 /* String related to rotate command */
194 LTTNG_HIDDEN
const char * const mi_lttng_element_rotation
;
195 LTTNG_HIDDEN
const char * const mi_lttng_element_rotations
;
196 LTTNG_HIDDEN
const char * const mi_lttng_element_rotate_status
;
197 LTTNG_HIDDEN
const char * const mi_lttng_element_rotation_schedule
;
199 /* String related to add-context command */
200 LTTNG_HIDDEN
extern const char * const mi_lttng_element_context_symbol
;
202 /* Utility string function */
203 const char *mi_lttng_loglevel_string(int value
, enum lttng_domain_type domain
);
204 const char *mi_lttng_logleveltype_string(enum lttng_loglevel_type value
);
205 const char *mi_lttng_eventfieldtype_string(enum lttng_event_field_type value
);
206 const char *mi_lttng_domaintype_string(enum lttng_domain_type value
);
207 const char *mi_lttng_buffertype_string(enum lttng_buffer_type value
);
210 * Create an instance of a machine interface writer.
212 * fd_output File to which the XML content must be written. The file will be
213 * closed once the mi_writer has been destroyed.
215 * Returns an instance of a machine interface writer on success, NULL on
218 struct mi_writer
*mi_lttng_writer_create(int fd_output
, int mi_output_type
);
221 * Destroy an instance of a machine interface writer.
223 * writer An instance of a machine interface writer.
225 * Returns zero if the XML document could be closed cleanly. Negative values
228 int mi_lttng_writer_destroy(struct mi_writer
*writer
);
231 * Open a command tag and add it's name node.
233 * writer An instance of a machine interface writer.
234 * command The command name.
236 * Returns zero if the XML document could be closed cleanly.
237 * Negative values indicate an error.
239 int mi_lttng_writer_command_open(struct mi_writer
*writer
, const char *command
);
242 * Close a command tag.
244 * writer An instance of a machine interface writer.
246 * Returns zero if the XML document could be closed cleanly.
247 * Negative values indicate an error.
249 int mi_lttng_writer_command_close(struct mi_writer
*writer
);
252 * Open an element tag.
254 * writer An instance of a machine interface writer.
255 * element_name Element tag name.
257 * Returns zero if the XML document could be closed cleanly.
258 * Negative values indicate an error.
260 int mi_lttng_writer_open_element(struct mi_writer
*writer
,
261 const char *element_name
);
264 * Close the current element tag.
266 * writer An instance of a machine interface writer.
268 * Returns zero if the XML document could be closed cleanly.
269 * Negative values indicate an error.
271 int mi_lttng_writer_close_element(struct mi_writer
*writer
);
274 * Close multiple element.
276 * writer An instance of a machine interface writer.
277 * nb_element Number of elements.
279 * Returns zero if the XML document could be closed cleanly.
280 * Negative values indicate an error.
282 int mi_lttng_close_multi_element(struct mi_writer
*writer
,
283 unsigned int nb_element
);
286 * Write an element of type unsigned int.
288 * writer An instance of a machine interface writer.
289 * element_name Element name.
290 * value Unsigned int value of the element
292 * Returns zero if the element's value could be written.
293 * Negative values indicate an error.
295 int mi_lttng_writer_write_element_unsigned_int(struct mi_writer
*writer
,
296 const char *element_name
, uint64_t value
);
299 * Write an element of type signed int.
301 * writer An instance of a machine interface writer.
302 * element_name Element name.
303 * value Signed int value of the element.
305 * Returns zero if the element's value could be written.
306 * Negative values indicate an error.
308 int mi_lttng_writer_write_element_signed_int(struct mi_writer
*writer
,
309 const char *element_name
, int64_t value
);
312 * Write an element of type boolean.
314 * writer An instance of a machine interface writer.
315 * element_name Element name.
316 * value Boolean value of the element.
318 * Returns zero if the element's value could be written.
319 * Negative values indicate an error.
321 int mi_lttng_writer_write_element_bool(struct mi_writer
*writer
,
322 const char *element_name
, int value
);
325 * Write an element of type string.
327 * writer An instance of a machine interface writer.
328 * element_name Element name.
329 * value String value of the element.
331 * Returns zero if the element's value could be written.
332 * Negative values indicate an error.
334 int mi_lttng_writer_write_element_string(struct mi_writer
*writer
,
335 const char *element_name
, const char *value
);
338 * Machine interface of struct version.
340 * writer An instance of a machine interface writer.
341 * version Version struct.
342 * lttng_description String value of the version description.
343 * lttng_license String value of the version license.
345 * Returns zero if the element's value could be written.
346 * Negative values indicate an error.
348 int mi_lttng_version(struct mi_writer
*writer
, struct mi_lttng_version
*version
,
349 const char *lttng_description
, const char *lttng_license
);
352 * Machine interface: open a sessions element.
354 * writer An instance of a machine interface writer.
356 * Returns zero if the element's value could be written.
357 * Negative values indicate an error.
359 int mi_lttng_sessions_open(struct mi_writer
*writer
);
362 * Machine interface of struct session.
364 * writer An instance of a machine interface writer.
365 * session An instance of a session.
366 * is_open Defines whether or not the session element shall be closed.
367 * This should be used carefully and the client
368 * must close the session element.
369 * Use case: nested additional information on a session
370 * ex: domain,channel event.
372 * Returns zero if the element's value could be written.
373 * Negative values indicate an error.
375 int mi_lttng_session(struct mi_writer
*writer
,
376 struct lttng_session
*session
, int is_open
);
379 * Machine interface: open a domains element.
381 * writer An instance of a machine interface writer.
383 * Returns zero if the element's value could be written.
384 * Negative values indicate an error.
386 int mi_lttng_domains_open(struct mi_writer
*writer
);
389 * Machine interface of struct domain.
391 * writer An instance of a machine interface writer.
392 * domain An instance of a domain.
394 * is_open Defines whether or not the session element shall be closed.
395 * This should be used carefully and the client
396 * must close the domain element.
397 * Use case: nested addition information on a domain
400 * Returns zero if the element's value could be written.
401 * Negative values indicate an error.
403 int mi_lttng_domain(struct mi_writer
*writer
,
404 struct lttng_domain
*domain
, int is_open
);
407 * Machine interface: open a channels element.
409 * writer An instance of a machine interface writer.
411 * Returns zero if the element's value could be written.
412 * Negative values indicate an error.
414 int mi_lttng_channels_open(struct mi_writer
*writer
);
417 * Machine interface of struct channel.
419 * writer An instance of a machine interface writer.
420 * channel An instance of a channel.
422 * is_open Defines whether or not the session element shall be closed.
423 * This should be used carefully and the client
424 * must close the channel element.
425 * Use case: nested addition information on a channel.
428 * Returns zero if the element's value could be written.
429 * Negative values indicate an error.
431 int mi_lttng_channel(struct mi_writer
*writer
,
432 struct lttng_channel
*channel
, int is_open
);
435 * Machine interface of struct channel_attr.
437 * writer An instance of a machine interface writer.
438 * attr An instance of a channel_attr struct.
440 * Returns zero if the element's value could be written.
441 * Negative values indicate an error.
443 int mi_lttng_channel_attr(struct mi_writer
*writer
,
444 struct lttng_channel_attr
*attr
);
447 * Machine interface for event common attributes.
449 * writer An instance of a mi writer.
450 * event single trace event.
452 * The common attribute are:
459 * Returns zero if the element's value could be written.
460 * Negative values indicate an error.
462 int mi_lttng_event_common_attributes(struct mi_writer
*writer
,
463 struct lttng_event
*event
);
466 * Machine interface for kernel tracepoint event with a loglevel.
468 * writer An instance of a mi writer.
469 * event single trace event.
470 * domain Event's domain
472 * Returns zero if the element's value could be written.
473 * Negative values indicate an error.
475 int mi_lttng_event_tracepoint_loglevel(struct mi_writer
*writer
,
476 struct lttng_event
*event
, enum lttng_domain_type domain
);
479 * Machine interface for kernel tracepoint event with no loglevel.
481 * writer An instance of a mi writer.
482 * event single trace event.
484 * Returns zero if the element's value could be written.
485 * Negative values indicate an error.
487 int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer
*writer
,
488 struct lttng_event
*event
);
491 * Machine interface for kernel function and probe event.
493 * writer An instance of a mi writer.
494 * event single trace event.
496 * Returns zero if the element's value could be written.
497 * Negative values indicate an error.
499 int mi_lttng_event_function_probe(struct mi_writer
*writer
,
500 struct lttng_event
*event
);
503 * Machine interface for kernel function entry event.
505 * writer An instance of a mi writer.
506 * event single trace event.
508 * Returns zero if the element's value could be written.
509 * Negative values indicate an error.
511 int mi_lttng_event_function_entry(struct mi_writer
*writer
,
512 struct lttng_event
*event
);
515 * Machine interface: open an events element.
517 * writer An instance of a machine interface writer.
519 * Returns zero if the element's value could be written.
520 * Negative values indicate an error.
522 int mi_lttng_events_open(struct mi_writer
*writer
);
525 * Machine interface for printing an event.
526 * The trace event type currently supported are:
533 * writer An instance of a mi writer.
534 * event single trace event.
535 * is_open Defines whether or not the session element shall be closed.
536 * This should be used carefully and the client
537 * must close the event element.
538 * Use case: nested additional information
539 * domain Event's domain
541 * Returns zero if the element's value could be written.
542 * Negative values indicate an error.
544 int mi_lttng_event(struct mi_writer
*writer
, struct lttng_event
*event
,
545 int is_open
, enum lttng_domain_type domain
);
548 * Machine interface for struct lttng_event_field.
550 * writer An instance of a mi writer.
551 * field An event_field instance.
553 * Returns zero if the element's value could be written.
554 * Negative values indicate an error.
556 int mi_lttng_event_field(struct mi_writer
*writer
,
557 struct lttng_event_field
*field
);
560 * Machine interface: open a event_fields element.
562 * writer An instance of a machine interface writer.
564 * Returns zero if the element have be written.
565 * Negative values indicate an error.
567 int mi_lttng_event_fields_open(struct mi_writer
*writer
);
570 * Machine interface: open a trackers element.
572 * writer An instance of a machine interface writer.
574 * Returns zero if the element's value could be written.
575 * Negative values indicate an error.
577 int mi_lttng_trackers_open(struct mi_writer
*writer
);
580 * Machine interface: open a pid_tracker element.
582 * writer An instance of a machine interface writer.
584 * Returns zero if the element's value could be written.
585 * Negative values indicate an error.
587 * Note: A targets element is also opened for each tracker definition
589 int mi_lttng_pid_tracker_open(struct mi_writer
*writer
);
592 * Machine interface: open a PIDs element.
594 * writer An instance of a machine interface writer.
596 * Returns zero if the element's value could be written.
597 * Negative values indicate an error.
599 int mi_lttng_pids_open(struct mi_writer
*writer
);
602 * Machine interface: open a processes element.
604 * writer An instance of a machine interface writer.
606 * Returns zero if the element's value could be written.
607 * Negative values indicate an error.
609 int mi_lttng_processes_open(struct mi_writer
*writer
);
612 * Machine interface of a Process.
614 * writer An instance of a machine interface writer.
617 * is_open Defines whether or not the session element shall be closed.
618 * This should be used carefully and the client
619 * must close the pid element.
620 * Use case: nested addition information on a domain
623 * Returns zero if the element's value could be written.
624 * Negative values indicate an error.
626 int mi_lttng_process(struct mi_writer
*writer
, pid_t pid
, const char *name
,
630 * TODO: move pid of lttng list -u to process semantic on mi api bump
631 * Machine interface of a Process.
633 * writer An instance of a machine interface writer.
636 * is_open Defines whether or not the session element shall be closed.
637 * This should be used carefully and the client
638 * must close the pid element.
639 * Use case: nested addition information on a domain
642 * Returns zero if the element's value could be written.
643 * Negative values indicate an error.
645 int mi_lttng_pid(struct mi_writer
*writer
, pid_t pid
, const char *name
,
648 * Machine interface: open a targets element.
650 * writer An instance of a machine interface writer.
652 * Returns zero if the element's value could be written.
653 * Negative values indicate an error.
655 int mi_lttng_targets_open(struct mi_writer
*writer
);
658 * Machine interface for track/untrack a pid_target
660 * writer An instance of a machine interface writer.
662 * Returns zero if the element's value could be written.
663 * Negative values indicate an error.
665 int mi_lttng_pid_target(struct mi_writer
*writer
, pid_t pid
, int is_open
);
668 * Machine interface of a context.
670 * writer An instance of a machine interface writer
672 * context An instance of a lttng_event_context
674 * is_open Define if we close the context element
675 * This should be used carefully and the client
676 * need to close the context element.
677 * Returns zero if the element's value could be written.
678 * Negative values indicate an error.
680 int mi_lttng_context(struct mi_writer
*writer
,
681 struct lttng_event_context
*context
, int is_open
);
684 * Machine interface of a perf_counter_context.
686 * writer An instance of a machine interface writer
688 * contest An instance of a lttng_event_perf_counter_ctx
690 * Returns zero if the element's value could be written.
691 * Negative values indicate an error.
693 int mi_lttng_perf_counter_context(struct mi_writer
*writer
,
694 struct lttng_event_perf_counter_ctx
*perf_context
);
697 * Machine interface of the snapshot list_output.
698 * It specifies the session for which we are listing snapshots,
699 * and it opens a snapshots element to list a sequence
702 * writer An instance of a machine interface writer.
704 * session_name: Snapshot output for session "session_name".
706 * Note: The client has to close the session and the snapshots elements after
707 * having listed every lttng_snapshot_output.
709 * Returns zero if the element's value could be written.
710 * Negative values indicate an error.
712 int mi_lttng_snapshot_output_session_name(struct mi_writer
*writer
,
713 const char *session_name
);
716 * Machine interface of the snapshot output.
717 * The machine interface serializes the following attributes:
718 * - id: ID of the snapshot output.
719 * - name: Name of the output.
720 * - data_url : Destination of the output.
721 * - ctrl_url: Destination of the output.
722 * - max_size: total size of all stream combined.
724 * writer An instance of a machine interface writer.
726 * output: A list of snapshot_output.
728 * Returns zero if the element's value could be written.
729 * Negative values indicate an error.
731 int mi_lttng_snapshot_list_output(struct mi_writer
*writer
,
732 struct lttng_snapshot_output
*output
);
735 * Machine interface of the output of the command snapshot del output
736 * when deleting a snapshot either by id or by name.
737 * If the snapshot was found and successfully deleted using its id,
738 * it return the id of the snapshot and the current session name on which it
741 * Otherwise, it do the same process with the name of the snapshot, if the
742 * snapshot output id is undefined.
744 * writer An instance of a machine interface writer.
746 * id: ID of the snapshot output.
748 * name: Name of the snapshot.
750 * current_session_name: Session to which the snapshot belongs.
752 * Returns zero if the element's value could be written.
753 * Negative values indicate an error.
755 int mi_lttng_snapshot_del_output(struct mi_writer
*writer
, int id
,
756 const char *name
, const char *current_session_name
);
759 * Machine interface of the output of the command snapshot add output
760 * when adding a snapshot from a user URL.
762 * If the snapshot was successfully added, the machine interface lists
764 * - id: ID of the newly add snapshot output.
765 * - current_session_name: Name of the session to which the output was added.
766 * - ctrl_url: Destination of the output.
767 * - max_size: total size of all stream combined.
769 * writer An instance of a machine interface writer.
771 * current_session_name: Session to which the snapshot belongs.
775 * output: iterator over a lttng_snapshot_output_list which contain
776 * the snapshot output informations.
778 * Returns zero if the element's value could be written.
779 * Negative values indicate an error.
781 int mi_lttng_snapshot_add_output(struct mi_writer
*writer
,
782 const char *current_session_name
, const char *n_ptr
,
783 struct lttng_snapshot_output
*output
);
786 * Machine interface of the output of the command snapshot
787 * record from a URL (if given).
789 * If the snapshot is successfully recorded from a url, the machine interface
790 * output the following information:
791 * - url: Destination of the output stored in the snapshot.
793 * Otherwise, the machine interface output the data and ctrl url received
794 * from the command-line.
796 * writer An instance of a machine interface writer.
798 * current_session_name: Snapshot record for session "current_session_name".
800 * ctrl_url, data_url: Destination of the output receive from the command-line.
802 * Returns zero if the element's value could be written.
803 * Negative values indicate an error.
805 int mi_lttng_snapshot_record(struct mi_writer
*writer
,
806 const char *current_session_name
, const char *url
,
807 const char *cmdline_ctrl_url
, const char *cmdline_data_url
);
809 #endif /* _MI_LTTNG_H */