Update btrfs instrumentation for 4.10 kernel
[lttng-modules.git] / lttng-events.h
1 #ifndef _LTTNG_EVENTS_H
2 #define _LTTNG_EVENTS_H
3
4 /*
5 * lttng-events.h
6 *
7 * Holds LTTng per-session event registry.
8 *
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
24 */
25
26 #include <linux/version.h>
27 #include <linux/list.h>
28 #include <linux/kprobes.h>
29 #include <linux/kref.h>
30 #include <wrapper/uuid.h>
31 #include <lttng-abi.h>
32 #include <lttng-abi-old.h>
33
34 #define lttng_is_signed_type(type) (((type)(-1)) < 0)
35
36 struct lttng_channel;
37 struct lttng_session;
38 struct lttng_metadata_cache;
39 struct lib_ring_buffer_ctx;
40 struct perf_event;
41 struct perf_event_attr;
42 struct lib_ring_buffer_config;
43
44 /* Type description */
45
46 enum abstract_types {
47 atype_integer,
48 atype_enum,
49 atype_array,
50 atype_sequence,
51 atype_string,
52 NR_ABSTRACT_TYPES,
53 };
54
55 enum lttng_string_encodings {
56 lttng_encode_none = 0,
57 lttng_encode_UTF8 = 1,
58 lttng_encode_ASCII = 2,
59 NR_STRING_ENCODINGS,
60 };
61
62 enum channel_type {
63 PER_CPU_CHANNEL,
64 METADATA_CHANNEL,
65 };
66
67 struct lttng_enum_entry {
68 unsigned long long start, end; /* start and end are inclusive */
69 const char *string;
70 };
71
72 #define __type_integer(_type, _size, _alignment, _signedness, \
73 _byte_order, _base, _encoding) \
74 { \
75 .atype = atype_integer, \
76 .u.basic.integer = \
77 { \
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, \
82 .base = _base, \
83 .encoding = lttng_encode_##_encoding, \
84 }, \
85 } \
86
87 struct lttng_integer_type {
88 unsigned int size; /* in bits */
89 unsigned short alignment; /* in bits */
90 unsigned int signedness:1,
91 reverse_byte_order:1;
92 unsigned int base; /* 2, 8, 10, 16, for pretty print */
93 enum lttng_string_encodings encoding;
94 };
95
96 union _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
106 struct lttng_basic_type {
107 enum abstract_types atype;
108 union {
109 union _lttng_basic_type basic;
110 } u;
111 };
112
113 struct lttng_type {
114 enum abstract_types atype;
115 union {
116 union _lttng_basic_type basic;
117 struct {
118 struct lttng_basic_type elem_type;
119 unsigned int length; /* num. elems. */
120 unsigned int elem_alignment; /* alignment override */
121 } array;
122 struct {
123 struct lttng_basic_type length_type;
124 struct lttng_basic_type elem_type;
125 unsigned int elem_alignment; /* alignment override */
126 } sequence;
127 } u;
128 };
129
130 struct lttng_enum {
131 const char *name;
132 struct lttng_type container_type;
133 const struct lttng_enum_entry *entries;
134 unsigned int len;
135 };
136
137 /* Event field description */
138
139 struct lttng_event_field {
140 const char *name;
141 struct lttng_type type;
142 unsigned int nowrite:1, /* do not write into trace */
143 user:1; /* fetch from user-space */
144 };
145
146 union lttng_ctx_value {
147 int64_t s64;
148 const char *str;
149 double d;
150 };
151
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 */
156 struct 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
163 struct lttng_probe_ctx {
164 struct lttng_event *event;
165 uint8_t interruptible;
166 };
167
168 struct lttng_ctx_field {
169 struct lttng_event_field event_field;
170 size_t (*get_size)(size_t offset);
171 void (*record)(struct lttng_ctx_field *field,
172 struct lib_ring_buffer_ctx *ctx,
173 struct lttng_channel *chan);
174 void (*get_value)(struct lttng_ctx_field *field,
175 struct lttng_probe_ctx *lttng_probe_ctx,
176 union lttng_ctx_value *value);
177 union {
178 struct lttng_perf_counter_field *perf_counter;
179 } u;
180 void (*destroy)(struct lttng_ctx_field *field);
181 };
182
183 struct lttng_ctx {
184 struct lttng_ctx_field *fields;
185 unsigned int nr_fields;
186 unsigned int allocated_fields;
187 size_t largest_align; /* in bytes */
188 };
189
190 struct lttng_event_desc {
191 const char *name; /* lttng-modules name */
192 const char *kname; /* Linux kernel name (tracepoints) */
193 void *probe_callback;
194 const struct lttng_event_ctx *ctx; /* context */
195 const struct lttng_event_field *fields; /* event payload */
196 unsigned int nr_fields;
197 struct module *owner;
198 };
199
200 struct lttng_probe_desc {
201 const char *provider;
202 const struct lttng_event_desc **event_desc;
203 unsigned int nr_events;
204 struct list_head head; /* chain registered probes */
205 struct list_head lazy_init_head;
206 int lazy; /* lazy registration */
207 };
208
209 struct lttng_krp; /* Kretprobe handling */
210
211 enum lttng_event_type {
212 LTTNG_TYPE_EVENT = 0,
213 LTTNG_TYPE_ENABLER = 1,
214 };
215
216 struct 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 */
229 enum 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
235 struct lttng_bytecode_runtime {
236 /* Associated bytecode */
237 struct lttng_filter_bytecode_node *bc;
238 uint64_t (*filter)(void *filter_data, struct lttng_probe_ctx *lttng_probe_ctx,
239 const char *filter_stack_data);
240 int link_failed;
241 struct list_head node; /* list of bytecode runtime in event */
242 };
243
244 /*
245 * Objects in a linked-list of enablers, owned by an event.
246 */
247 struct lttng_enabler_ref {
248 struct list_head node; /* enabler ref list */
249 struct lttng_enabler *ref; /* backward ref */
250 };
251
252 /*
253 * lttng_event structure is referred to by the tracing fast path. It must be
254 * kept small.
255 */
256 struct lttng_event {
257 enum lttng_event_type evtype; /* First field. */
258 unsigned int id;
259 struct lttng_channel *chan;
260 int enabled;
261 const struct lttng_event_desc *desc;
262 void *filter;
263 struct lttng_ctx *ctx;
264 enum lttng_kernel_instrumentation instrumentation;
265 union {
266 struct {
267 struct kprobe kp;
268 char *symbol_name;
269 } kprobe;
270 struct {
271 struct lttng_krp *lttng_krp;
272 char *symbol_name;
273 } kretprobe;
274 struct {
275 char *symbol_name;
276 } ftrace;
277 } u;
278 struct list_head list; /* Event list in session */
279 unsigned int metadata_dumped:1;
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 */
285 /* list of struct lttng_bytecode_runtime, sorted by seqnum */
286 struct list_head bytecode_runtime_head;
287 int has_enablers_without_bytecode;
288 };
289
290 enum 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 */
299 struct 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 */
305 /* head list of struct lttng_ust_filter_bytecode_node */
306 struct list_head filter_bytecode_head;
307
308 struct lttng_kernel_event event_param;
309 struct lttng_channel *chan;
310 struct lttng_ctx *ctx;
311 unsigned int enabled:1;
312 };
313
314 struct lttng_channel_ops {
315 struct channel *(*channel_create)(const char *name,
316 struct lttng_channel *lttng_chan,
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);
323 int (*buffer_has_read_closed_stream)(struct channel *chan);
324 void (*buffer_read_close)(struct lib_ring_buffer *buf);
325 int (*event_reserve)(struct lib_ring_buffer_ctx *ctx,
326 uint32_t event_id);
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);
330 void (*event_write_from_user)(struct lib_ring_buffer_ctx *ctx,
331 const void *src, size_t len);
332 void (*event_memset)(struct lib_ring_buffer_ctx *ctx,
333 int c, size_t len);
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);
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);
344 wait_queue_head_t *(*get_writer_buf_wait_queue)(struct channel *chan, int cpu);
345 wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan);
346 int (*is_finalized)(struct channel *chan);
347 int (*is_disabled)(struct channel *chan);
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);
366 int (*current_timestamp) (const struct lib_ring_buffer_config *config,
367 struct lib_ring_buffer *bufb,
368 uint64_t *ts);
369 int (*sequence_number) (const struct lib_ring_buffer_config *config,
370 struct lib_ring_buffer *bufb,
371 uint64_t *seq);
372 int (*instance_id) (const struct lib_ring_buffer_config *config,
373 struct lib_ring_buffer *bufb,
374 uint64_t *id);
375 };
376
377 struct lttng_transport {
378 char *name;
379 struct module *owner;
380 struct list_head node;
381 struct lttng_channel_ops ops;
382 };
383
384 struct lttng_syscall_filter;
385
386 #define LTTNG_EVENT_HT_BITS 12
387 #define LTTNG_EVENT_HT_SIZE (1U << LTTNG_EVENT_HT_BITS)
388
389 struct lttng_event_ht {
390 struct hlist_head table[LTTNG_EVENT_HT_SIZE];
391 };
392
393 struct lttng_channel {
394 unsigned int id;
395 struct channel *chan; /* Channel buffers */
396 int enabled;
397 struct lttng_ctx *ctx;
398 /* Event ID management */
399 struct lttng_session *session;
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 */
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;
407 struct lttng_event **sc_exit_table; /* for syscall exit tracing */
408 struct lttng_event **compat_sc_exit_table;
409 struct lttng_event *sc_unknown; /* for unknown syscalls */
410 struct lttng_event *sc_compat_unknown;
411 struct lttng_event *sc_exit_unknown;
412 struct lttng_event *compat_sc_exit_unknown;
413 struct lttng_syscall_filter *sc_filter;
414 int header_type; /* 0: unset, 1: compact, 2: large */
415 enum channel_type channel_type;
416 unsigned int metadata_dumped:1,
417 sys_enter_registered:1,
418 sys_exit_registered:1,
419 syscall_all:1,
420 tstate:1; /* Transient enable state */
421 };
422
423 struct lttng_metadata_stream {
424 void *priv; /* Ring buffer private data */
425 struct lttng_metadata_cache *metadata_cache;
426 unsigned int metadata_in; /* Bytes read from the cache */
427 unsigned int metadata_out; /* Bytes consumed from stream */
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 */
431 struct lttng_transport *transport;
432 uint64_t version; /* Current version of the metadata cache */
433 };
434
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
443 struct lttng_pid_tracker {
444 struct hlist_head pid_hash[LTTNG_PID_TABLE_SIZE];
445 };
446
447 struct lttng_pid_hash_node {
448 struct hlist_node hlist;
449 int pid;
450 };
451
452 struct lttng_session {
453 int active; /* Is trace session active ? */
454 int been_active; /* Has trace session been active ? */
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 */
459 unsigned int free_chan_id; /* Next chan ID to allocate */
460 uuid_le uuid; /* Trace session unique ID */
461 struct lttng_metadata_cache *metadata_cache;
462 struct lttng_pid_tracker *pid_tracker;
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;
469 };
470
471 struct 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 */
477 uuid_le uuid; /* Trace session unique ID (copy) */
478 struct mutex lock; /* Produce/consume lock */
479 uint64_t version; /* Current version of the metadata */
480 };
481
482 void lttng_lock_sessions(void);
483 void lttng_unlock_sessions(void);
484
485 struct list_head *lttng_get_probe_list_head(void);
486
487 struct lttng_enabler *lttng_enabler_create(enum lttng_enabler_type type,
488 struct lttng_kernel_event *event_param,
489 struct lttng_channel *chan);
490
491 int lttng_enabler_enable(struct lttng_enabler *enabler);
492 int lttng_enabler_disable(struct lttng_enabler *enabler);
493 int lttng_fix_pending_events(void);
494 int lttng_session_active(void);
495
496 struct lttng_session *lttng_session_create(void);
497 int lttng_session_enable(struct lttng_session *session);
498 int lttng_session_disable(struct lttng_session *session);
499 void lttng_session_destroy(struct lttng_session *session);
500 int lttng_session_metadata_regenerate(struct lttng_session *session);
501 void metadata_cache_destroy(struct kref *kref);
502
503 struct lttng_channel *lttng_channel_create(struct lttng_session *session,
504 const char *transport_name,
505 void *buf_addr,
506 size_t subbuf_size, size_t num_subbuf,
507 unsigned int switch_timer_interval,
508 unsigned int read_timer_interval,
509 enum channel_type channel_type);
510 struct lttng_channel *lttng_global_channel_create(struct lttng_session *session,
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);
515
516 void lttng_metadata_channel_destroy(struct lttng_channel *chan);
517 struct lttng_event *lttng_event_create(struct lttng_channel *chan,
518 struct lttng_kernel_event *event_param,
519 void *filter,
520 const struct lttng_event_desc *event_desc,
521 enum lttng_kernel_instrumentation itype);
522 struct 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);
527 struct 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);
531
532 int lttng_channel_enable(struct lttng_channel *channel);
533 int lttng_channel_disable(struct lttng_channel *channel);
534 int lttng_event_enable(struct lttng_event *event);
535 int lttng_event_disable(struct lttng_event *event);
536
537 void lttng_transport_register(struct lttng_transport *transport);
538 void lttng_transport_unregister(struct lttng_transport *transport);
539
540 void synchronize_trace(void);
541 int lttng_abi_init(void);
542 int lttng_abi_compat_old_init(void);
543 void lttng_abi_exit(void);
544 void lttng_abi_compat_old_exit(void);
545
546 int lttng_probe_register(struct lttng_probe_desc *desc);
547 void lttng_probe_unregister(struct lttng_probe_desc *desc);
548 const struct lttng_event_desc *lttng_event_get(const char *name);
549 void lttng_event_put(const struct lttng_event_desc *desc);
550 int lttng_probes_init(void);
551 void lttng_probes_exit(void);
552
553 int lttng_metadata_output_channel(struct lttng_metadata_stream *stream,
554 struct channel *chan);
555
556 int lttng_pid_tracker_get_node_pid(const struct lttng_pid_hash_node *node);
557 struct lttng_pid_tracker *lttng_pid_tracker_create(void);
558 void lttng_pid_tracker_destroy(struct lttng_pid_tracker *lpf);
559 bool lttng_pid_tracker_lookup(struct lttng_pid_tracker *lpf, int pid);
560 int lttng_pid_tracker_add(struct lttng_pid_tracker *lpf, int pid);
561 int lttng_pid_tracker_del(struct lttng_pid_tracker *lpf, int pid);
562
563 int lttng_session_track_pid(struct lttng_session *session, int pid);
564 int lttng_session_untrack_pid(struct lttng_session *session, int pid);
565
566 int lttng_session_list_tracker_pids(struct lttng_session *session);
567
568 void lttng_clock_ref(void);
569 void lttng_clock_unref(void);
570
571 #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
572 int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
573 int lttng_syscalls_unregister(struct lttng_channel *chan);
574 int lttng_syscall_filter_enable(struct lttng_channel *chan,
575 const char *name);
576 int lttng_syscall_filter_disable(struct lttng_channel *chan,
577 const char *name);
578 long lttng_channel_syscall_mask(struct lttng_channel *channel,
579 struct lttng_kernel_syscall_mask __user *usyscall_mask);
580 #else
581 static inline int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
582 {
583 return -ENOSYS;
584 }
585
586 static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
587 {
588 return 0;
589 }
590
591 static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
592 const char *name)
593 {
594 return -ENOSYS;
595 }
596
597 static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
598 const char *name)
599 {
600 return -ENOSYS;
601 }
602
603 static inline long lttng_channel_syscall_mask(struct lttng_channel *channel,
604 struct lttng_kernel_syscall_mask __user *usyscall_mask)
605 {
606 return -ENOSYS;
607 }
608 #endif
609
610 void lttng_filter_sync_state(struct lttng_bytecode_runtime *runtime);
611 int lttng_enabler_attach_bytecode(struct lttng_enabler *enabler,
612 struct lttng_kernel_filter_bytecode __user *bytecode);
613 void lttng_enabler_event_link_bytecode(struct lttng_event *event,
614 struct lttng_enabler *enabler);
615
616 extern struct lttng_ctx *lttng_static_ctx;
617
618 int lttng_context_init(void);
619 void lttng_context_exit(void);
620 struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx);
621 void lttng_context_update(struct lttng_ctx *ctx);
622 int lttng_find_context(struct lttng_ctx *ctx, const char *name);
623 int lttng_get_context_index(struct lttng_ctx *ctx, const char *name);
624 void lttng_remove_context_field(struct lttng_ctx **ctx,
625 struct lttng_ctx_field *field);
626 void lttng_destroy_context(struct lttng_ctx *ctx);
627 int lttng_add_pid_to_ctx(struct lttng_ctx **ctx);
628 int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx);
629 int lttng_add_procname_to_ctx(struct lttng_ctx **ctx);
630 int lttng_add_prio_to_ctx(struct lttng_ctx **ctx);
631 int lttng_add_nice_to_ctx(struct lttng_ctx **ctx);
632 int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx);
633 int lttng_add_tid_to_ctx(struct lttng_ctx **ctx);
634 int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx);
635 int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx);
636 int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx);
637 int lttng_add_hostname_to_ctx(struct lttng_ctx **ctx);
638 int lttng_add_interruptible_to_ctx(struct lttng_ctx **ctx);
639 int lttng_add_need_reschedule_to_ctx(struct lttng_ctx **ctx);
640 #if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT)
641 int lttng_add_preemptible_to_ctx(struct lttng_ctx **ctx);
642 #else
643 static inline
644 int lttng_add_preemptible_to_ctx(struct lttng_ctx **ctx)
645 {
646 return -ENOSYS;
647 }
648 #endif
649 #ifdef CONFIG_PREEMPT_RT_FULL
650 int lttng_add_migratable_to_ctx(struct lttng_ctx **ctx);
651 #else
652 static inline
653 int lttng_add_migratable_to_ctx(struct lttng_ctx **ctx)
654 {
655 return -ENOSYS;
656 }
657 #endif
658 #if defined(CONFIG_PERF_EVENTS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
659 int lttng_add_perf_counter_to_ctx(uint32_t type,
660 uint64_t config,
661 const char *name,
662 struct lttng_ctx **ctx);
663 #else
664 static inline
665 int 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
673
674 int lttng_logger_init(void);
675 void lttng_logger_exit(void);
676
677 extern int lttng_statedump_start(struct lttng_session *session);
678
679 #ifdef CONFIG_KPROBES
680 int lttng_kprobes_register(const char *name,
681 const char *symbol_name,
682 uint64_t offset,
683 uint64_t addr,
684 struct lttng_event *event);
685 void lttng_kprobes_unregister(struct lttng_event *event);
686 void lttng_kprobes_destroy_private(struct lttng_event *event);
687 #else
688 static inline
689 int lttng_kprobes_register(const char *name,
690 const char *symbol_name,
691 uint64_t offset,
692 uint64_t addr,
693 struct lttng_event *event)
694 {
695 return -ENOSYS;
696 }
697
698 static inline
699 void lttng_kprobes_unregister(struct lttng_event *event)
700 {
701 }
702
703 static inline
704 void lttng_kprobes_destroy_private(struct lttng_event *event)
705 {
706 }
707 #endif
708
709 #ifdef CONFIG_KRETPROBES
710 int lttng_kretprobes_register(const char *name,
711 const char *symbol_name,
712 uint64_t offset,
713 uint64_t addr,
714 struct lttng_event *event_entry,
715 struct lttng_event *event_exit);
716 void lttng_kretprobes_unregister(struct lttng_event *event);
717 void lttng_kretprobes_destroy_private(struct lttng_event *event);
718 int lttng_kretprobes_event_enable_state(struct lttng_event *event,
719 int enable);
720 #else
721 static inline
722 int lttng_kretprobes_register(const char *name,
723 const char *symbol_name,
724 uint64_t offset,
725 uint64_t addr,
726 struct lttng_event *event_entry,
727 struct lttng_event *event_exit)
728 {
729 return -ENOSYS;
730 }
731
732 static inline
733 void lttng_kretprobes_unregister(struct lttng_event *event)
734 {
735 }
736
737 static inline
738 void lttng_kretprobes_destroy_private(struct lttng_event *event)
739 {
740 }
741
742 static inline
743 int lttng_kretprobes_event_enable_state(struct lttng_event *event,
744 int enable)
745 {
746 return -ENOSYS;
747 }
748 #endif
749
750 #ifdef CONFIG_DYNAMIC_FTRACE
751 int lttng_ftrace_register(const char *name,
752 const char *symbol_name,
753 struct lttng_event *event);
754 void lttng_ftrace_unregister(struct lttng_event *event);
755 void lttng_ftrace_destroy_private(struct lttng_event *event);
756 #else
757 static inline
758 int lttng_ftrace_register(const char *name,
759 const char *symbol_name,
760 struct lttng_event *event)
761 {
762 return -ENOSYS;
763 }
764
765 static inline
766 void lttng_ftrace_unregister(struct lttng_event *event)
767 {
768 }
769
770 static inline
771 void lttng_ftrace_destroy_private(struct lttng_event *event)
772 {
773 }
774 #endif
775
776 int lttng_calibrate(struct lttng_kernel_calibrate *calibrate);
777
778 extern const struct file_operations lttng_tracepoint_list_fops;
779 extern const struct file_operations lttng_syscall_list_fops;
780
781 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
782 #define TRACEPOINT_HAS_DATA_ARG
783 #endif
784
785 #endif /* _LTTNG_EVENTS_H */
This page took 0.046317 seconds and 4 git commands to generate.