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