Fix: sessiond: unchecked return value
[lttng-tools.git] / include / lttng / channel.h
CommitLineData
1239a312 1/*
ab5be9fa 2 * Copyright (C) 2014 David Goulet <dgoulet@efficios.com>
1239a312 3 *
ab5be9fa 4 * SPDX-License-Identifier: LGPL-2.1-only
1239a312 5 *
1239a312
DG
6 */
7
8#ifndef LTTNG_CHANNEL_H
9#define LTTNG_CHANNEL_H
10
11#include <lttng/domain.h>
12#include <lttng/event.h>
5ba3702f 13#include <stdint.h>
1239a312
DG
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/*
20 * Tracer channel attributes. For both kernel and user-space.
21 *
22 * The structures should be initialized to zero before use.
23 */
24#define LTTNG_CHANNEL_ATTR_PADDING1 LTTNG_SYMBOL_NAME_LEN + 12
25struct lttng_channel_attr {
8d5841ea 26 int overwrite; /* -1: session default, 1: overwrite, 0: discard */
7daee932 27 uint64_t subbuf_size; /* bytes, power of 2 */
1239a312
DG
28 uint64_t num_subbuf; /* power of 2 */
29 unsigned int switch_timer_interval; /* usec */
30 unsigned int read_timer_interval; /* usec */
31 enum lttng_event_output output; /* splice, mmap */
32 /* LTTng 2.1 padding limit */
33 uint64_t tracefile_size; /* bytes */
34 uint64_t tracefile_count; /* number of tracefiles */
35 /* LTTng 2.3 padding limit */
36 unsigned int live_timer_interval; /* usec */
67487150
JG
37 /* LTTng 2.7 padding limit */
38 uint32_t align_to_64;
39 union {
40 uint64_t padding;
41 void *ptr;
42 } extended;
1239a312
DG
43
44 char padding[LTTNG_CHANNEL_ATTR_PADDING1];
45};
46
47/*
48 * Channel information structure. For both kernel and user-space.
49 *
50 * The structures should be initialized to zero before use.
51 */
52#define LTTNG_CHANNEL_PADDING1 16
53struct lttng_channel {
54 char name[LTTNG_SYMBOL_NAME_LEN];
55 uint32_t enabled;
56 struct lttng_channel_attr attr;
57
58 char padding[LTTNG_CHANNEL_PADDING1];
59};
60
cf0bcb51
JG
61/*
62 */
63extern struct lttng_channel *lttng_channel_create(struct lttng_domain *domain);
64
65/*
66 */
67extern void lttng_channel_destroy(struct lttng_channel *channel);
68
1239a312
DG
69/*
70 * List the channel(s) of a session.
71 *
72 * The handle CAN NOT be NULL.
73 *
74 * Return the size (number of entries) of the "lttng_channel" array. Caller
75 * must free channels. On error, a negative LTTng error code is returned.
76 */
77extern int lttng_list_channels(struct lttng_handle *handle,
78 struct lttng_channel **channels);
79
80/*
81 * Create or enable a channel.
82 *
83 * The chan and handle params can not be NULL.
84 *
85 * Return 0 on success else a negative LTTng error code.
86 */
87extern int lttng_enable_channel(struct lttng_handle *handle,
88 struct lttng_channel *chan);
89
90/*
91 * Disable channel.
92 *
93 * Name and handle CAN NOT be NULL.
94 *
95 * Return 0 on success else a negative LTTng error code.
96 */
97extern int lttng_disable_channel(struct lttng_handle *handle,
98 const char *name);
99
100/*
101 * Set the default channel attributes for a specific domain and an allocated
102 * lttng_channel_attr pointer.
103 *
104 * If one or both arguments are NULL, nothing happens.
105 */
106extern void lttng_channel_set_default_attr(struct lttng_domain *domain,
107 struct lttng_channel_attr *attr);
108
5ba3702f
JG
109/*
110 * Get the discarded event count of a specific LTTng channel.
111 *
112 * Returns 0 on success, or a negative LTTng error code on error.
113 */
114extern int lttng_channel_get_discarded_event_count(struct lttng_channel *chan,
115 uint64_t *discarded_events);
116
117/*
118 * Get the lost packet count of a specific LTTng channel.
119 *
120 * Returns 0 on success, or a negative LTTng error code on error.
121 */
122extern int lttng_channel_get_lost_packet_count(struct lttng_channel *chan,
123 uint64_t *lost_packets);
124
cf0bcb51
JG
125extern int lttng_channel_get_monitor_timer_interval(struct lttng_channel *chan,
126 uint64_t *monitor_timer_interval);
127
128extern int lttng_channel_set_monitor_timer_interval(struct lttng_channel *chan,
129 uint64_t monitor_timer_interval);
130
491d1539
MD
131extern int lttng_channel_get_blocking_timeout(struct lttng_channel *chan,
132 int64_t *blocking_timeout);
133
134extern int lttng_channel_set_blocking_timeout(struct lttng_channel *chan,
135 int64_t blocking_timeout);
136
1239a312
DG
137#ifdef __cplusplus
138}
139#endif
140
141#endif /* LTTNG_CHANNEL_H */
This page took 0.052486 seconds and 5 git commands to generate.