Use system include paths in probes
[lttng-modules.git] / lttng-events.h
CommitLineData
a90917c3
MD
1#ifndef _LTTNG_EVENTS_H
2#define _LTTNG_EVENTS_H
11b5a3c2 3
4e3c1b9b 4/*
a90917c3 5 * lttng-events.h
4e3c1b9b 6 *
4e3c1b9b 7 * Holds LTTng per-session event registry.
17baffe2 8 *
886d51a3
MD
9 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; only
14 * version 2.1 of the License.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
4e3c1b9b
MD
24 */
25
3a523f5b 26#include <linux/version.h>
4e3c1b9b 27#include <linux/list.h>
d6d808f3 28#include <linux/kprobes.h>
d83004aa 29#include <linux/kref.h>
a864fb02 30#include "wrapper/uuid.h"
e8951e63 31#include "lttng-abi.h"
6dccd6c1 32#include "lttng-abi-old.h"
4e3c1b9b 33
06254b0f 34#define lttng_is_signed_type(type) (((type)(-1)) < 0)
9e7e4892 35
a90917c3
MD
36struct lttng_channel;
37struct lttng_session;
d83004aa 38struct lttng_metadata_cache;
1c25284c 39struct lib_ring_buffer_ctx;
ba1f5986 40struct perf_event;
833ad6a0 41struct perf_event_attr;
3b731ab1 42struct lib_ring_buffer_config;
4e3c1b9b 43
c0edae1d
MD
44/* Type description */
45
c0edae1d
MD
46enum abstract_types {
47 atype_integer,
48 atype_enum,
49 atype_array,
50 atype_sequence,
51 atype_string,
52 NR_ABSTRACT_TYPES,
53};
54
c0edae1d 55enum lttng_string_encodings {
e0a7a7c4
MD
56 lttng_encode_none = 0,
57 lttng_encode_UTF8 = 1,
58 lttng_encode_ASCII = 2,
c0edae1d
MD
59 NR_STRING_ENCODINGS,
60};
61
d83004aa
JD
62enum channel_type {
63 PER_CPU_CHANNEL,
64 METADATA_CHANNEL,
65};
66
c0edae1d
MD
67struct lttng_enum_entry {
68 unsigned long long start, end; /* start and end are inclusive */
69 const char *string;
70};
71
43803cf2
MD
72#define __type_integer(_type, _size, _alignment, _signedness, \
73 _byte_order, _base, _encoding) \
c099397a
MD
74 { \
75 .atype = atype_integer, \
76 .u.basic.integer = \
77 { \
43803cf2
MD
78 .size = (_size) ? : sizeof(_type) * CHAR_BIT, \
79 .alignment = (_alignment) ? : lttng_alignof(_type) * CHAR_BIT, \
80 .signedness = (_signedness) >= 0 ? (_signedness) : lttng_is_signed_type(_type), \
81 .reverse_byte_order = _byte_order != __BYTE_ORDER, \
e0a7a7c4 82 .base = _base, \
64c796d8 83 .encoding = lttng_encode_##_encoding, \
c099397a
MD
84 }, \
85 } \
86
87struct lttng_integer_type {
88 unsigned int size; /* in bits */
89 unsigned short alignment; /* in bits */
9cccf98a
MD
90 unsigned int signedness:1,
91 reverse_byte_order:1;
e0a7a7c4
MD
92 unsigned int base; /* 2, 8, 10, 16, for pretty print */
93 enum lttng_string_encodings encoding;
c099397a
MD
94};
95
96union _lttng_basic_type {
97 struct lttng_integer_type integer;
98 struct {
99 const char *name;
100 } enumeration;
101 struct {
102 enum lttng_string_encodings encoding;
103 } string;
104};
105
106struct lttng_basic_type {
107 enum abstract_types atype;
108 union {
109 union _lttng_basic_type basic;
110 } u;
c0edae1d
MD
111};
112
113struct lttng_type {
114 enum abstract_types atype;
c0edae1d 115 union {
c099397a 116 union _lttng_basic_type basic;
c0edae1d 117 struct {
c099397a 118 struct lttng_basic_type elem_type;
c0edae1d 119 unsigned int length; /* num. elems. */
43803cf2 120 unsigned int elem_alignment; /* alignment override */
c0edae1d
MD
121 } array;
122 struct {
c099397a
MD
123 struct lttng_basic_type length_type;
124 struct lttng_basic_type elem_type;
43803cf2 125 unsigned int elem_alignment; /* alignment override */
c0edae1d 126 } sequence;
c0edae1d 127 } u;
c099397a
MD
128};
129
130struct lttng_enum {
131 const char *name;
132 struct lttng_type container_type;
133 const struct lttng_enum_entry *entries;
134 unsigned int len;
135};
c0edae1d
MD
136
137/* Event field description */
138
139struct lttng_event_field {
140 const char *name;
f17701fb 141 struct lttng_type type;
f127e61e
MD
142 unsigned int nowrite:1, /* do not write into trace */
143 user:1; /* fetch from user-space */
c0edae1d
MD
144};
145
07dfc1d0
MD
146union lttng_ctx_value {
147 int64_t s64;
148 const char *str;
149 double d;
150};
151
2001023e
MD
152/*
153 * We need to keep this perf counter field separately from struct
154 * lttng_ctx_field because cpu hotplug needs fixed-location addresses.
155 */
156struct lttng_perf_counter_field {
157 struct notifier_block nb;
158 int hp_enable;
159 struct perf_event_attr *attr;
160 struct perf_event **e; /* per-cpu array */
161};
162
79150a49
JD
163struct lttng_probe_ctx {
164 struct lttng_event *event;
165 uint8_t interruptible;
166};
167
ba1f5986 168struct lttng_ctx_field {
8070f5c0 169 struct lttng_event_field event_field;
f1676205
MD
170 size_t (*get_size)(size_t offset);
171 void (*record)(struct lttng_ctx_field *field,
172 struct lib_ring_buffer_ctx *ctx,
a90917c3 173 struct lttng_channel *chan);
07dfc1d0 174 void (*get_value)(struct lttng_ctx_field *field,
79150a49 175 struct lttng_probe_ctx *lttng_probe_ctx,
07dfc1d0 176 union lttng_ctx_value *value);
ba1f5986 177 union {
2001023e 178 struct lttng_perf_counter_field *perf_counter;
ba1f5986 179 } u;
2dccf128 180 void (*destroy)(struct lttng_ctx_field *field);
ba1f5986
MD
181};
182
183struct lttng_ctx {
833ad6a0 184 struct lttng_ctx_field *fields;
0d1a681e 185 unsigned int nr_fields;
ba1f5986 186 unsigned int allocated_fields;
a9dd15da 187 size_t largest_align; /* in bytes */
0d1a681e
MD
188};
189
190struct lttng_event_desc {
a26a7e4f
MD
191 const char *name; /* lttng-modules name */
192 const char *kname; /* Linux kernel name (tracepoints) */
c0edae1d 193 void *probe_callback;
0d1a681e
MD
194 const struct lttng_event_ctx *ctx; /* context */
195 const struct lttng_event_field *fields; /* event payload */
c0edae1d 196 unsigned int nr_fields;
dc7f600a 197 struct module *owner;
c0edae1d
MD
198};
199
85a9ca7f 200struct lttng_probe_desc {
3c997079 201 const char *provider;
f7bdf4db 202 const struct lttng_event_desc **event_desc;
85a9ca7f
MD
203 unsigned int nr_events;
204 struct list_head head; /* chain registered probes */
3c997079
MD
205 struct list_head lazy_init_head;
206 int lazy; /* lazy registration */
85a9ca7f
MD
207};
208
7371f44c
MD
209struct lttng_krp; /* Kretprobe handling */
210
3c997079
MD
211enum lttng_event_type {
212 LTTNG_TYPE_EVENT = 0,
213 LTTNG_TYPE_ENABLER = 1,
214};
215
07dfc1d0
MD
216struct lttng_filter_bytecode_node {
217 struct list_head node;
218 struct lttng_enabler *enabler;
219 /*
220 * struct lttng_kernel_filter_bytecode has var. sized array, must be
221 * last field.
222 */
223 struct lttng_kernel_filter_bytecode bc;
224};
225
226/*
227 * Filter return value masks.
228 */
229enum lttng_filter_ret {
230 LTTNG_FILTER_DISCARD = 0,
231 LTTNG_FILTER_RECORD_FLAG = (1ULL << 0),
232 /* Other bits are kept for future use. */
233};
234
235struct lttng_bytecode_runtime {
236 /* Associated bytecode */
237 struct lttng_filter_bytecode_node *bc;
79150a49
JD
238 uint64_t (*filter)(void *filter_data, struct lttng_probe_ctx *lttng_probe_ctx,
239 const char *filter_stack_data);
07dfc1d0
MD
240 int link_failed;
241 struct list_head node; /* list of bytecode runtime in event */
242};
243
3c997079
MD
244/*
245 * Objects in a linked-list of enablers, owned by an event.
246 */
247struct lttng_enabler_ref {
248 struct list_head node; /* enabler ref list */
249 struct lttng_enabler *ref; /* backward ref */
250};
251
85a9ca7f 252/*
a90917c3 253 * lttng_event structure is referred to by the tracing fast path. It must be
85a9ca7f
MD
254 * kept small.
255 */
a90917c3 256struct lttng_event {
3c997079 257 enum lttng_event_type evtype; /* First field. */
85a9ca7f 258 unsigned int id;
a90917c3 259 struct lttng_channel *chan;
e64957da 260 int enabled;
d3dbe23c 261 const struct lttng_event_desc *desc;
85a9ca7f 262 void *filter;
f1676205 263 struct lttng_ctx *ctx;
38d024ae 264 enum lttng_kernel_instrumentation instrumentation;
d6d808f3
MD
265 union {
266 struct {
267 struct kprobe kp;
268 char *symbol_name;
269 } kprobe;
7371f44c
MD
270 struct {
271 struct lttng_krp *lttng_krp;
272 char *symbol_name;
273 } kretprobe;
e0a7a7c4
MD
274 struct {
275 char *symbol_name;
276 } ftrace;
d6d808f3 277 } u;
3c997079 278 struct list_head list; /* Event list in session */
9cccf98a 279 unsigned int metadata_dumped:1;
3c997079
MD
280
281 /* Backward references: list of lttng_enabler_ref (ref to enablers) */
282 struct list_head enablers_ref_head;
283 struct hlist_node hlist; /* session ht of events */
284 int registered; /* has reg'd tracepoint probe */
07dfc1d0
MD
285 /* list of struct lttng_bytecode_runtime, sorted by seqnum */
286 struct list_head bytecode_runtime_head;
287 int has_enablers_without_bytecode;
3c997079
MD
288};
289
290enum lttng_enabler_type {
291 LTTNG_ENABLER_WILDCARD,
292 LTTNG_ENABLER_NAME,
293};
294
295/*
296 * Enabler field, within whatever object is enabling an event. Target of
297 * backward reference.
298 */
299struct lttng_enabler {
300 enum lttng_event_type evtype; /* First field. */
301
302 enum lttng_enabler_type type;
303
304 struct list_head node; /* per-session list of enablers */
07dfc1d0
MD
305 /* head list of struct lttng_ust_filter_bytecode_node */
306 struct list_head filter_bytecode_head;
3c997079
MD
307
308 struct lttng_kernel_event event_param;
309 struct lttng_channel *chan;
310 struct lttng_ctx *ctx;
311 unsigned int enabled:1;
85a9ca7f
MD
312};
313
a90917c3 314struct lttng_channel_ops {
85a9ca7f 315 struct channel *(*channel_create)(const char *name,
a90917c3 316 struct lttng_channel *lttng_chan,
85a9ca7f
MD
317 void *buf_addr,
318 size_t subbuf_size, size_t num_subbuf,
319 unsigned int switch_timer_interval,
320 unsigned int read_timer_interval);
321 void (*channel_destroy)(struct channel *chan);
322 struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan);
f71ecafa 323 int (*buffer_has_read_closed_stream)(struct channel *chan);
85a9ca7f 324 void (*buffer_read_close)(struct lib_ring_buffer *buf);
4e1f08f4 325 int (*event_reserve)(struct lib_ring_buffer_ctx *ctx,
64c796d8 326 uint32_t event_id);
85a9ca7f
MD
327 void (*event_commit)(struct lib_ring_buffer_ctx *ctx);
328 void (*event_write)(struct lib_ring_buffer_ctx *ctx, const void *src,
329 size_t len);
4ea00e4f
JD
330 void (*event_write_from_user)(struct lib_ring_buffer_ctx *ctx,
331 const void *src, size_t len);
58aa5d24
MD
332 void (*event_memset)(struct lib_ring_buffer_ctx *ctx,
333 int c, size_t len);
16f78f3a
MD
334 void (*event_strcpy)(struct lib_ring_buffer_ctx *ctx, const char *src,
335 size_t len);
336 void (*event_strcpy_from_user)(struct lib_ring_buffer_ctx *ctx,
337 const char __user *src, size_t len);
1ec3f75a
MD
338 /*
339 * packet_avail_size returns the available size in the current
340 * packet. Note that the size returned is only a hint, since it
341 * may change due to concurrent writes.
342 */
343 size_t (*packet_avail_size)(struct channel *chan);
71c1d843 344 wait_queue_head_t *(*get_writer_buf_wait_queue)(struct channel *chan, int cpu);
24cedcfe
MD
345 wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan);
346 int (*is_finalized)(struct channel *chan);
254ec7bc 347 int (*is_disabled)(struct channel *chan);
3b731ab1
JD
348 int (*timestamp_begin) (const struct lib_ring_buffer_config *config,
349 struct lib_ring_buffer *bufb,
350 uint64_t *timestamp_begin);
351 int (*timestamp_end) (const struct lib_ring_buffer_config *config,
352 struct lib_ring_buffer *bufb,
353 uint64_t *timestamp_end);
354 int (*events_discarded) (const struct lib_ring_buffer_config *config,
355 struct lib_ring_buffer *bufb,
356 uint64_t *events_discarded);
357 int (*content_size) (const struct lib_ring_buffer_config *config,
358 struct lib_ring_buffer *bufb,
359 uint64_t *content_size);
360 int (*packet_size) (const struct lib_ring_buffer_config *config,
361 struct lib_ring_buffer *bufb,
362 uint64_t *packet_size);
363 int (*stream_id) (const struct lib_ring_buffer_config *config,
364 struct lib_ring_buffer *bufb,
365 uint64_t *stream_id);
2348ca17
JD
366 int (*current_timestamp) (const struct lib_ring_buffer_config *config,
367 struct lib_ring_buffer *bufb,
368 uint64_t *ts);
5b3cf4f9
JD
369 int (*sequence_number) (const struct lib_ring_buffer_config *config,
370 struct lib_ring_buffer *bufb,
371 uint64_t *seq);
5594698f
JD
372 int (*instance_id) (const struct lib_ring_buffer_config *config,
373 struct lib_ring_buffer *bufb,
374 uint64_t *id);
85a9ca7f
MD
375};
376
a90917c3 377struct lttng_transport {
a33c9927
MD
378 char *name;
379 struct module *owner;
380 struct list_head node;
a90917c3 381 struct lttng_channel_ops ops;
a33c9927
MD
382};
383
80f87dd2
MD
384struct lttng_syscall_filter;
385
3c997079
MD
386#define LTTNG_EVENT_HT_BITS 12
387#define LTTNG_EVENT_HT_SIZE (1U << LTTNG_EVENT_HT_BITS)
388
389struct lttng_event_ht {
390 struct hlist_head table[LTTNG_EVENT_HT_SIZE];
391};
392
a90917c3 393struct lttng_channel {
c099397a 394 unsigned int id;
85a9ca7f 395 struct channel *chan; /* Channel buffers */
e64957da 396 int enabled;
f1676205 397 struct lttng_ctx *ctx;
85a9ca7f 398 /* Event ID management */
a90917c3 399 struct lttng_session *session;
85a9ca7f
MD
400 struct file *file; /* File associated to channel */
401 unsigned int free_event_id; /* Next event ID to allocate */
402 struct list_head list; /* Channel list */
a90917c3
MD
403 struct lttng_channel_ops *ops;
404 struct lttng_transport *transport;
405 struct lttng_event **sc_table; /* for syscall tracing */
406 struct lttng_event **compat_sc_table;
5b7ac358
MD
407 struct lttng_event **sc_exit_table; /* for syscall exit tracing */
408 struct lttng_event **compat_sc_exit_table;
a90917c3
MD
409 struct lttng_event *sc_unknown; /* for unknown syscalls */
410 struct lttng_event *sc_compat_unknown;
5b7ac358
MD
411 struct lttng_event *sc_exit_unknown;
412 struct lttng_event *compat_sc_exit_unknown;
80f87dd2 413 struct lttng_syscall_filter *sc_filter;
9115fbdc 414 int header_type; /* 0: unset, 1: compact, 2: large */
d83004aa 415 enum channel_type channel_type;
80f87dd2
MD
416 unsigned int metadata_dumped:1,
417 sys_enter_registered:1,
418 sys_exit_registered:1,
3c997079
MD
419 syscall_all:1,
420 tstate:1; /* Transient enable state */
85a9ca7f
MD
421};
422
d83004aa
JD
423struct lttng_metadata_stream {
424 void *priv; /* Ring buffer private data */
425 struct lttng_metadata_cache *metadata_cache;
f613e3e6
MD
426 unsigned int metadata_in; /* Bytes read from the cache */
427 unsigned int metadata_out; /* Bytes consumed from stream */
d83004aa
JD
428 int finalized; /* Has channel been finalized */
429 wait_queue_head_t read_wait; /* Reader buffer-level wait queue */
430 struct list_head list; /* Stream list */
b3b8072b 431 struct lttng_transport *transport;
9616f0bf 432 uint64_t version; /* Current version of the metadata cache */
d83004aa
JD
433};
434
e0130fab
MD
435
436/*
437 * struct lttng_pid_tracker declared in header due to deferencing of *v
438 * in RCU_INITIALIZER(v).
439 */
440#define LTTNG_PID_HASH_BITS 6
441#define LTTNG_PID_TABLE_SIZE (1 << LTTNG_PID_HASH_BITS)
442
443struct lttng_pid_tracker {
444 struct hlist_head pid_hash[LTTNG_PID_TABLE_SIZE];
445};
446
7e6f9ef6
MD
447struct lttng_pid_hash_node {
448 struct hlist_node hlist;
449 int pid;
450};
451
a90917c3 452struct lttng_session {
85a9ca7f 453 int active; /* Is trace session active ? */
8070f5c0 454 int been_active; /* Has trace session been active ? */
85a9ca7f
MD
455 struct file *file; /* File associated to session */
456 struct list_head chan; /* Channel list head */
457 struct list_head events; /* Event list head */
458 struct list_head list; /* Session list */
c099397a 459 unsigned int free_chan_id; /* Next chan ID to allocate */
d793d5e1 460 uuid_le uuid; /* Trace session unique ID */
d83004aa 461 struct lttng_metadata_cache *metadata_cache;
e0130fab 462 struct lttng_pid_tracker *pid_tracker;
3c997079
MD
463 unsigned int metadata_dumped:1,
464 tstate:1; /* Transient enable state */
465 /* List of enablers */
466 struct list_head enablers_head;
467 /* Hash table of events */
468 struct lttng_event_ht events_ht;
85a9ca7f
MD
469};
470
d83004aa
JD
471struct lttng_metadata_cache {
472 char *data; /* Metadata cache */
473 unsigned int cache_alloc; /* Metadata allocated size (bytes) */
474 unsigned int metadata_written; /* Number of bytes written in metadata cache */
475 struct kref refcount; /* Metadata cache usage */
476 struct list_head metadata_stream; /* Metadata stream list */
a36580d5 477 uuid_le uuid; /* Trace session unique ID (copy) */
9616f0bf
JD
478 struct mutex lock; /* Produce/consume lock */
479 uint64_t version; /* Current version of the metadata */
d83004aa
JD
480};
481
3c997079
MD
482void lttng_lock_sessions(void);
483void lttng_unlock_sessions(void);
484
485struct list_head *lttng_get_probe_list_head(void);
486
487struct lttng_enabler *lttng_enabler_create(enum lttng_enabler_type type,
488 struct lttng_kernel_event *event_param,
489 struct lttng_channel *chan);
490
491int lttng_enabler_enable(struct lttng_enabler *enabler);
492int lttng_enabler_disable(struct lttng_enabler *enabler);
493int lttng_fix_pending_events(void);
494int lttng_session_active(void);
495
a90917c3
MD
496struct lttng_session *lttng_session_create(void);
497int lttng_session_enable(struct lttng_session *session);
498int lttng_session_disable(struct lttng_session *session);
499void lttng_session_destroy(struct lttng_session *session);
9616f0bf 500int lttng_session_metadata_regenerate(struct lttng_session *session);
d83004aa 501void metadata_cache_destroy(struct kref *kref);
4e3c1b9b 502
a90917c3 503struct lttng_channel *lttng_channel_create(struct lttng_session *session,
5dbbdb43
MD
504 const char *transport_name,
505 void *buf_addr,
506 size_t subbuf_size, size_t num_subbuf,
507 unsigned int switch_timer_interval,
d83004aa
JD
508 unsigned int read_timer_interval,
509 enum channel_type channel_type);
a90917c3 510struct lttng_channel *lttng_global_channel_create(struct lttng_session *session,
4e3c1b9b
MD
511 int overwrite, void *buf_addr,
512 size_t subbuf_size, size_t num_subbuf,
513 unsigned int switch_timer_interval,
514 unsigned int read_timer_interval);
4e3c1b9b 515
d83004aa 516void lttng_metadata_channel_destroy(struct lttng_channel *chan);
a90917c3 517struct lttng_event *lttng_event_create(struct lttng_channel *chan,
3c997079
MD
518 struct lttng_kernel_event *event_param,
519 void *filter,
520 const struct lttng_event_desc *event_desc,
521 enum lttng_kernel_instrumentation itype);
33a39a3c
MD
522struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
523 struct lttng_kernel_event *event_param,
524 void *filter,
525 const struct lttng_event_desc *event_desc,
526 enum lttng_kernel_instrumentation itype);
6dccd6c1
JD
527struct lttng_event *lttng_event_compat_old_create(struct lttng_channel *chan,
528 struct lttng_kernel_old_event *old_event_param,
529 void *filter,
530 const struct lttng_event_desc *internal_desc);
c0e31d2e 531
a90917c3
MD
532int lttng_channel_enable(struct lttng_channel *channel);
533int lttng_channel_disable(struct lttng_channel *channel);
534int lttng_event_enable(struct lttng_event *event);
535int lttng_event_disable(struct lttng_event *event);
e64957da 536
a90917c3
MD
537void lttng_transport_register(struct lttng_transport *transport);
538void lttng_transport_unregister(struct lttng_transport *transport);
11b5a3c2 539
360f38ea 540void synchronize_trace(void);
80996790 541int lttng_abi_init(void);
6dccd6c1 542int lttng_abi_compat_old_init(void);
80996790 543void lttng_abi_exit(void);
6dccd6c1 544void lttng_abi_compat_old_exit(void);
1c25284c 545
a90917c3
MD
546int lttng_probe_register(struct lttng_probe_desc *desc);
547void lttng_probe_unregister(struct lttng_probe_desc *desc);
548const struct lttng_event_desc *lttng_event_get(const char *name);
549void lttng_event_put(const struct lttng_event_desc *desc);
550int lttng_probes_init(void);
551void lttng_probes_exit(void);
1ec65de1 552
b3b8072b
MD
553int lttng_metadata_output_channel(struct lttng_metadata_stream *stream,
554 struct channel *chan);
d83004aa 555
7e6f9ef6 556int lttng_pid_tracker_get_node_pid(const struct lttng_pid_hash_node *node);
e0130fab
MD
557struct lttng_pid_tracker *lttng_pid_tracker_create(void);
558void lttng_pid_tracker_destroy(struct lttng_pid_tracker *lpf);
559bool lttng_pid_tracker_lookup(struct lttng_pid_tracker *lpf, int pid);
560int lttng_pid_tracker_add(struct lttng_pid_tracker *lpf, int pid);
561int lttng_pid_tracker_del(struct lttng_pid_tracker *lpf, int pid);
562
563int lttng_session_track_pid(struct lttng_session *session, int pid);
564int lttng_session_untrack_pid(struct lttng_session *session, int pid);
565
7e6f9ef6
MD
566int lttng_session_list_tracker_pids(struct lttng_session *session);
567
2754583e
MD
568void lttng_clock_ref(void);
569void lttng_clock_unref(void);
570
3a523f5b 571#if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
a90917c3
MD
572int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
573int lttng_syscalls_unregister(struct lttng_channel *chan);
80f87dd2
MD
574int lttng_syscall_filter_enable(struct lttng_channel *chan,
575 const char *name);
576int lttng_syscall_filter_disable(struct lttng_channel *chan,
577 const char *name);
12e579db
MD
578long lttng_channel_syscall_mask(struct lttng_channel *channel,
579 struct lttng_kernel_syscall_mask __user *usyscall_mask);
1ec65de1 580#else
a90917c3 581static inline int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
1ec65de1
MD
582{
583 return -ENOSYS;
584}
585
a90917c3 586static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
1ec65de1
MD
587{
588 return 0;
589}
80f87dd2 590
f127e61e 591static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
80f87dd2
MD
592 const char *name)
593{
594 return -ENOSYS;
595}
596
f127e61e 597static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
80f87dd2
MD
598 const char *name)
599{
600 return -ENOSYS;
601}
12e579db 602
f127e61e 603static inline long lttng_channel_syscall_mask(struct lttng_channel *channel,
12e579db
MD
604 struct lttng_kernel_syscall_mask __user *usyscall_mask)
605{
606 return -ENOSYS;
607}
1ec65de1
MD
608#endif
609
07dfc1d0
MD
610void lttng_filter_sync_state(struct lttng_bytecode_runtime *runtime);
611int lttng_enabler_attach_bytecode(struct lttng_enabler *enabler,
612 struct lttng_kernel_filter_bytecode __user *bytecode);
f127e61e
MD
613void lttng_enabler_event_link_bytecode(struct lttng_event *event,
614 struct lttng_enabler *enabler);
07dfc1d0
MD
615
616extern struct lttng_ctx *lttng_static_ctx;
617
618int lttng_context_init(void);
619void lttng_context_exit(void);
2dccf128 620struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx);
a9dd15da 621void lttng_context_update(struct lttng_ctx *ctx);
44252f0f 622int lttng_find_context(struct lttng_ctx *ctx, const char *name);
07dfc1d0 623int lttng_get_context_index(struct lttng_ctx *ctx, const char *name);
8289661d
MD
624void lttng_remove_context_field(struct lttng_ctx **ctx,
625 struct lttng_ctx_field *field);
2dccf128 626void lttng_destroy_context(struct lttng_ctx *ctx);
8070f5c0 627int lttng_add_pid_to_ctx(struct lttng_ctx **ctx);
b3699d90 628int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx);
a2563e83 629int lttng_add_procname_to_ctx(struct lttng_ctx **ctx);
a8ad3613 630int lttng_add_prio_to_ctx(struct lttng_ctx **ctx);
53f1f0ca 631int lttng_add_nice_to_ctx(struct lttng_ctx **ctx);
b64bc438
MD
632int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx);
633int lttng_add_tid_to_ctx(struct lttng_ctx **ctx);
634int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx);
635int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx);
636int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx);
975da2c0 637int lttng_add_hostname_to_ctx(struct lttng_ctx **ctx);
79150a49
JD
638int lttng_add_interruptible_to_ctx(struct lttng_ctx **ctx);
639int lttng_add_need_reschedule_to_ctx(struct lttng_ctx **ctx);
640#if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT)
641int lttng_add_preemptible_to_ctx(struct lttng_ctx **ctx);
642#else
643static inline
644int lttng_add_preemptible_to_ctx(struct lttng_ctx **ctx)
645{
646 return -ENOSYS;
647}
648#endif
649#ifdef CONFIG_PREEMPT_RT_FULL
650int lttng_add_migratable_to_ctx(struct lttng_ctx **ctx);
651#else
652static inline
653int lttng_add_migratable_to_ctx(struct lttng_ctx **ctx)
654{
655 return -ENOSYS;
656}
657#endif
41c3c24e 658#if defined(CONFIG_PERF_EVENTS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
c24a0d71
MD
659int lttng_add_perf_counter_to_ctx(uint32_t type,
660 uint64_t config,
661 const char *name,
662 struct lttng_ctx **ctx);
1d443b34
MD
663#else
664static inline
665int lttng_add_perf_counter_to_ctx(uint32_t type,
666 uint64_t config,
667 const char *name,
668 struct lttng_ctx **ctx)
669{
670 return -ENOSYS;
671}
672#endif
02119ee5 673
0c956676
MD
674int lttng_logger_init(void);
675void lttng_logger_exit(void);
676
c337ddc2
MD
677extern int lttng_statedump_start(struct lttng_session *session);
678
acd614cc 679#ifdef CONFIG_KPROBES
f17701fb
MD
680int lttng_kprobes_register(const char *name,
681 const char *symbol_name,
682 uint64_t offset,
683 uint64_t addr,
a90917c3
MD
684 struct lttng_event *event);
685void lttng_kprobes_unregister(struct lttng_event *event);
686void lttng_kprobes_destroy_private(struct lttng_event *event);
acd614cc
MD
687#else
688static inline
689int lttng_kprobes_register(const char *name,
690 const char *symbol_name,
691 uint64_t offset,
692 uint64_t addr,
a90917c3 693 struct lttng_event *event)
acd614cc
MD
694{
695 return -ENOSYS;
696}
697
25f53c39 698static inline
a90917c3 699void lttng_kprobes_unregister(struct lttng_event *event)
acd614cc
MD
700{
701}
edeb3137
MD
702
703static inline
a90917c3 704void lttng_kprobes_destroy_private(struct lttng_event *event)
edeb3137
MD
705{
706}
acd614cc 707#endif
d6d808f3 708
7371f44c
MD
709#ifdef CONFIG_KRETPROBES
710int lttng_kretprobes_register(const char *name,
711 const char *symbol_name,
712 uint64_t offset,
713 uint64_t addr,
a90917c3
MD
714 struct lttng_event *event_entry,
715 struct lttng_event *event_exit);
716void lttng_kretprobes_unregister(struct lttng_event *event);
717void lttng_kretprobes_destroy_private(struct lttng_event *event);
a0493bef
MD
718int lttng_kretprobes_event_enable_state(struct lttng_event *event,
719 int enable);
7371f44c
MD
720#else
721static inline
722int lttng_kretprobes_register(const char *name,
723 const char *symbol_name,
724 uint64_t offset,
725 uint64_t addr,
a90917c3
MD
726 struct lttng_event *event_entry,
727 struct lttng_event *event_exit)
7371f44c
MD
728{
729 return -ENOSYS;
730}
731
732static inline
a90917c3 733void lttng_kretprobes_unregister(struct lttng_event *event)
7371f44c
MD
734{
735}
736
737static inline
a90917c3 738void lttng_kretprobes_destroy_private(struct lttng_event *event)
7371f44c
MD
739{
740}
a0493bef
MD
741
742static inline
743int lttng_kretprobes_event_enable_state(struct lttng_event *event,
744 int enable)
745{
746 return -ENOSYS;
747}
7371f44c
MD
748#endif
749
e0a7a7c4
MD
750#ifdef CONFIG_DYNAMIC_FTRACE
751int lttng_ftrace_register(const char *name,
752 const char *symbol_name,
a90917c3
MD
753 struct lttng_event *event);
754void lttng_ftrace_unregister(struct lttng_event *event);
755void lttng_ftrace_destroy_private(struct lttng_event *event);
e0a7a7c4
MD
756#else
757static inline
758int lttng_ftrace_register(const char *name,
759 const char *symbol_name,
a90917c3 760 struct lttng_event *event)
e0a7a7c4 761{
acd614cc 762 return -ENOSYS;
e0a7a7c4
MD
763}
764
765static inline
a90917c3 766void lttng_ftrace_unregister(struct lttng_event *event)
e0a7a7c4
MD
767{
768}
edeb3137
MD
769
770static inline
a90917c3 771void lttng_ftrace_destroy_private(struct lttng_event *event)
edeb3137
MD
772{
773}
e0a7a7c4 774#endif
271b6681 775
3db41b2c 776int lttng_calibrate(struct lttng_kernel_calibrate *calibrate);
57105fc2 777
271b6681 778extern const struct file_operations lttng_tracepoint_list_fops;
2d2464bd 779extern const struct file_operations lttng_syscall_list_fops;
271b6681 780
ef200626
MD
781#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
782#define TRACEPOINT_HAS_DATA_ARG
783#endif
784
a90917c3 785#endif /* _LTTNG_EVENTS_H */
This page took 0.092911 seconds and 4 git commands to generate.