Fix: Memory leak on error in alloc_argv_from_user_opts()
[lttng-tools.git] / src / common / mi-lttng.h
CommitLineData
c7e35b03
JR
1/*
2 * Copyright (C) 2014 - Jonathan Rajotte <jonathan.r.julien@gmail.com>
3 * - Olivier Cotte <olivier.cotte@polymtl.ca>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License, version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 51
16 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#ifndef _MI_LTTNG_H
20#define _MI_LTTNG_H
21
22#include <stdint.h>
23
24#include <common/error.h>
25#include <common/macros.h>
26#include <common/config/config.h>
27#include <lttng/lttng.h>
28
50534d6f
JRJ
29/* Don't want to reference snapshot-internal.h here */
30struct lttng_snapshot_output;
31
c7e35b03
JR
32/* Instance of a machine interface writer. */
33struct mi_writer {
34 struct config_writer *writer;
35 enum lttng_mi_output_type type;
36};
37
38/*
39 * Version information for the machine interface.
40 */
41struct mi_lttng_version {
42 char version[NAME_MAX]; /* Version number of package */
43 uint32_t version_major; /* LTTng-Tools major version number */
44 uint32_t version_minor; /* LTTng-Tools minor version number */
45 uint32_t version_patchlevel; /* LTTng-Tools patchlevel version number */
314d5222 46 char version_commit[NAME_MAX]; /* Commit hash of the current version */
c7e35b03
JR
47 char version_name[NAME_MAX];
48 char package_url[NAME_MAX]; /* Define to the home page for this package. */
49};
50
51/* Strings related to command */
52const char * const mi_lttng_element_command;
50534d6f 53const char * const mi_lttng_element_command_action;
f4a088f7
JRJ
54const char * const mi_lttng_element_command_add_context;
55const char * const mi_lttng_element_command_calibrate;
37d03ff7 56const char * const mi_lttng_element_command_create;
65f25c66 57const char * const mi_lttng_element_command_destroy;
f4a088f7
JRJ
58const char * const mi_lttng_element_command_disable_channel;
59const char * const mi_lttng_element_command_disable_event;
acc09215 60const char * const mi_lttng_element_command_enable_channels;
f4a088f7
JRJ
61const char * const mi_lttng_element_command_enable_event;
62const char * const mi_lttng_element_command_list;
63const char * const mi_lttng_element_command_load;
64const char * const mi_lttng_element_command_name;
65const char * const mi_lttng_element_command_output;
66const char * const mi_lttng_element_command_save;
ce91cd0b 67const char * const mi_lttng_element_command_set_session;
50534d6f 68const char * const mi_lttng_element_command_snapshot;
f4a088f7
JRJ
69const char * const mi_lttng_element_command_snapshot_add;
70const char * const mi_lttng_element_command_snapshot_del;
71const char * const mi_lttng_element_command_snapshot_list;
72const char * const mi_lttng_element_command_snapshot_record;
73const char * const mi_lttng_element_command_start;
74const char * const mi_lttng_element_command_stop;
1734c658 75const char * const mi_lttng_element_command_success;
f4a088f7 76const char * const mi_lttng_element_command_version;
c7e35b03 77
1734c658 78/* Strings related to version command */
c7e35b03 79const char * const mi_lttng_element_version;
f4a088f7
JRJ
80const char * const mi_lttng_element_version_commit;
81const char * const mi_lttng_element_version_description;
82const char * const mi_lttng_element_version_license;
c7e35b03
JR
83const char * const mi_lttng_element_version_major;
84const char * const mi_lttng_element_version_minor;
c7e35b03 85const char * const mi_lttng_element_version_patch_level;
f4a088f7
JRJ
86const char * const mi_lttng_element_version_str;
87const char * const mi_lttng_element_version_web;
c7e35b03 88
5e18ec73
JR
89/* String related to a lttng_event_field */
90const char * const mi_lttng_element_event_field;
91const char * const mi_lttng_element_event_fields;
92
89b72577
JRJ
93/* String related to lttng_event_context */
94const char * const mi_lttng_context_type_perf_counter;
95const char * const mi_lttng_context_type_perf_cpu_counter;
96const char * const mi_lttng_context_type_perf_thread_counter;
97
98/* String related to lttng_event_perf_counter_ctx */
99const char * const mi_lttng_element_perf_counter_context;
100
5e18ec73
JR
101/* Strings related to pid */
102const char * const mi_lttng_element_pids;
103const char * const mi_lttng_element_pid;
104const char * const mi_lttng_element_pid_id;
105
1734c658
JRJ
106/* Strings related to save command */
107const char * const mi_lttng_element_save;
108
109/* Strings related to load command */
110const char * const mi_lttng_element_load;
111
5e18ec73 112/* General element of mi_lttng */
f4a088f7
JRJ
113const char * const mi_lttng_element_empty;
114const char * const mi_lttng_element_id;
115const char * const mi_lttng_element_nowrite;
116const char * const mi_lttng_element_success;
5e18ec73
JR
117const char * const mi_lttng_element_type_enum;
118const char * const mi_lttng_element_type_float;
f4a088f7
JRJ
119const char * const mi_lttng_element_type_integer;
120const char * const mi_lttng_element_type_other;
5e18ec73 121const char * const mi_lttng_element_type_string;
5e18ec73
JR
122
123/* String related to loglevel */
124const char * const mi_lttng_loglevel_str_alert;
125const char * const mi_lttng_loglevel_str_crit;
126const char * const mi_lttng_loglevel_str_debug;
127const char * const mi_lttng_loglevel_str_debug_function;
128const char * const mi_lttng_loglevel_str_debug_line;
129const char * const mi_lttng_loglevel_str_debug_module;
130const char * const mi_lttng_loglevel_str_debug_process;
131const char * const mi_lttng_loglevel_str_debug_program;
132const char * const mi_lttng_loglevel_str_debug_system;
133const char * const mi_lttng_loglevel_str_debug_unit;
134const char * const mi_lttng_loglevel_str_emerg;
135const char * const mi_lttng_loglevel_str_err;
136const char * const mi_lttng_loglevel_str_info;
137const char * const mi_lttng_loglevel_str_notice;
138const char * const mi_lttng_loglevel_str_unknown;
139const char * const mi_lttng_loglevel_str_warning;
140
136f2f81
JRJ
141/* String related to loglevel JUL */
142const char * const mi_lttng_loglevel_str_jul_all;
143const char * const mi_lttng_loglevel_str_jul_config;
144const char * const mi_lttng_loglevel_str_jul_fine;
145const char * const mi_lttng_loglevel_str_jul_finer;
146const char * const mi_lttng_loglevel_str_jul_finest;
147const char * const mi_lttng_loglevel_str_jul_info;
148const char * const mi_lttng_loglevel_str_jul_off;
149const char * const mi_lttng_loglevel_str_jul_severe;
150const char * const mi_lttng_loglevel_str_jul_warning;
151
970d848b
DG
152/* String related to loglevel Log4j */
153const char * const mi_lttng_loglevel_str_log4j_off;
154const char * const mi_lttng_loglevel_str_log4j_fatal;
155const char * const mi_lttng_loglevel_str_log4j_error;
156const char * const mi_lttng_loglevel_str_log4j_warn;
157const char * const mi_lttng_loglevel_str_log4j_info;
158const char * const mi_lttng_loglevel_str_log4j_debug;
159const char * const mi_lttng_loglevel_str_log4j_trace;
160const char * const mi_lttng_loglevel_str_log4j_all;
161
0e115563
DG
162/* String related to loglevel Python */
163const char * const mi_lttng_loglevel_str_python_critical;
164const char * const mi_lttng_loglevel_str_python_error;
165const char * const mi_lttng_loglevel_str_python_warning;
166const char * const mi_lttng_loglevel_str_python_info;
167const char * const mi_lttng_loglevel_str_python_debug;
168const char * const mi_lttng_loglevel_str_python_notset;
169
1734c658 170/* String related to loglevel type */
5e18ec73
JR
171const char * const mi_lttng_loglevel_type_all;
172const char * const mi_lttng_loglevel_type_range;
173const char * const mi_lttng_loglevel_type_single;
174const char * const mi_lttng_loglevel_type_unknown;
175
7e66b1b0
JRJ
176/* Sting related to lttng_calibrate */
177const char * const mi_lttng_element_calibrate;
178const char * const mi_lttng_element_calibrate_function;
179
136f2f81 180/* String related to a lttng_snapshot */
50534d6f 181const char * const mi_lttng_element_snapshot_ctrl_url;
f4a088f7 182const char * const mi_lttng_element_snapshot_data_url;
50534d6f 183const char * const mi_lttng_element_snapshot_max_size;
f4a088f7
JRJ
184const char * const mi_lttng_element_snapshot_n_ptr;
185const char * const mi_lttng_element_snapshot_session_name;
186const char * const mi_lttng_element_snapshots;
50534d6f 187
5e18ec73 188/* Utility string function */
970d848b 189const char *mi_lttng_loglevel_string(int value, enum lttng_domain_type domain);
5e18ec73
JR
190const char *mi_lttng_logleveltype_string(enum lttng_loglevel_type value);
191const char *mi_lttng_eventfieldtype_string(enum lttng_event_field_type value);
192const char *mi_lttng_domaintype_string(enum lttng_domain_type value);
193const char *mi_lttng_buffertype_string(enum lttng_buffer_type value);
7e66b1b0 194const char *mi_lttng_calibratetype_string(enum lttng_calibrate_type val);
5e18ec73 195
c7e35b03
JR
196/*
197 * Create an instance of a machine interface writer.
198 *
199 * fd_output File to which the XML content must be written. The file will be
200 * closed once the mi_writer has been destroyed.
201 *
202 * Returns an instance of a machine interface writer on success, NULL on
203 * error.
204 */
205struct mi_writer *mi_lttng_writer_create(int fd_output, int mi_output_type);
206
207/*
208 * Destroy an instance of a machine interface writer.
209 *
210 * writer An instance of a machine interface writer.
211 *
212 * Returns zero if the XML document could be closed cleanly. Negative values
213 * indicate an error.
214 */
215int mi_lttng_writer_destroy(struct mi_writer *writer);
216
217/*
218 * Open a command tag and add it's name node.
219 *
220 * writer An instance of a machine interface writer.
c7e35b03
JR
221 * command The command name.
222 *
223 * Returns zero if the XML document could be closed cleanly.
224 * Negative values indicate an error.
225 */
226int mi_lttng_writer_command_open(struct mi_writer *writer, const char *command);
227
228/*
229 * Close a command tag.
230 *
231 * writer An instance of a machine interface writer.
232 *
233 * Returns zero if the XML document could be closed cleanly.
234 * Negative values indicate an error.
235 */
236int mi_lttng_writer_command_close(struct mi_writer *writer);
237
238/*
239 * Open an element tag.
240 *
241 * writer An instance of a machine interface writer.
c7e35b03
JR
242 * element_name Element tag name.
243 *
244 * Returns zero if the XML document could be closed cleanly.
245 * Negative values indicate an error.
246 */
247int mi_lttng_writer_open_element(struct mi_writer *writer,
248 const char *element_name);
249
250/*
251 * Close the current element tag.
252 *
253 * writer An instance of a machine interface writer.
254 *
255 * Returns zero if the XML document could be closed cleanly.
256 * Negative values indicate an error.
257 */
258int mi_lttng_writer_close_element(struct mi_writer *writer);
259
260/*
5e18ec73 261 * Close multiple element.
c7e35b03
JR
262 *
263 * writer An instance of a machine interface writer.
5e18ec73 264 * nb_element Number of elements.
c7e35b03 265 *
5e18ec73
JR
266 * Returns zero if the XML document could be closed cleanly.
267 * Negative values indicate an error.
268 */
269int mi_lttng_close_multi_element(struct mi_writer *writer,
270 unsigned int nb_element);
271
272/*
273 * Write an element of type unsigned int.
c7e35b03 274 *
5e18ec73
JR
275 * writer An instance of a machine interface writer.
276 * element_name Element name.
c7e35b03
JR
277 * value Unsigned int value of the element
278 *
279 * Returns zero if the element's value could be written.
280 * Negative values indicate an error.
281 */
282int mi_lttng_writer_write_element_unsigned_int(struct mi_writer *writer,
283 const char *element_name, uint64_t value);
284
285/*
286 * Write an element of type signed int.
287 *
288 * writer An instance of a machine interface writer.
c7e35b03 289 * element_name Element name.
5e18ec73 290 * value Signed int value of the element.
c7e35b03
JR
291 *
292 * Returns zero if the element's value could be written.
293 * Negative values indicate an error.
294 */
295int mi_lttng_writer_write_element_signed_int(struct mi_writer *writer,
296 const char *element_name, int64_t value);
297
298/*
299 * Write an element of type boolean.
300 *
301 * writer An instance of a machine interface writer.
c7e35b03 302 * element_name Element name.
5e18ec73 303 * value Boolean value of the element.
c7e35b03
JR
304 *
305 * Returns zero if the element's value could be written.
306 * Negative values indicate an error.
307 */
308int mi_lttng_writer_write_element_bool(struct mi_writer *writer,
309 const char *element_name, int value);
310
311/*
312 * Write an element of type string.
313 *
314 * writer An instance of a machine interface writer.
c7e35b03 315 * element_name Element name.
5e18ec73 316 * value String value of the element.
c7e35b03
JR
317 *
318 * Returns zero if the element's value could be written.
319 * Negative values indicate an error.
320 */
321int mi_lttng_writer_write_element_string(struct mi_writer *writer,
322 const char *element_name, const char *value);
323
324/*
325 * Machine interface of struct version.
326 *
327 * writer An instance of a machine interface writer.
c7e35b03 328 * version Version struct.
c7e35b03 329 * lttng_description String value of the version description.
c7e35b03
JR
330 * lttng_license String value of the version license.
331 *
332 * Returns zero if the element's value could be written.
333 * Negative values indicate an error.
334 */
335int mi_lttng_version(struct mi_writer *writer, struct mi_lttng_version *version,
336 const char *lttng_description, const char *lttng_license);
337
338/*
5e18ec73 339 * Machine interface: open a sessions element.
c7e35b03 340 *
5e18ec73 341 * writer An instance of a machine interface writer.
c7e35b03 342 *
5e18ec73
JR
343 * Returns zero if the element's value could be written.
344 * Negative values indicate an error.
345 */
346int mi_lttng_sessions_open(struct mi_writer *writer);
347
348/*
349 * Machine interface of struct session.
c7e35b03 350 *
5e18ec73
JR
351 * writer An instance of a machine interface writer.
352 * session An instance of a session.
353 * is_open Defines whether or not the session element shall be closed.
354 * This should be used carefully and the client
355 * must close the session element.
136f2f81 356 * Use case: nested additional information on a session
c7e35b03 357 * ex: domain,channel event.
c7e35b03
JR
358 *
359 * Returns zero if the element's value could be written.
360 * Negative values indicate an error.
361 */
362int mi_lttng_session(struct mi_writer *writer,
5e18ec73
JR
363 struct lttng_session *session, int is_open);
364
365/*
366 * Machine interface: open a domains element.
367 *
368 * writer An instance of a machine interface writer.
369 *
370 * Returns zero if the element's value could be written.
371 * Negative values indicate an error.
372 */
373int mi_lttng_domains_open(struct mi_writer *writer);
374
375/*
376 * Machine interface of struct domain.
377 *
378 * writer An instance of a machine interface writer.
379 * domain An instance of a domain.
380 *
381 * is_open Defines whether or not the session element shall be closed.
382 * This should be used carefully and the client
383 * must close the domain element.
384 * Use case: nested addition information on a domain
385 * ex: channel event.
386 *
387 * Returns zero if the element's value could be written.
388 * Negative values indicate an error.
389 */
390int mi_lttng_domain(struct mi_writer *writer,
391 struct lttng_domain *domain, int is_open);
392
393/*
394 * Machine interface: open a channels element.
395 *
396 * writer An instance of a machine interface writer.
397 *
398 * Returns zero if the element's value could be written.
399 * Negative values indicate an error.
400 */
401int mi_lttng_channels_open(struct mi_writer *writer);
402
403/*
404 * Machine interface of struct channel.
405 *
406 * writer An instance of a machine interface writer.
407 * channel An instance of a channel.
408 *
409 * is_open Defines whether or not the session element shall be closed.
410 * This should be used carefully and the client
411 * must close the channel element.
412 * Use case: nested addition information on a channel.
413 * ex: channel event.
414 *
415 * Returns zero if the element's value could be written.
416 * Negative values indicate an error.
417 */
418int mi_lttng_channel(struct mi_writer *writer,
419 struct lttng_channel *channel, int is_open);
420
421/*
422 * Machine interface of struct channel_attr.
423 *
424 * writer An instance of a machine interface writer.
425 * attr An instance of a channel_attr struct.
426 *
427 * Returns zero if the element's value could be written.
428 * Negative values indicate an error.
429 */
430int mi_lttng_channel_attr(struct mi_writer *writer,
431 struct lttng_channel_attr *attr);
432
433/*
434* Machine interface for event common attributes.
435*
436* writer An instance of a mi writer.
437* event single trace event.
438*
439* The common attribute are:
440* - mi event element
441* - event name
442* - event type
443* - enabled tag
444* - event filter
445*
446* Returns zero if the element's value could be written.
447* Negative values indicate an error.
448*/
449int mi_lttng_event_common_attributes(struct mi_writer *writer,
450 struct lttng_event *event);
451
452/*
453 * Machine interface for kernel tracepoint event with a loglevel.
454 *
455 * writer An instance of a mi writer.
456 * event single trace event.
970d848b 457 * domain Event's domain
5e18ec73
JR
458 *
459 * Returns zero if the element's value could be written.
460 * Negative values indicate an error.
461 */
462int mi_lttng_event_tracepoint_loglevel(struct mi_writer *writer,
970d848b 463 struct lttng_event *event, enum lttng_domain_type domain);
5e18ec73
JR
464
465/*
466 * Machine interface for kernel tracepoint event with no loglevel.
467 *
468 * writer An instance of a mi writer.
469 * event single trace event.
470 *
471 * Returns zero if the element's value could be written.
472 * Negative values indicate an error.
473 */
474int mi_lttng_event_tracepoint_no_loglevel(struct mi_writer *writer,
475 struct lttng_event *event);
476
477/*
478 * Machine interface for kernel function and probe event.
479 *
480 * writer An instance of a mi writer.
481 * event single trace event.
482 *
483 * Returns zero if the element's value could be written.
484 * Negative values indicate an error.
485 */
486int mi_lttng_event_function_probe(struct mi_writer *writer,
487 struct lttng_event *event);
488
489/*
490 * Machine interface for kernel function entry event.
491 *
492 * writer An instance of a mi writer.
493 * event single trace event.
494 *
495 * Returns zero if the element's value could be written.
496 * Negative values indicate an error.
497 */
498int mi_lttng_event_function_entry(struct mi_writer *writer,
499 struct lttng_event *event);
500
501/*
502 * Machine interface: open an events element.
503 *
504 * writer An instance of a machine interface writer.
505 *
506 * Returns zero if the element's value could be written.
507 * Negative values indicate an error.
508 */
509int mi_lttng_events_open(struct mi_writer *writer);
510
511/*
512 * Machine interface for printing an event.
513 * The trace event type currently supported are:
514 * TRACEPOINT,
515 * PROBE,
516 * FUNCTION,
517 * FUNCTION_ENTRY,
518 * SYSCALL
519 *
520 * writer An instance of a mi writer.
521 * event single trace event.
522 * is_open Defines whether or not the session element shall be closed.
523 * This should be used carefully and the client
524 * must close the event element.
525 * Use case: nested additional information
970d848b 526 * domain Event's domain
5e18ec73
JR
527 *
528 * Returns zero if the element's value could be written.
529 * Negative values indicate an error.
530 */
531int mi_lttng_event(struct mi_writer *writer, struct lttng_event *event,
970d848b 532 int is_open, enum lttng_domain_type domain);
5e18ec73
JR
533
534/*
535 * Machine interface for struct lttng_event_field.
536 *
537 * writer An instance of a mi writer.
538 * field An event_field instance.
539 *
540 * Returns zero if the element's value could be written.
541 * Negative values indicate an error.
542 */
543int mi_lttng_event_field(struct mi_writer *writer,
544 struct lttng_event_field *field);
545
546/*
547 * Machine interface: open a event_fields element.
548 *
549 * writer An instance of a machine interface writer.
550 *
e4d484a5 551 * Returns zero if the element have be written.
5e18ec73
JR
552 * Negative values indicate an error.
553 */
554int mi_lttng_event_fields_open(struct mi_writer *writer);
555
556/*
557 * Machine interface: open a PIDs element.
558 *
559 * writer An instance of a machine interface writer.
560 *
561 * Returns zero if the element's value could be written.
562 * Negative values indicate an error.
563 */
564int mi_lttng_pids_open(struct mi_writer *writer);
565
566/*
567 * Machine interface of a PID.
568 *
569 * writer An instance of a machine interface writer.
570 * pid A PID.
571 *
572 * is_open Defines whether or not the session element shall be closed.
573 * This should be used carefully and the client
574 * must close the pid element.
575 * Use case: nested addition information on a domain
576 * ex: channel event.
577 *
578 * Returns zero if the element's value could be written.
579 * Negative values indicate an error.
580 */
581int mi_lttng_pid(struct mi_writer *writer, pid_t pid , const char *cmdline,
582 int is_open);
c7e35b03 583
7e66b1b0
JRJ
584/*
585 * Machine interface for struct lttng_calibrate.
586 *
587 * writer An instance of a machine interface writer.
588 *
589 * calibrate A lttng_calibrate instance.
590 *
591 * Returns zero if the element's value could be written.
592 * Negative values indicate an error.
593 */
594int mi_lttng_calibrate(struct mi_writer *writer,
595 struct lttng_calibrate *calibrate);
596
89b72577
JRJ
597/*
598 * Machine interface of a context.
599 *
600 * writer An instance of a machine interface writer
601 *
602 * context An instance of a lttng_event_context
603 *
604 * is_open Define if we close the context element
605 * This should be used carefully and the client
606 * need to close the context element.
89b72577
JRJ
607 * Returns zero if the element's value could be written.
608 * Negative values indicate an error.
609 */
610int mi_lttng_context(struct mi_writer *writer,
611 struct lttng_event_context *context, int is_open);
612
613/*
614 * Machine interface of a perf_counter_context.
615 *
616 * writer An instance of a machine interface writer
617 *
618 * contest An instance of a lttng_event_perf_counter_ctx
619 *
620 * Returns zero if the element's value could be written.
621 * Negative values indicate an error.
622 */
623int mi_lttng_perf_counter_context(struct mi_writer *writer,
624 struct lttng_event_perf_counter_ctx *perf_context);
625
50534d6f
JRJ
626/*
627 * Machine interface of the snapshot list_output.
628 * It specifies the session for which we are listing snapshots,
629 * and it opens a snapshots element to list a sequence
630 * of snapshots.
631 *
632 * writer An instance of a machine interface writer.
633 *
634 * session_name: Snapshot output for session "session_name".
635 *
636 * Note: The client has to close the session and the snapshots elements after
637 * having listed every lttng_snapshot_output.
638 *
639 * Returns zero if the element's value could be written.
640 * Negative values indicate an error.
641 */
642int mi_lttng_snapshot_output_session_name(struct mi_writer *writer,
643 const char *session_name);
644
645/*
646 * Machine interface of the snapshot output.
647 * The machine interface serializes the following attributes:
648 * - id: ID of the snapshot output.
649 * - name: Name of the output.
650 * - data_url : Destination of the output.
651 * - ctrl_url: Destination of the output.
652 * - max_size: total size of all stream combined.
653 *
654 * writer An instance of a machine interface writer.
655 *
656 * output: A list of snapshot_output.
657 *
658 * Returns zero if the element's value could be written.
659 * Negative values indicate an error.
660 */
661int mi_lttng_snapshot_list_output(struct mi_writer *writer,
662 struct lttng_snapshot_output *output);
663
664/*
665 * Machine interface of the output of the command snapshot del output
666 * when deleting a snapshot either by id or by name.
667 * If the snapshot was found and successfully deleted using its id,
668 * it return the id of the snapshot and the current session name on which it
669 * was attached.
670 *
671 * Otherwise, it do the same process with the name of the snapshot, if the
672 * snapshot output id is undefined.
673 *
674 * writer An instance of a machine interface writer.
675 *
676 * id: ID of the snapshot output.
677 *
678 * name: Name of the snapshot.
679 *
680 * current_session_name: Session to which the snapshot belongs.
681 *
682 * Returns zero if the element's value could be written.
683 * Negative values indicate an error.
684 */
685int mi_lttng_snapshot_del_output(struct mi_writer *writer, int id,
686 const char *name, const char *current_session_name);
687
688/*
689 * Machine interface of the output of the command snapshot add output
690 * when adding a snapshot from a user URL.
691 *
692 * If the snapshot was successfully added, the machine interface lists
693 * these information:
694 * - id: ID of the newly add snapshot output.
695 * - current_session_name: Name of the session to which the output was added.
696 * - ctrl_url: Destination of the output.
697 * - max_size: total size of all stream combined.
698 *
699 * writer An instance of a machine interface writer.
700 *
701 * current_session_name: Session to which the snapshot belongs.
702 *
703 * n_ptr:
704 *
705 * output: iterator over a lttng_snapshot_output_list which contain
706 * the snapshot output informations.
707 *
708 * Returns zero if the element's value could be written.
709 * Negative values indicate an error.
710 */
711int mi_lttng_snapshot_add_output(struct mi_writer *writer,
712 const char *current_session_name, const char *n_ptr,
713 struct lttng_snapshot_output *output);
714
715/*
716 * Machine interface of the output of the command snapshot
717 * record from a URL (if given).
718 *
719 * If the snapshot is successfully recorded from a url, the machine interface
720 * output the following information:
721 * - url: Destination of the output stored in the snapshot.
722 *
723 * Otherwise, the machine interface output the data and ctrl url received
724 * from the command-line.
725 *
726 * writer An instance of a machine interface writer.
727 *
728 * current_session_name: Snapshot record for session "current_session_name".
729 *
730 * ctrl_url, data_url: Destination of the output receive from the command-line.
731 *
732 * Returns zero if the element's value could be written.
733 * Negative values indicate an error.
734 */
735int mi_lttng_snapshot_record(struct mi_writer *writer,
736 const char *current_session_name, const char *url,
737 const char *cmdline_ctrl_url, const char *cmdline_data_url);
738
c7e35b03 739#endif /* _MI_LTTNG_H */
This page took 0.0528 seconds and 4 git commands to generate.