Use compiler-agnostic defines to silence warning
[lttng-tools.git] / include / lttng / event.h
CommitLineData
1239a312 1/*
ab5be9fa
MJ
2 * Copyright (C) 2014 David Goulet <dgoulet@efficios.com>
3 * Copyright (C) 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
1239a312 4 *
ab5be9fa 5 * SPDX-License-Identifier: LGPL-2.1-only
1239a312 6 *
1239a312
DG
7 */
8
9#ifndef LTTNG_EVENT_H
10#define LTTNG_EVENT_H
11
048f01ef
PP
12#ifdef __cplusplus
13extern "C" {
14#endif
15
4bd69c5f
SM
16#include <lttng/handle.h>
17#include <lttng/lttng-export.h>
18#include <lttng/userspace-probe.h>
19
048f01ef
PP
20/*!
21@brief
22 \ref api-rer-conds-inst-pt-type "Instrumentation type condition"
23 of a recording event
1239a312 24
048f01ef
PP
25@ingroup api_rer
26*/
1239a312 27enum lttng_event_type {
048f01ef 28 /// Match LTTng kernel tracepoint and Linux system call events.
28f23191 29 LTTNG_EVENT_ALL = -1,
048f01ef
PP
30
31 /// Match LTTng tracepoint or Java/Python logging events.
28f23191 32 LTTNG_EVENT_TRACEPOINT = 0,
048f01ef
PP
33
34 /*!
35 Match Linux
36 <a href="https://www.kernel.org/doc/html/latest/trace/kprobes.html">kprobe</a>
37 events.
38 */
28f23191 39 LTTNG_EVENT_PROBE = 1,
048f01ef
PP
40
41 /*!
42 Match Linux
43 <a href="https://www.kernel.org/doc/html/latest/trace/kprobes.html">kretprobe</a>
44 events.
45 */
28f23191 46 LTTNG_EVENT_FUNCTION = 2,
048f01ef
PP
47
48 /// @cond UNUSED
28f23191
JG
49 LTTNG_EVENT_FUNCTION_ENTRY = 3,
50 LTTNG_EVENT_NOOP = 4,
048f01ef
PP
51 /// @endcond
52
53 /// Match Linux system call events.
28f23191 54 LTTNG_EVENT_SYSCALL = 5,
048f01ef
PP
55
56 /*!
57 Match Linux
58 <a href="https://lwn.net/Articles/499190/">uprobe</a>
59 events.
60 */
28f23191 61 LTTNG_EVENT_USERSPACE_PROBE = 6,
1239a312
DG
62};
63
048f01ef
PP
64/*!
65@brief
66 Operand of the
67 \ref api-rer-conds-ll "instrumentation point log level condition"
68 of a recording event rule.
69
70@ingroup api_rer
71
72In the enumerator descriptions below, consider that \lt_var{LL} is the
73log level value of the condition, that is, the value of the
74lttng_event::loglevel member when the lttng_event::loglevel_type member
75is the described enumerator.
76
77Depending on the \lt_obj_domain of the recording event rule, \lt_var{LL}
78is one of the enumerators of #lttng_loglevel, #lttng_loglevel_jul,
79#lttng_loglevel_log4j, or #lttng_loglevel_python.
80*/
1239a312 81enum lttng_loglevel_type {
048f01ef 82 /// Match events regardless of their log level.
28f23191 83 LTTNG_EVENT_LOGLEVEL_ALL = 0,
048f01ef
PP
84
85 /*!
86 Match events with a log level that's at least as severe as
87 \lt_var{LL}.
88 */
28f23191 89 LTTNG_EVENT_LOGLEVEL_RANGE = 1,
048f01ef
PP
90
91 /// Match events with a log level that's exacty \lt_var{LL}.
28f23191 92 LTTNG_EVENT_LOGLEVEL_SINGLE = 2,
1239a312
DG
93};
94
048f01ef
PP
95/*!
96@brief
97 Value of the
98 \ref api-rer-conds-ll "instrumentation point log level condition"=
99 of an LTTng
100 \link #LTTNG_DOMAIN_UST user space\endlink tracepoint
101 recording event rule.
102
103@ingroup api_rer
104
105@sa #lttng_loglevel_type --
106 Operand of the log level condition of a recording event rule.
107*/
1239a312 108enum lttng_loglevel {
048f01ef 109 /// System is unusable.
28f23191 110 LTTNG_LOGLEVEL_EMERG = 0,
048f01ef
PP
111
112 /// Action must be taken immediately.
28f23191 113 LTTNG_LOGLEVEL_ALERT = 1,
048f01ef
PP
114
115 /// Critical conditions.
28f23191 116 LTTNG_LOGLEVEL_CRIT = 2,
048f01ef
PP
117
118 /// Error conditions.
28f23191 119 LTTNG_LOGLEVEL_ERR = 3,
048f01ef
PP
120
121 /// Warning conditions.
28f23191 122 LTTNG_LOGLEVEL_WARNING = 4,
048f01ef
PP
123
124 /// Normal, but significant, condition.
28f23191 125 LTTNG_LOGLEVEL_NOTICE = 5,
048f01ef
PP
126
127 /// Informational message.
28f23191 128 LTTNG_LOGLEVEL_INFO = 6,
048f01ef
PP
129
130 /// Debug information with system-level scope (set of programs).
28f23191 131 LTTNG_LOGLEVEL_DEBUG_SYSTEM = 7,
048f01ef
PP
132
133 /// Debug information with program-level scope (set of processes).
28f23191 134 LTTNG_LOGLEVEL_DEBUG_PROGRAM = 8,
048f01ef
PP
135
136 /// Debug information with process-level scope (set of modules).
28f23191 137 LTTNG_LOGLEVEL_DEBUG_PROCESS = 9,
048f01ef
PP
138
139 /*!
140 Debug information with module (executable/library) scope
141 (set of units).
142 */
28f23191 143 LTTNG_LOGLEVEL_DEBUG_MODULE = 10,
048f01ef
PP
144
145 /// Debug information with compilation unit scope (set of functions).
28f23191 146 LTTNG_LOGLEVEL_DEBUG_UNIT = 11,
048f01ef
PP
147
148 /// Debug information with function-level scope.
28f23191 149 LTTNG_LOGLEVEL_DEBUG_FUNCTION = 12,
048f01ef
PP
150
151 /// Debug information with line-level scope.
28f23191 152 LTTNG_LOGLEVEL_DEBUG_LINE = 13,
048f01ef
PP
153
154 /// Debug-level message.
28f23191 155 LTTNG_LOGLEVEL_DEBUG = 14,
1239a312
DG
156};
157
048f01ef
PP
158/*!
159@brief
160 Value of the
161 \ref api-rer-conds-ll "instrumentation point log level condition"
162 of a
163 \link #LTTNG_DOMAIN_JUL <code>java.util.logging</code>\endlink
164 recording event rule.
165
166@ingroup api_rer
167
168@sa #lttng_loglevel_type --
169 Operand of the log level condition of a recording event rule.
170*/
1239a312 171enum lttng_loglevel_jul {
048f01ef 172 /// Logging turned off.
28f23191 173 LTTNG_LOGLEVEL_JUL_OFF = INT32_MAX,
048f01ef
PP
174
175 /// Serious failure.
28f23191 176 LTTNG_LOGLEVEL_JUL_SEVERE = 1000,
048f01ef
PP
177
178 /// Potential problem.
28f23191 179 LTTNG_LOGLEVEL_JUL_WARNING = 900,
048f01ef
PP
180
181 /// Informational messages.
28f23191 182 LTTNG_LOGLEVEL_JUL_INFO = 800,
048f01ef
PP
183
184 /// Static configuration messages.
28f23191 185 LTTNG_LOGLEVEL_JUL_CONFIG = 700,
048f01ef
PP
186
187 /// Tracing information.
28f23191 188 LTTNG_LOGLEVEL_JUL_FINE = 500,
048f01ef
PP
189
190 /// Fairly detailed tracing message.
28f23191 191 LTTNG_LOGLEVEL_JUL_FINER = 400,
048f01ef
PP
192
193 /// Highly detailed tracing message.
28f23191 194 LTTNG_LOGLEVEL_JUL_FINEST = 300,
048f01ef
PP
195
196 /// All messages.
28f23191 197 LTTNG_LOGLEVEL_JUL_ALL = INT32_MIN,
1239a312
DG
198};
199
048f01ef
PP
200/*!
201@brief
202 Value of the
203 \ref api-rer-conds-ll "instrumentation point log level condition"
204 of an
47abf22b 205 \link #LTTNG_DOMAIN_LOG4J Apache Log4j 1.x\endlink
048f01ef
PP
206 recording event rule.
207
208@ingroup api_rer
209
210@sa #lttng_loglevel_type --
211 Operand of the log level condition of a recording event rule.
212*/
5cdb6027 213enum lttng_loglevel_log4j {
048f01ef 214 /// Logging turned off.
28f23191 215 LTTNG_LOGLEVEL_LOG4J_OFF = INT32_MAX,
048f01ef
PP
216
217 /*!
218 Very severe error events that will presumably lead the
219 application to abort.
220 */
28f23191 221 LTTNG_LOGLEVEL_LOG4J_FATAL = 50000,
048f01ef
PP
222
223 /*!
224 Error events that might still allow the application to continue
225 running.
226 */
28f23191 227 LTTNG_LOGLEVEL_LOG4J_ERROR = 40000,
048f01ef
PP
228
229 /// Potentially harmful situations.
28f23191 230 LTTNG_LOGLEVEL_LOG4J_WARN = 30000,
048f01ef
PP
231
232 /*!
233 Informational messages that highlight the progress of the
234 application at coarse-grained level.
235 */
28f23191 236 LTTNG_LOGLEVEL_LOG4J_INFO = 20000,
048f01ef
PP
237
238 /*!
239 Fine-grained informational events that are most useful to debug
240 an application.
241 */
28f23191 242 LTTNG_LOGLEVEL_LOG4J_DEBUG = 10000,
048f01ef
PP
243
244 /*!
245 Finer-grained informational events than the
246 #LTTNG_LOGLEVEL_LOG4J_DEBUG level.
247 */
28f23191 248 LTTNG_LOGLEVEL_LOG4J_TRACE = 5000,
048f01ef
PP
249
250 /// All levels, including custom levels.
28f23191 251 LTTNG_LOGLEVEL_LOG4J_ALL = INT32_MIN,
5cdb6027
DG
252};
253
47abf22b
MJ
254/*!
255@brief
256 Value of the
257 \ref api-rer-conds-ll "instrumentation point log level condition"
258 of a
259 \link #LTTNG_DOMAIN_LOG4J2 Apache Log4j 2\endlink
260 recording event rule.
261
262@ingroup api_rer
263
264@sa #lttng_loglevel_type --
265 Operand of the log level condition of a recording event rule.
266*/
267enum lttng_loglevel_log4j2 {
268 /// Logging turned off.
269 LTTNG_LOGLEVEL_LOG4J2_OFF = 0,
270
271 /*!
272 Very severe error events that will presumably lead the
273 application to abort.
274 */
275 LTTNG_LOGLEVEL_LOG4J2_FATAL = 100,
276
277 /*!
278 Error events that might still allow the application to continue
279 running.
280 */
281 LTTNG_LOGLEVEL_LOG4J2_ERROR = 200,
282
283 /// Potentially harmful situations.
284 LTTNG_LOGLEVEL_LOG4J2_WARN = 300,
285
286 /*!
287 Informational messages that highlight the progress of the
288 application at coarse-grained level.
289 */
290 LTTNG_LOGLEVEL_LOG4J2_INFO = 400,
291
292 /*!
293 Fine-grained informational events that are most useful to debug
294 an application.
295 */
296 LTTNG_LOGLEVEL_LOG4J2_DEBUG = 500,
297
298 /*!
299 Finer-grained informational events than the
300 #LTTNG_LOGLEVEL_LOG4J2_DEBUG level.
301 */
302 LTTNG_LOGLEVEL_LOG4J2_TRACE = 600,
303
304 /// All levels, including custom levels.
305 LTTNG_LOGLEVEL_LOG4J2_ALL = INT32_MAX,
306};
307
048f01ef
PP
308/*!
309@brief
310 Value of the
311 \ref api-rer-conds-ll "instrumentation point log level condition"
312 of a
313 \link #LTTNG_DOMAIN_PYTHON Python\endlink
314 recording event rule.
315
316@ingroup api_rer
317
318@sa #lttng_loglevel_type --
319 Operand of the log level condition of a recording event rule.
320*/
0e115563 321enum lttng_loglevel_python {
048f01ef 322 /// Critical.
28f23191 323 LTTNG_LOGLEVEL_PYTHON_CRITICAL = 50,
048f01ef
PP
324
325 /// Error.
28f23191 326 LTTNG_LOGLEVEL_PYTHON_ERROR = 40,
048f01ef
PP
327
328 /// Warning.
28f23191 329 LTTNG_LOGLEVEL_PYTHON_WARNING = 30,
048f01ef
PP
330
331 /// Information.
28f23191 332 LTTNG_LOGLEVEL_PYTHON_INFO = 20,
048f01ef
PP
333
334 /// Debugging.
28f23191 335 LTTNG_LOGLEVEL_PYTHON_DEBUG = 10,
048f01ef
PP
336
337 /// Logging turned off.
28f23191 338 LTTNG_LOGLEVEL_PYTHON_NOTSET = 0,
0e115563
DG
339};
340
048f01ef
PP
341/*!
342@brief
343 Channel output type.
344
345@ingroup api_channel
346*/
1239a312 347enum lttng_event_output {
048f01ef 348 /// Use the \lt_man_gen{splice,2} system call.
28f23191 349 LTTNG_EVENT_SPLICE = 0,
048f01ef
PP
350
351 /// Use the \lt_man_gen{mmap,2} system call.
28f23191 352 LTTNG_EVENT_MMAP = 1,
1239a312
DG
353};
354
048f01ef
PP
355/*!
356@brief
357 Context field type.
358
359@ingroup api_channel
360
361The following table indicates, for each enumerator, its description, for
362which \lt_obj_domain it's available, and the
363data type and the name of the resulting context field in traces.
364
365<table>
366 <tr>
367 <th>Enumerator
368 <th>Description
369 <th>Tracing domain
370 <th>Field type
371 <th>Field name
372 <tr>
373 <td>#LTTNG_EVENT_CONTEXT_PID
374 <td>Process ID
375 <td>#LTTNG_DOMAIN_KERNEL
376 <td>Integer
377 <td><code>pid</code>
378 <tr>
379 <td>#LTTNG_EVENT_CONTEXT_PROCNAME
380 <td>Process name
381 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
382 <td>String
383 <td><code>procname</code>
384 <tr>
385 <td>#LTTNG_EVENT_CONTEXT_PRIO
386 <td>Process priority
387 <td>#LTTNG_DOMAIN_KERNEL
388 <td>Integer
389 <td><code>prio</code>
390 <tr>
391 <td>#LTTNG_EVENT_CONTEXT_NICE
392 <td>Nice value of the process
393 <td>#LTTNG_DOMAIN_KERNEL
394 <td>Integer
395 <td><code>nice</code>
396 <tr>
397 <td>#LTTNG_EVENT_CONTEXT_VPID
398 <td>Virtual process ID
399 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
400 <td>Integer
401 <td><code>vpid</code>
402 <tr>
403 <td>#LTTNG_EVENT_CONTEXT_TID
404 <td>Thread ID
405 <td>#LTTNG_DOMAIN_KERNEL
406 <td>Integer
407 <td><code>tid</code>
408 <tr>
409 <td>#LTTNG_EVENT_CONTEXT_VTID
410 <td>Virtual thread ID
411 <td>#LTTNG_DOMAIN_KERNEL
412 <td>Integer
413 <td><code>vtid</code>
414 <tr>
415 <td>#LTTNG_EVENT_CONTEXT_PPID
416 <td>ID of the parent process
417 <td>#LTTNG_DOMAIN_KERNEL
418 <td>Integer
419 <td><code>ppid</code>
420 <tr>
421 <td>#LTTNG_EVENT_CONTEXT_VPPID
422 <td>Virtual ID of the parent process
423 <td>#LTTNG_DOMAIN_KERNEL
424 <td>Integer
425 <td><code>vppid</code>
426 <tr>
427 <td>#LTTNG_EVENT_CONTEXT_PTHREAD_ID
428 <td>POSIX thread ID
429 <td>#LTTNG_DOMAIN_KERNEL
430 <td>Integer
431 <td><code>pthread_id</code>
432 <tr>
433 <td>#LTTNG_EVENT_CONTEXT_HOSTNAME
434 <td>Hostname
435 <td>#LTTNG_DOMAIN_KERNEL
436 <td>String
437 <td><code>hostname</code>
438 <tr>
439 <td>#LTTNG_EVENT_CONTEXT_IP
440 <td>Instruction pointer
441 <td>#LTTNG_DOMAIN_UST
442 <td>Integer
443 <td><code>ip</code>
444 <tr>
445 <td>#LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER
446 <td>
447 Per-CPU perf counter.
448
449 If the lttng_event_context::ctx member of an #lttng_event_context
450 structure is #LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER, then the
451 lttng_event_context::lttng_event_context_u::perf_counter member
452 of lttng_event_context::u selects a specific per-CPU perf counter.
453 <td>#LTTNG_DOMAIN_KERNEL
454 <td>Integer
455 <td>Depends on the selected perf counter
456 <tr>
457 <td>#LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER
458 <td>
459 Per-thread perf counter.
460
461 If the lttng_event_context::ctx member of an #lttng_event_context
462 structure is #LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER, then the
463 lttng_event_context::lttng_event_context_u::perf_counter member
464 of lttng_event_context::u selects a specific per-thread
465 perf counter.
466 <td>#LTTNG_DOMAIN_UST
467 <td>Integer
468 <td>Depends on the selected perf counter
469 <tr>
470 <td>#LTTNG_EVENT_CONTEXT_APP_CONTEXT
471 <td>
472 Application-specific context.
473
474 If the lttng_event_context::ctx member of an #lttng_event_context
475 structure is #LTTNG_EVENT_CONTEXT_APP_CONTEXT, then the
476 lttng_event_context::lttng_event_context_u::app_ctx member of
477 of lttng_event_context::u selects
478 a specific application-specific context.
479 <td>#LTTNG_DOMAIN_JUL or #LTTNG_DOMAIN_LOG4J
480 <td>Integer or string
481 <td>Depends on the selected application-specific context
482 <tr>
483 <td>#LTTNG_EVENT_CONTEXT_INTERRUPTIBLE
484 <td>Whether or not the process is interruptible
485 <td>#LTTNG_DOMAIN_KERNEL
486 <td>Integer (0 or 1)
487 <td><code>interruptible</code>
488 <tr>
489 <td>#LTTNG_EVENT_CONTEXT_PREEMPTIBLE
490 <td>Whether or not the process is preemptible
491 <td>#LTTNG_DOMAIN_KERNEL
492 <td>Integer (0 or 1)
493 <td><code>preemptible</code>
494 <tr>
495 <td>#LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE
496 <td>Whether or not the process needs a reschedule
497 <td>#LTTNG_DOMAIN_KERNEL
498 <td>Integer (0 or 1)
499 <td><code>need_reschedule</code>
500 <tr>
501 <td>#LTTNG_EVENT_CONTEXT_MIGRATABLE
502 <td>Whether or not the process is migratable
503 <td>#LTTNG_DOMAIN_KERNEL
504 <td>Integer (0 or 1)
505 <td><code>migratable</code>
506 <tr>
507 <td>#LTTNG_EVENT_CONTEXT_CALLSTACK_KERNEL
508 <td>Linux kernel call stack
509 <td>#LTTNG_DOMAIN_KERNEL
510 <td>Dynamic-length array of integers (instruction pointers)
511 <td><code>callstack_kernel</code>
512 <tr>
513 <td>#LTTNG_EVENT_CONTEXT_CALLSTACK_USER
514 <td>
515 User space call stack.
516
517 Only supported on IA-32 and x86-64 architectures.
518 <td>#LTTNG_DOMAIN_KERNEL
519 <td>Dynamic-length array of integers (instruction pointers)
520 <td><code>callstack_user</code>
521 <tr>
522 <td>#LTTNG_EVENT_CONTEXT_CGROUP_NS
523 <td>
524 Control group root directory namespace ID.
525
526 @sa \lt_man_gen{cgroup_namespaces,7}
527 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
528 <td>Integer
529 <td><code>cgroup_ns</code>
530 <tr>
531 <td>#LTTNG_EVENT_CONTEXT_IPC_NS
532 <td>
533 System&nbsp;V IPC and POSIX message queue namespace ID.
534
535 @sa \lt_man_gen{ipc_namespaces,7}
536 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
537 <td>Integer
538 <td><code>ipc_ns</code>
539 <tr>
540 <td>#LTTNG_EVENT_CONTEXT_MNT_NS
541 <td>
542 Mount point namespace ID.
543
544 @sa \lt_man_gen{mount_namespaces,7}
545 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
546 <td>Integer
547 <td><code>mnt_ns</code>
548 <tr>
549 <td>#LTTNG_EVENT_CONTEXT_NET_NS
550 <td>
551 Networking namespace ID.
552
553 @sa \lt_man_gen{network_namespaces,7}
554 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
555 <td>Integer
556 <td><code>net_ns</code>
557 <tr>
558 <td>#LTTNG_EVENT_CONTEXT_PID_NS
559 <td>
560 Process ID namespace ID.
561
562 @sa \lt_man_gen{pid_namespaces,7}
563 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
564 <td>Integer
565 <td><code>pid_ns</code>
566 <tr>
567 <td>#LTTNG_EVENT_CONTEXT_USER_NS
568 <td>
569 User and group ID namespace ID.
570
571 @sa \lt_man_gen{user_namespaces,7}
572 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
573 <td>Integer
574 <td><code>user_ns</code>
575 <tr>
576 <td>#LTTNG_EVENT_CONTEXT_UTS_NS
577 <td>
578 Hostname and NIS domain name namespace ID.
579
580 @sa \lt_man_gen{uts_namespaces,7}
581 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
582 <td>Integer
583 <td><code>uts_ns</code>
584 <tr>
585 <td>#LTTNG_EVENT_CONTEXT_TIME_NS
586 <td>
587 Boot and monotonic clock namespace ID.
588
589 @sa \lt_man_gen{time_namespaces,7}
590 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
591 <td>Integer
592 <td><code>time_ns</code>
593 <tr>
594 <td>#LTTNG_EVENT_CONTEXT_UID
595 <td>User ID
596 <td>#LTTNG_DOMAIN_KERNEL
597 <td>Integer
598 <td><code>uid</code>
599 <tr>
600 <td>#LTTNG_EVENT_CONTEXT_EUID
601 <td>Effective user ID
602 <td>#LTTNG_DOMAIN_KERNEL
603 <td>Integer
604 <td><code>euid</code>
605 <tr>
606 <td>#LTTNG_EVENT_CONTEXT_SUID
607 <td>Set owner user ID
608 <td>#LTTNG_DOMAIN_KERNEL
609 <td>Integer
610 <td><code>suid</code>
611 <tr>
612 <td>#LTTNG_EVENT_CONTEXT_GID
613 <td>Group ID
614 <td>#LTTNG_DOMAIN_KERNEL
615 <td>Integer
616 <td><code>gid</code>
617 <tr>
618 <td>#LTTNG_EVENT_CONTEXT_EGID
619 <td>Effective group ID
620 <td>#LTTNG_DOMAIN_KERNEL
621 <td>Integer
622 <td><code>egid</code>
623 <tr>
624 <td>#LTTNG_EVENT_CONTEXT_SGID
625 <td>Set owner group ID
626 <td>#LTTNG_DOMAIN_KERNEL
627 <td>Integer
628 <td><code>sgid</code>
629 <tr>
630 <td>#LTTNG_EVENT_CONTEXT_VUID
631 <td>Virtual user ID
632 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
633 <td>Integer
634 <td><code>vuid</code>
635 <tr>
636 <td>#LTTNG_EVENT_CONTEXT_VEUID
637 <td>Virtual effective user ID
638 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
639 <td>Integer
640 <td><code>veuid</code>
641 <tr>
642 <td>#LTTNG_EVENT_CONTEXT_VSUID
643 <td>Virtual set owner user ID
644 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
645 <td>Integer
646 <td><code>vsuid</code>
647 <tr>
648 <td>#LTTNG_EVENT_CONTEXT_VGID
649 <td>Virtual group ID
650 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
651 <td>Integer
652 <td><code>vgid</code>
653 <tr>
654 <td>#LTTNG_EVENT_CONTEXT_VEGID
655 <td>Virtual effective group ID
656 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
657 <td>Integer
658 <td><code>vegid</code>
659 <tr>
660 <td>#LTTNG_EVENT_CONTEXT_VSGID
661 <td>Virtual set owner group ID
662 <td>#LTTNG_DOMAIN_KERNEL and #LTTNG_DOMAIN_UST
663 <td>Integer
664 <td><code>vsgid</code>
665</table>
666
667@ingroup api_channel
668*/
1239a312 669enum lttng_event_context_type {
048f01ef 670 /// Process ID.
28f23191 671 LTTNG_EVENT_CONTEXT_PID = 0,
048f01ef
PP
672
673 /// @cond BACKWARD_COMPAT_EVENT_CTX_TYPES
28f23191 674 LTTNG_EVENT_CONTEXT_PERF_COUNTER = 1, /* Backward compat. */
048f01ef
PP
675 /// @endcond
676
677 /// Process name.
28f23191 678 LTTNG_EVENT_CONTEXT_PROCNAME = 2,
048f01ef
PP
679
680 /// Process priority.
28f23191 681 LTTNG_EVENT_CONTEXT_PRIO = 3,
048f01ef
PP
682
683 /// Nice value of the process.
28f23191 684 LTTNG_EVENT_CONTEXT_NICE = 4,
048f01ef
PP
685
686 /// Virtual process ID.
28f23191 687 LTTNG_EVENT_CONTEXT_VPID = 5,
048f01ef
PP
688
689 /// Thread ID.
28f23191 690 LTTNG_EVENT_CONTEXT_TID = 6,
048f01ef
PP
691
692 /// Virtual thread ID.
28f23191 693 LTTNG_EVENT_CONTEXT_VTID = 7,
048f01ef
PP
694
695 /// ID of the parent process.
28f23191 696 LTTNG_EVENT_CONTEXT_PPID = 8,
048f01ef
PP
697
698 /// Virtual ID of the parent process.
28f23191 699 LTTNG_EVENT_CONTEXT_VPPID = 9,
048f01ef
PP
700
701 /// POSIX thread ID.
28f23191 702 LTTNG_EVENT_CONTEXT_PTHREAD_ID = 10,
048f01ef
PP
703
704 /// Hostname.
28f23191 705 LTTNG_EVENT_CONTEXT_HOSTNAME = 11,
048f01ef
PP
706
707 /// Instruction pointer.
28f23191 708 LTTNG_EVENT_CONTEXT_IP = 12,
048f01ef
PP
709
710 /// Per-CPU perf counter.
28f23191 711 LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER = 13,
048f01ef
PP
712
713 /// Per-thread perf counter.
1239a312 714 LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER = 14,
048f01ef
PP
715
716 /// Application-specific context.
28f23191 717 LTTNG_EVENT_CONTEXT_APP_CONTEXT = 15,
048f01ef
PP
718
719 /// Whether or not the process is interruptible.
28f23191 720 LTTNG_EVENT_CONTEXT_INTERRUPTIBLE = 16,
048f01ef
PP
721
722 /// Whether or not the process is preemptible.
28f23191 723 LTTNG_EVENT_CONTEXT_PREEMPTIBLE = 17,
048f01ef
PP
724
725 /// Whether or not the process needs a reschedule.
28f23191 726 LTTNG_EVENT_CONTEXT_NEED_RESCHEDULE = 18,
048f01ef
PP
727
728 /// Whether or not the process is migratable.
28f23191 729 LTTNG_EVENT_CONTEXT_MIGRATABLE = 19,
048f01ef
PP
730
731 /// Linux kernel call stack.
28f23191 732 LTTNG_EVENT_CONTEXT_CALLSTACK_KERNEL = 20,
048f01ef
PP
733
734 /// User space call stack.
735 LTTNG_EVENT_CONTEXT_CALLSTACK_USER = 21,
736
737 /// Control group root directory namespace ID.
28f23191 738 LTTNG_EVENT_CONTEXT_CGROUP_NS = 22,
048f01ef
PP
739
740 /// System&nbsp;V IPC and POSIX message queue namespace ID.
28f23191 741 LTTNG_EVENT_CONTEXT_IPC_NS = 23,
048f01ef
PP
742
743 /// Mount point namespace ID.
28f23191 744 LTTNG_EVENT_CONTEXT_MNT_NS = 24,
048f01ef
PP
745
746 /// Networking namespace ID.
28f23191 747 LTTNG_EVENT_CONTEXT_NET_NS = 25,
048f01ef
PP
748
749 /// Process ID namespace ID.
28f23191 750 LTTNG_EVENT_CONTEXT_PID_NS = 26,
048f01ef
PP
751
752 /// User and group ID namespace ID.
28f23191 753 LTTNG_EVENT_CONTEXT_USER_NS = 27,
048f01ef
PP
754
755 /// Hostname and NIS domain name namespace ID.
28f23191 756 LTTNG_EVENT_CONTEXT_UTS_NS = 28,
048f01ef
PP
757
758 /// User ID namespace ID.
28f23191 759 LTTNG_EVENT_CONTEXT_UID = 29,
048f01ef
PP
760
761 /// Effective user ID namespace ID.
28f23191 762 LTTNG_EVENT_CONTEXT_EUID = 30,
048f01ef
PP
763
764 /// Set owner user ID namespace ID.
28f23191 765 LTTNG_EVENT_CONTEXT_SUID = 31,
048f01ef
PP
766
767 /// Group ID namespace ID.
28f23191 768 LTTNG_EVENT_CONTEXT_GID = 32,
048f01ef
PP
769
770 /// Effective group ID namespace ID.
28f23191 771 LTTNG_EVENT_CONTEXT_EGID = 33,
048f01ef
PP
772
773 /// Set owner group ID namespace ID.
28f23191 774 LTTNG_EVENT_CONTEXT_SGID = 34,
048f01ef
PP
775
776 /// Virtual user ID namespace ID.
28f23191 777 LTTNG_EVENT_CONTEXT_VUID = 35,
048f01ef
PP
778
779 /// Virtual effective user ID namespace ID.
28f23191 780 LTTNG_EVENT_CONTEXT_VEUID = 36,
048f01ef
PP
781
782 /// Virtual set owner user ID namespace ID.
28f23191 783 LTTNG_EVENT_CONTEXT_VSUID = 37,
048f01ef
PP
784
785 /// Virtual group ID namespace ID.
28f23191 786 LTTNG_EVENT_CONTEXT_VGID = 38,
048f01ef
PP
787
788 /// Virtual effective group ID namespace ID.
28f23191 789 LTTNG_EVENT_CONTEXT_VEGID = 39,
048f01ef
PP
790
791 /// Virtual set owner group ID namespace ID.
28f23191 792 LTTNG_EVENT_CONTEXT_VSGID = 40,
048f01ef
PP
793
794 /// Boot and monotonic clock namespace ID.
28f23191 795 LTTNG_EVENT_CONTEXT_TIME_NS = 41,
1239a312
DG
796};
797
048f01ef
PP
798/*!
799@brief
800 LTTng tracepoint field data type
801 (type of the lttng_event_field::type member).
802
803@ingroup api_inst_pt
804*/
1239a312 805enum lttng_event_field_type {
048f01ef 806 /// Other/unknown.
28f23191 807 LTTNG_EVENT_FIELD_OTHER = 0,
048f01ef
PP
808
809 /// Integer.
28f23191 810 LTTNG_EVENT_FIELD_INTEGER = 1,
048f01ef
PP
811
812 /// Enumeration.
28f23191 813 LTTNG_EVENT_FIELD_ENUM = 2,
048f01ef
PP
814
815 /// Floating point number.
28f23191 816 LTTNG_EVENT_FIELD_FLOAT = 3,
048f01ef
PP
817
818 /// String.
28f23191 819 LTTNG_EVENT_FIELD_STRING = 4,
1239a312
DG
820};
821
048f01ef
PP
822/*!
823@brief
824 \ref api-rer-inst-pt-descr "Instrumentation point descriptor"
825 flag (type of the lttng_event::flags member).
826
827@ingroup api_inst_pt
828*/
834978fd 829enum lttng_event_flag {
048f01ef
PP
830 /*!
831 @brief
832 32-bit Linux system call.
833
834 Only valid when the lttng_event::type member is
835 #LTTNG_EVENT_SYSCALL.
836 */
28f23191 837 LTTNG_EVENT_FLAG_SYSCALL_32 = (1U << 0),
048f01ef
PP
838
839 /*!
840 @brief
841 64-bit Linux system call.
842
843 Only valid when the lttng_event::type member is
844 #LTTNG_EVENT_SYSCALL.
845 */
28f23191 846 LTTNG_EVENT_FLAG_SYSCALL_64 = (1U << 1),
834978fd
DG
847};
848
28f23191 849#define LTTNG_PERF_EVENT_PADDING1 16
048f01ef
PP
850
851/*!
852@brief
853 perf counter context field descriptor.
854
855@ingroup api_channel
856
857If the lttng_event_context::ctx member of an #lttng_event_context
858structure is #LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER or
859#LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER, then the
860lttng_event_context::lttng_event_context_u::perf_counter member
861of lttng_event_context::u selects a specific perf counter.
862
863You must initialize such a structure to zeros before setting its members
864and using it, for example:
865
866@code
867struct lttng_event_perf_counter_ctx perf_counter_ctx;
868
869memset(&perf_counter_ctx, 0, sizeof(perf_counter_ctx));
870@endcode
871*/
1239a312 872struct lttng_event_perf_counter_ctx {
048f01ef
PP
873 /*!
874 @brief
875 perf counter type ID.
876
877 One of:
878
879 <table>
880 <tr>
881 <th>Type
882 <th>ID
883 <tr>
884 <td>Hardware counter
885 <td>0
886 <tr>
887 <td>Software counter
888 <td>1
889 <tr>
890 <td>Hardware cache counter
891 <td>3
892 <tr>
893 <td>Performance Monitoring Unit (PMU) counter
894 <td>4
895 </table>
896 */
1239a312 897 uint32_t type;
048f01ef
PP
898
899 /*!
900 @brief
901 perf counter configuration.
902
903 Depending on the lttng_event_perf_counter_ctx::type member:
904
905 <dl>
906 <dt>0 (hardware counter)
907 <dd>
908 One of:
909
910 <table>
911 <tr>
912 <th>Counter
913 <th>ID
914 <tr>
915 <td>CPU cycles
916 <td>0
917 <tr>
918 <td>Instructions
919 <td>1
920 <tr>
921 <td>Cache references
922 <td>2
923 <tr>
924 <td>Cache misses
925 <td>3
926 <tr>
927 <td>Branch instructions
928 <td>4
929 <tr>
930 <td>Branch misses
931 <td>5
932 <tr>
933 <td>Bus cycles
934 <td>6
935 <tr>
936 <td>Stalled cycles (front end)
937 <td>7
938 <tr>
939 <td>Stalled cycles (back end)
940 <td>8
941 </table>
942
943 <dt>1 (software counter)
944 <dd>
945 One of:
946
947 <table>
948 <tr>
949 <th>Counter
950 <th>ID
951 <tr>
952 <td>CPU clock
953 <td>0
954 <tr>
955 <td>Task clock
956 <td>1
957 <tr>
958 <td>Page faults
959 <td>2
960 <tr>
961 <td>Context switches
962 <td>3
963 <tr>
964 <td>CPU migrations
965 <td>4
966 <tr>
967 <td>Minor page faults
968 <td>5
969 <tr>
970 <td>Major page faults
971 <td>6
972 <tr>
973 <td>Alignment faults
974 <td>7
975 <tr>
976 <td>Emulation faults
977 <td>8
978 </table>
979
980 <dt>3 (hardware cache counter)
981 <dd>
982 The result of a bitwise OR operation between a cache ID,
983 an operation ID, and a result ID, as follows:
984
985 <table>
986 <tr>
987 <th>Cache ID
988 <th>Description
989 <tr>
990 <td>0
991 <td>Data L1
992 <tr>
993 <td>1
994 <td>Instructions L1
995 <tr>
996 <td>2
997 <td>LL
998 <tr>
999 <td>3
1000 <td>Data <a
1001 href="https://en.wikipedia.org/wiki/Translation_lookaside_buffer">TLB</a> <tr> <td>4
1002 <td>Instruction TLB
1003 <tr>
1004 <td>5
1005 <td>Branch prediction unit (BPU)
1006 </table>
1007
1008 <table>
1009 <tr>
1010 <th>Operator ID
1011 <th>Description
1012 <tr>
1013 <td>0
1014 <td>Read
1015 <tr>
1016 <td>0x100
1017 <td>Write
1018 <tr>
1019 <td>0x200
1020 <td>Prefetch
1021 </table>
1022
1023 <table>
1024 <tr>
1025 <th>Result ID
1026 <th>Description
1027 <tr>
1028 <td>0
1029 <td>Access
1030 <tr>
1031 <td>0x10000
1032 <td>Miss
1033 </table>
1034
1035 <dt>4 (PMU counter)
1036 <dd>
1037 PMU counter raw ID.
1038
1039 @sa \lt_man_gen{perf-record,1}
1040 </dl>
1041 */
1239a312 1042 uint64_t config;
048f01ef
PP
1043
1044 /// Context field name.
1239a312
DG
1045 char name[LTTNG_SYMBOL_NAME_LEN];
1046
1047 char padding[LTTNG_PERF_EVENT_PADDING1];
1048};
1049
28f23191 1050#define LTTNG_EVENT_CONTEXT_PADDING1 16
07c4863f 1051#define LTTNG_EVENT_CONTEXT_PADDING2 (LTTNG_SYMBOL_NAME_LEN + 32)
048f01ef
PP
1052
1053/*!
1054@brief
1055 Context field descriptor.
1056
1057@ingroup api_channel
1058
1059Such a structure describes a context field to be recorded within all the
1060\ref api_rer "event records" of a given \lt_obj_channel (see
1061lttng_add_context()).
1062
1063You must initialize such a structure to zeros before setting its members
1064and using it, for example:
1065
1066@code
1067struct lttng_event_context ctx;
1068
1069memset(&ctx, 0, sizeof(ctx));
1070@endcode
1071*/
1239a312 1072struct lttng_event_context {
048f01ef
PP
1073 /*!
1074 @brief
1075 Context field type.
1076
1077 Some types have a \lt_obj_domain
1078 constraint.
1079
1080 If this member has the value
1081 #LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER or
1082 #LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER, then you must also set
1083 the lttng_event_context::lttng_event_context_u::perf_counter
1084 member of lttng_event_context::u.
1085
1086 If this member has the value #LTTNG_EVENT_CONTEXT_APP_CONTEXT,
1087 then you must also set the
1088 lttng_event_context::lttng_event_context_u::app_ctx member
1089 of lttng_event_context::u.
1090 */
1239a312 1091 enum lttng_event_context_type ctx;
048f01ef 1092
1239a312
DG
1093 char padding[LTTNG_EVENT_CONTEXT_PADDING1];
1094
048f01ef
PP
1095 /*!
1096 @brief
1097 perf counter or application-specific context field
1098 descriptor.
1099
1100 @ingroup api_channel
1101 */
1102 union lttng_event_context_u {
1103 /*!
1104 @brief
1105 perf counter context field descriptor.
1106
1107 Only used when the lttng_event_context::ctx member
1108 is #LTTNG_EVENT_CONTEXT_PERF_CPU_COUNTER or
1109 #LTTNG_EVENT_CONTEXT_PERF_THREAD_COUNTER.
1110 */
1239a312 1111 struct lttng_event_perf_counter_ctx perf_counter;
048f01ef 1112
2001793c 1113 struct {
048f01ef 1114 /// Provider name.
2001793c 1115 char *provider_name;
048f01ef
PP
1116
1117 /// Field type.
2001793c 1118 char *ctx_name;
048f01ef
PP
1119 }
1120
1121 /*!
1122 @brief
1123 Application-specific context field descriptor.
1124
1125 Only used when the lttng_event_context::ctx member
1126 is #LTTNG_EVENT_CONTEXT_APP_CONTEXT.
1127 */
1128 app_ctx;
1129
1239a312 1130 char padding[LTTNG_EVENT_CONTEXT_PADDING2];
048f01ef
PP
1131 }
1132
1133 /// perf counter or application-specific context field descriptor.
1134 u;
1239a312
DG
1135};
1136
28f23191 1137#define LTTNG_EVENT_PROBE_PADDING1 16
048f01ef
PP
1138
1139/*!
1140@brief
1141 Legacy Linux kprobe/kretprobe location.
1142
1143@ingroup api_rer
1144
1145Such a structure indicates the location of a Linux kprobe/kretprobe for
1146a \lt_obj_rer having such an instrumentation point type.
1147
1148You must initialize such a structure to zeros before setting its members
1149and using it, for example:
1150
1151@code
1152struct lttng_event_probe_attr loc;
1153
1154memset(&loc, 0, sizeof(loc));
1155@endcode
1156
1157Set either lttng_event_probe_attr::addr or
1158lttng_event_probe_attr::symbol_name and lttng_event_probe_attr::offset.
1159
1160@sa \ref api-rer-conds-inst-pt-type "Instrumentation point type condition".
1161*/
1239a312 1162struct lttng_event_probe_attr {
048f01ef
PP
1163 /*!
1164 @brief
1165 kprobe/kretprobe address.
1166
1167 If this member is not 0, then
1168 lttng_event_probe_attr::symbol_name must be an empty string.
1169 */
1239a312
DG
1170 uint64_t addr;
1171
048f01ef
PP
1172 /*!
1173 @brief
1174 kprobe/kretprobe address offset from the symbol named
1175 lttng_event_probe_attr::symbol_name.
1176 */
1239a312 1177 uint64_t offset;
048f01ef
PP
1178
1179 /*!
1180 @brief
1181 kprobe/kretprobe symbol name.
1182
1183 The actual kprobe/kretprobe address is the address of the named
1184 symbol plus the value of lttng_event_probe_attr::offset.
1185
1186 If this member is not an empty string, then
1187 lttng_event_probe_attr::addr must be 0.
1188 */
1239a312
DG
1189 char symbol_name[LTTNG_SYMBOL_NAME_LEN];
1190
1191 char padding[LTTNG_EVENT_PROBE_PADDING1];
1192};
1193
1194/*
1195 * Function tracer
1196 *
1197 * The structures should be initialized to zero before use.
1198 */
28f23191 1199#define LTTNG_EVENT_FUNCTION_PADDING1 16
1239a312
DG
1200struct lttng_event_function_attr {
1201 char symbol_name[LTTNG_SYMBOL_NAME_LEN];
1202
1203 char padding[LTTNG_EVENT_FUNCTION_PADDING1];
1204};
1205
1206/*
1207 * Generic lttng event
1208 *
1209 * The structures should be initialized to zero before use.
1210 */
28f23191 1211#define LTTNG_EVENT_PADDING1 12
07c4863f 1212#define LTTNG_EVENT_PADDING2 (LTTNG_SYMBOL_NAME_LEN + 32)
048f01ef
PP
1213
1214/*!
1215@brief
1216 \lt_obj_c_rer descriptor.
1217
1218@ingroup api_rer
1219
1220Such a structure describes a recording event rule. More specifically,
1221it describes the \ref api-rer-conds "conditions" of a recording
1222event rule.
1223
1224lttng_list_events() sets a pointer to an array of all the recording
1225event rule descriptors of a given \lt_obj_channel.
1226
1227@note
1228 \anchor api-rer-inst-pt-descr lttng_list_tracepoints()
1229 and lttng_list_syscalls() also set
1230 a pointer to an array of instances of this structure. In this
1231 context, the #lttng_event structure is named
1232 \"<em>instrumentation point descriptor</em>\".
1233
1234lttng_enable_event(), lttng_enable_event_with_filter(), and
1235lttng_enable_event_with_exclusions() expect such a structure to create
1236or enable a recording event rule.
1237
1238Most properties are members of the structure itself, but the
1239following ones have their own dedicated accessors:
1240
1241<dl>
1242 <dt>
1243 Linux uprobe location (when the lttng_event::type member is
1244 #LTTNG_EVENT_USERSPACE_PROBE)
1245 <dd>
1246 - lttng_event_get_userspace_probe_location()
1247 - lttng_event_set_userspace_probe_location()
1248
1249 <dt>\ref api-rer-conds-event-name "Event name" exclusion patterns
1250 <dd>
1251 lttng_event_get_exclusion_name()
1252
1253 <dt>\ref api-rer-conds-filter "Event payload and context filter" expression
1254 <dd>
1255 lttng_event_get_filter_expression()
1256</dl>
1257
1258Create an empty recording event rule descriptor with
1259lttng_event_create().
1260
1261\anchor api-rer-valid-event-struct A \em valid #lttng_event structure
1262satisfies the following constraints:
1263
1264- If the lttng_event::type member is #LTTNG_EVENT_PROBE or
1265 #LTTNG_EVENT_FUNCTION, then the lttng_event::lttng_event_attr_u::probe
1266 member of lttng_event::attr is valid according to the
1267 documentation of #lttng_event_probe_attr.
1268
1269- If the lttng_event::type member is #LTTNG_EVENT_USERSPACE_PROBE, then
1270 the recording event rule descriptor has a Linux uprobe location
1271 (you called lttng_event_set_userspace_probe_location() on it to
1272 set it).
1273
1274Destroy a recording event rule descriptor with lttng_event_destroy().
1275*/
1239a312 1276struct lttng_event {
fe9ecacb 1277 /* Offset 0 */
048f01ef 1278 /// \ref api-rer-conds-inst-pt-type "Instrumentation point type condition".
1239a312 1279 enum lttng_event_type type;
fe9ecacb
PP
1280
1281 /* Offset 4 */
048f01ef
PP
1282 /*!
1283 @brief \ref api-rer-conds-event-name "Event name" pattern
1284 condition.
1285
1286 If empty, lttng_enable_event(),
1287 lttng_enable_event_with_filter(), and
1288 lttng_enable_event_with_exclusions() use <code>*</code> (match
1289 events with any name).
1290
1291 If the lttng_event::type member is #LTTNG_EVENT_PROBE,
1292 #LTTNG_EVENT_FUNCTION, or #LTTNG_EVENT_USERSPACE_PROBE, then
1293 this member is actually the name of the created Linux
1294 kprobe/kretprobe/uprobe instrumentation point (future event
1295 name).
1296
1297 If this structure is an
1298 \ref api-rer-inst-pt-descr "instrumentation point descriptor",
1299 then this member is the name of the LTTng tracepoint, Linux
1300 system call, or Java/Python logger.
1301 */
1239a312
DG
1302 char name[LTTNG_SYMBOL_NAME_LEN];
1303
fe9ecacb 1304 /* Offset 260 */
048f01ef
PP
1305 /*!
1306 @brief
1307 Operand of the
1308 \ref api-rer-conds-ll "instrumentation point log level condition".
1309 */
1239a312 1310 enum lttng_loglevel_type loglevel_type;
fe9ecacb
PP
1311
1312 /* Offset 264 */
048f01ef
PP
1313 /*!
1314 @brief Value of the
1315 \ref api-rer-conds-ll "instrumentation point log level condition".
1316
1317 This member must be one of the enumerators of
1318 #lttng_loglevel, #lttng_loglevel_jul, #lttng_loglevel_log4j, or
1319 #lttng_loglevel_python, depending on the
1320 \lt_obj_domain when you call lttng_enable_event(),
1321 lttng_enable_event_with_filter(), or
1322 lttng_enable_event_with_exclusions().
1323
1324 If this structure is an
1325 \ref api-rer-inst-pt-descr "instrumentation point descriptor",
1326 then this member is the log level of the LTTng tracepoint or
1327 Java/Python logger.
1328 */
1239a312
DG
1329 int loglevel;
1330
fe9ecacb 1331 /* Offset 268 */
048f01ef
PP
1332 /*!
1333 @brief
1334 1 if this recording event rule is enabled, or 0 otherwise.
1335
1336 This is a read-only member.
1337
1338 @sa lttng_enable_event() --
1339 Creates or enables a recording event rule.
1340 @sa lttng_disable_event_ext() --
1341 Disables a recording event rule.
1342 */
28f23191 1343 int32_t enabled; /* Does not apply: -1 */
fe9ecacb
PP
1344
1345 /* Offset 272 */
048f01ef
PP
1346 /*!
1347 @brief
1348 ID of the process which offers the instrumentation point
1349 described by this structure.
1350
1351 This is a read-only member.
1352
1353 This member is \em not part of a recording event rule.
1354 */
1239a312 1355 pid_t pid;
fe9ecacb
PP
1356
1357 /* Offset 276 */
048f01ef
PP
1358 /*!
1359 @brief
1360 1 if the recording event rule described by this has an
1361 \ref api-rer-conds-filter "event payload and context filter"
1362 expression, or 0 otherwise.
1363
1364 This is a read-only member: use the \lt_p{filter_expr} parameter
1365 of lttng_enable_event_with_filter() or
1366 lttng_enable_event_with_exclusions() when you create a
1367 recording event rule to set an event payload and context
1368 filter expression.
1369
1370 If this member is 1, then get the actual filter expression
1371 string with lttng_event_get_filter_expression().
1372 */
1373 unsigned char filter;
fe9ecacb
PP
1374
1375 /* Offset 277 */
048f01ef
PP
1376 /*!
1377 @brief
1378 1 if the recording event rule described by this has
1379 \ref api-rer-conds-event-name "event name" exclusion
1380 patterns (part of the event name condition), or 0 otherwise.
1381
1382 This is a read-only member: use the
1383 \lt_p{event_name_exclusion_count} and
1384 \lt_p{event_name_exclusions} parameters of
1385 lttng_enable_event_with_exclusions() when you create a recording
1386 event rule to set event name exclusion patterns.
1387
1388 If this member is 1, then get the actual event name exclusion
1389 patterns with lttng_event_get_exclusion_name_count() and
1390 lttng_event_get_exclusion_name().
1391 */
1392 unsigned char exclusion;
1239a312 1393
fe9ecacb
PP
1394 /* Offset 278 */
1395 char padding2[2];
1396
1397 /* Offset 280 */
048f01ef
PP
1398 /*!
1399 @brief
1400 \ref api-rer-inst-pt-descr "Instrumentation point descriptor"
1401 flags (bitwise OR).
1402
1403 This is a read-only member.
1404
1405 This member is \em not part of a recording event rule.
1406 */
834978fd
DG
1407 enum lttng_event_flag flags;
1408
fe9ecacb 1409 /* Offset 284 */
b4e3ceb9
PP
1410 char padding[4];
1411
1412 /* Offset 288 */
1413 union {
4829ae55 1414 uint64_t padding;
b4e3ceb9
PP
1415 void *ptr;
1416 } extended;
1239a312 1417
fe9ecacb 1418 /* Offset 296 */
048f01ef
PP
1419 /*!
1420 @brief
1421 Linux kprobe/kretprobe recording event rule configuration.
1422
1423 @ingroup api_rer
1424 */
1425 union lttng_event_attr_u {
1426 /*!
1427 @brief
1428 Linux kprobe/kretprobe location.
1429
1430 Only valid when the lttng_event::type member is
1431 #LTTNG_EVENT_PROBE or #LTTNG_EVENT_FUNCTION.
1432 */
1239a312 1433 struct lttng_event_probe_attr probe;
048f01ef 1434
1239a312
DG
1435 struct lttng_event_function_attr ftrace;
1436
1437 char padding[LTTNG_EVENT_PADDING2];
048f01ef
PP
1438 }
1439
1440 /*!
1441 @brief
1442 Linux kprobe/kretprobe recording event rule configuration.
1443
1444 Only valid when the lttng_event::type member is
1445 #LTTNG_EVENT_PROBE or #LTTNG_EVENT_FUNCTION.
1446 */
1447 attr;
1239a312
DG
1448};
1449
07c4863f 1450#define LTTNG_EVENT_FIELD_PADDING (LTTNG_SYMBOL_NAME_LEN + 32)
048f01ef
PP
1451
1452/*!
1453@brief
1454 LTTng tracepoint field description.
1455
1456@ingroup api_inst_pt
1457
1458lttng_list_tracepoint_fields() sets a pointer to an array of all the
1459tracepoint field descriptions of a given \lt_obj_domain.
1460*/
1239a312 1461struct lttng_event_field {
048f01ef 1462 /// Field name.
1239a312 1463 char field_name[LTTNG_SYMBOL_NAME_LEN];
048f01ef
PP
1464
1465 /// Field data type.
1239a312 1466 enum lttng_event_field_type type;
048f01ef 1467
1239a312 1468 char padding[LTTNG_EVENT_FIELD_PADDING];
048f01ef
PP
1469
1470 /*!
1471 @brief
1472 \ref api-rer-inst-pt-descr "Descriptor" of the tracepoint
1473 which contains this field.
1474 */
1239a312 1475 struct lttng_event event;
048f01ef
PP
1476
1477 /*!
1478 @brief
1479 0 if LTTng writes this field to an event record, or 1
1480 otherwise.
1481 */
1239a312
DG
1482 int nowrite;
1483};
1484
048f01ef
PP
1485/*!
1486@brief
1487 Sets \lt_p{*event_rules} to the descriptors of the
1488 \lt_obj_rers of the \lt_obj_channel named \lt_p{channel_name}
1489 within the recording session handle \lt_p{handle}.
1490
1491@ingroup api_channel
1492
1493@param[in] handle
1494 Recording session handle which contains the name of the
1495 recording session and the summary
1496 of the \lt_obj_domain which own the channel (named
1497 \lt_p{channel_name}) of which to get the recording event rule
1498 descriptors.
1499@param[in] channel_name
1500 Name of the channel, within \lt_p{handle}, of which to get all the
1501 recording event rule descriptors.
1502@param[out] event_rules
1503 @parblock
1504 <strong>On success</strong>, this function sets \lt_p{*event_rules}
1505 to the recording event rule descriptors.
1506
1507 Free \lt_p{*event_rules} with <code>free()</code>.
1508 @endparblock
1509
1510@returns
1511 The number of items in \lt_p{*event_rules} on success, or a
1512 \em negative #lttng_error_code enumerator otherwise.
1513
1514@lt_pre_conn
1515@lt_pre_not_null{handle}
1516@lt_pre_valid_c_str{handle->session_name}
1517@lt_pre_sess_exists{handle->session_name}
1518@pre
1519 \lt_p{handle->domain} is valid as per the documentation of
1520 #lttng_domain.
1521@lt_pre_not_null{channel_name}
1522@pre
1523 \lt_p{channel_name} names an existing channel within the recording
1524 session and tracing domain of \lt_p{handle}.
1525@lt_pre_not_null{event_rules}
1526*/
4bd69c5f 1527LTTNG_EXPORT extern int lttng_list_events(struct lttng_handle *handle,
28f23191 1528 const char *channel_name,
048f01ef 1529 struct lttng_event **event_rules);
1239a312 1530
048f01ef
PP
1531/*!
1532@brief
1533 Creates and returns an empty recording event rule descriptor.
1534
1535@ingroup api_rer
1536
1537After you create a recording event rule descriptor with this function,
1538you can modify its properties and call
1539lttng_enable_event_with_exclusions() to create and enable a recording
1540event rule.
1541
1542@returns
1543 @parblock
1544 New recording event rule descriptor.
1545
1546 Destroy the returned recording event rule descriptor with
1547 lttng_event_destroy().
1548 @endparblock
1549
1550@sa lttng_event_destroy() --
1551 Destroys a recording event rule descriptor.
1552*/
4bd69c5f 1553LTTNG_EXPORT extern struct lttng_event *lttng_event_create(void);
ef0e06bc 1554
048f01ef
PP
1555/*!
1556@brief
1557 Destroys the recording event rule descriptor \lt_p{event_rule}.
ef0e06bc 1558
048f01ef 1559@ingroup api_rer
d31d3e8c 1560
048f01ef
PP
1561@note
1562 This function doesn't destroy the recording event rule
1563 which \lt_p{event_rule} describes: you can't destroy a
1564 recording event rule.
f086e50e 1565
048f01ef
PP
1566@param[in] event_rule
1567 @parblock
1568 Recording event rule descriptor to destroy.
1569
1570 May be \c NULL.
1571 @endparblock
1572
1573@pre
1574 <strong>If not \c NULL</strong>, \lt_p{event_rule} was created with
1575 lttng_event_create().
1576
1577@sa lttng_event_create() --
1578 Creates an empty recording event rule descriptor.
1579*/
1580LTTNG_EXPORT extern void lttng_event_destroy(struct lttng_event *event_rule);
1581
1582/*!
1583@brief
1584 Sets \lt_p{*filter_expr} to the
1585 \ref api-rer-conds-filter "event payload and context filter"
1586 expression of the recording event rule described by
1587 \lt_p{event_rule}.
1588
1589@ingroup api_rer
1590
1591@param[in] event_rule
1592 Descriptor of the recording event rule of which to get the event
1593 payload and context filter expression.
1594@param[out] filter_expr
1595 @parblock
1596 <strong>On success</strong>, this function sets \lt_p{*filter_expr}
1597 to:
1598
1599 <dl>
1600 <dt>
1601 If \lt_p{event_rule} has an event payload and context filter
1602 expression
1603 <dd>
1604 The event payload and context filter
1605 expression of \lt_p{event_rule}.
1606
1607 \lt_p{*filter_expr} remains valid as long as \lt_p{event_rule}
1608 exists and you don't modify it.
1609
1610 <dt>Otherwise
1611 <dd>\c NULL
1612 </dl>
1613 @endparblock
1614
1615@returns
1616 0 on success, or a \em negative #lttng_error_code enumerator
1617 otherwise.
1618
1619@lt_pre_not_null{event_rule}
1620@lt_pre_not_null{filter_expr}
1621
1622@sa lttng_event::filter --
1623 Indicates whether or not a recording event rule has an event payload
1624 and context filter.
1625*/
1626LTTNG_EXPORT extern int lttng_event_get_filter_expression(struct lttng_event *event_rule,
1627 const char **filter_expr);
1628
1629/*!
1630@brief
1631 Returns the number of \ref api-rer-conds-event-name "event name"
1632 exclusion patterns of the recording
1633 event rule described by \lt_p{event_rule}.
1634
1635@ingroup api_rer
1636
1637@param[in] event_rule
1638 Descriptor of the recording event rule of which to get the number
1639 of event name exclusion patterns.
1640
1641@returns
1642 Number of event name exclusion patterns of \lt_p{event_rule}, or a
1643 \em negative #lttng_error_code enumerator otherwise.
1644
1645@lt_pre_not_null{event_rule}
1646
1647@sa lttng_event_get_exclusion_name() --
1648 Returns an event name exclusion pattern by index of a recording
1649 event rule.
1650@sa lttng_event::exclusion --
1651 Indicates whether or not a recording event rule has event name
1652 exclusion patterns.
1653*/
1654LTTNG_EXPORT extern int lttng_event_get_exclusion_name_count(struct lttng_event *event_rule);
1655
1656/*!
1657@brief
1658 Sets \lt_p{*event_name_exclusion} to the
1659 \ref api-rer-conds-event-name "event name" exclusion
1660 pattern at index \lt_p{index} of the recording event rule described
1661 by \lt_p{event_rule}.
1662
1663@ingroup api_rer
1664
1665@param[in] event_rule
1666 Descriptor of the recording event rule of which to get the event
1667 name exclusion pattern at index \lt_p{index}.
1668@param[in] index
1669 Index of the event name exclusion pattern to get from
1670 \lt_p{event_rule}.
1671@param[out] event_name_exclusion
1672 @parblock
1673 <strong>On success</strong>, this function sets
1674 \lt_p{*event_name_exclusion} to the event name exclusion pattern at
1675 index \lt_p{index} of
1676 \lt_p{event_rule}.
1677
1678 \lt_p{*event_name_exclusion} remains valis as long as
1679 \lt_p{event_rule} exists and you don't modify it.
1680 @endparblock
1681
1682@returns
1683 0 on success, or a \em negative #lttng_error_code enumerator
1684 otherwise.
1685
1686@lt_pre_not_null{event_rule}
1687@pre
1688 \lt_p{index} is less than the number of event name exclusion
1689 patterns (as returned by lttng_event_get_exclusion_name_count())
1690 of \lt_p{event_rule}.
1691@lt_pre_not_null{event_name_exclusion}
1692
1693@sa lttng_event_get_exclusion_name_count() --
1694 Returns the number of event name exclusion patterns of a recording
1695 event rule.
1696*/
1697LTTNG_EXPORT extern int lttng_event_get_exclusion_name(struct lttng_event *event_rule,
28f23191 1698 size_t index,
048f01ef 1699 const char **event_name_exclusion);
f086e50e 1700
048f01ef
PP
1701/*!
1702@brief
1703 Returns the Linux uprobe location of the recording event rule
1704 described by \lt_p{event_rule}.
1705
1706@ingroup api_rer
1707
1708@param[in] event_rule
1709 Descriptor of the recording event rule of which to get the
1710 Linux uprobe location.
1711
1712@returns
1713 @parblock
1714 Linux uprobe location of the recording event rule described by
1715 \lt_p{event_rule}, or \c NULL if none.
1716
1717 The returned location remains valid as long as \lt_p{event_rule}
1718 exists and you don't modify it.
1719 @endparblock
1720
1721@lt_pre_not_null{event_rule}
1722@pre
1723 \lt_p{event_rule->type} (see lttng_event::type) is
1724 #LTTNG_EVENT_USERSPACE_PROBE.
1725
1726@sa lttng_event_set_userspace_probe_location() --
1727 Sets the Linux uprobe location of a recording event rule.
1728@sa \ref api-rer-conds-inst-pt-type "Instrumentation point type condition".
1729*/
4bd69c5f 1730LTTNG_EXPORT extern const struct lttng_userspace_probe_location *
048f01ef 1731lttng_event_get_userspace_probe_location(const struct lttng_event *event_rule);
ef0e06bc 1732
048f01ef
PP
1733/*!
1734@brief
1735 Sets the Linux uprobe location of the recording event rule described
1736 by \lt_p{event_rule} to \lt_p{location}.
1737
1738@ingroup api_rer
1739
1740@param[in] event_rule
1741 Descriptor of the recording event rule of which to set the
1742 Linux uprobe location to \lt_p{location}.
1743@param[in] location
1744 New Linux uprobe location of \lt_p{event_rule}.
1745
1746@returns
1747 0 on success, or a \em negative #lttng_error_code enumerator
1748 otherwise.
1749
1750@lt_pre_not_null{event_rule}
1751@pre
1752 \lt_p{event_rule} was created with lttng_event_create().
1753@pre
1754 \lt_p{event_rule->type} (see lttng_event::type) is
1755 #LTTNG_EVENT_USERSPACE_PROBE.
1756@lt_pre_not_null{location}
1757
1758@post
1759 <strong>On success</strong>, \lt_p{*location} is invalid
1760 (its ownership is transfered to \lt_p{event_rule}).
1761
1762@sa lttng_event_get_userspace_probe_location() --
1763 Returns the Linux uprobe location of a recording event rule.
1764@sa \ref api-rer-conds-inst-pt-type "Instrumentation point type condition".
1765*/
28f23191 1766LTTNG_EXPORT extern int
048f01ef
PP
1767lttng_event_set_userspace_probe_location(struct lttng_event *event_rule,
1768 struct lttng_userspace_probe_location *location);
ef0e06bc 1769
048f01ef
PP
1770/*!
1771@brief
1772 Sets \lt_p{*descrs} to the
1773 \ref api-rer-inst-pt-descr "descriptors" of the
1774 available LTTng tracepoints or Java/Python loggers for the
1775 \lt_obj_domain of \lt_p{handle}.
1776
1777@ingroup api_inst_pt
1778
1779@param[in] handle
1780 @parblock
1781 Recording session handle which contains the summary of the
1782 \lt_obj_domain which offers the LTTng tracepoints or Java/Python
1783 loggers of which to get the descriptors.
1784
1785 This function ignores \lt_p{handle->session_name}.
1786 @endparblock
1787@param[out] descrs
1788 @parblock
1789 <strong>On success</strong>, this function sets \lt_p{*descrs}
1790 to the descriptors of the available tracepoints or Java/Python
1791 loggers of \lt_p{handle}.
1792
1793 Free \lt_p{*descrs} with <code>free()</code>.
1794 @endparblock
1795
1796@returns
1797 The number of items in \lt_p{*descrs} on success, or a \em
1798 negative #lttng_error_code enumerator otherwise.
1799
1800@lt_pre_conn
1801@lt_pre_not_null{handle}
1802@pre
1803 \lt_p{handle->domain} is valid as per the documentation of
1804 #lttng_domain.
1805@lt_pre_not_null{descrs}
1806
1807@sa lttng_list_tracepoint_fields() --
1808 Returns all the field descriptions of all the available LTTng
1809 tracepoints.
1810@sa lttng_list_syscalls() --
1811 Returns the descriptors of all the available Linux system calls.
1812*/
4bd69c5f 1813LTTNG_EXPORT extern int lttng_list_tracepoints(struct lttng_handle *handle,
048f01ef 1814 struct lttng_event **descrs);
1239a312 1815
048f01ef
PP
1816/*!
1817@brief
1818 Sets \lt_p{*fields} to the field descriptions of all the available
1819 LTTng tracepoints for the \lt_obj_domain of \lt_p{handle}.
1820
1821@ingroup api_inst_pt
1822
1823@param[in] handle
1824 @parblock
1825 Recording session handle which contains the summary of the
1826 \lt_obj_domain which offers the LTTng tracepoints of which to get
1827 the field descriptions.
1828
1829 This function ignores \lt_p{handle->session_name}.
1830 @endparblock
1831@param[out] fields
1832 @parblock
1833 <strong>On success</strong>, this function sets \lt_p{*fields}
1834 to the descriptions of the available LTTng tracepoint fields of
1835 \lt_p{handle}.
1836
1837 Each #lttng_event_field instance in \lt_p{*fields} contains a
1838 pointer to the \ref api-rer-inst-pt-descr "descriptor" of
1839 a tracepoint which contains the described field
1840 (lttng_event_field::event member).
1841
1842 Free \lt_p{*fields} with <code>free()</code>.
1843 @endparblock
1844
1845@returns
1846 The number of items in \lt_p{*fields} on success, or a \em
1847 negative #lttng_error_code enumerator otherwise.
1848
1849@lt_pre_conn
1850@lt_pre_not_null{handle}
1851@pre
1852 \lt_p{handle->domain} is valid as per the documentation of
1853 #lttng_domain.
1854@lt_pre_not_null{fields}
1855
1856@sa lttng_list_tracepoints() --
1857 Returns the descriptors of all the available LTTng tracepoints
1858 or Java/Python loggers.
1859@sa lttng_list_syscalls() --
1860 Returns the descriptors of all the available Linux system calls.
1861*/
4bd69c5f 1862LTTNG_EXPORT extern int lttng_list_tracepoint_fields(struct lttng_handle *handle,
28f23191 1863 struct lttng_event_field **fields);
1239a312 1864
048f01ef
PP
1865/*!
1866@brief
1867 Sets \lt_p{*descrs} to the
1868 \ref api-rer-inst-pt-descr "descriptors" of the
1869 available Linux system calls for the
1870 #LTTNG_DOMAIN_KERNEL tracing domain.
834978fd 1871
048f01ef
PP
1872@ingroup api_inst_pt
1873
1874@param[out] descrs
1875 @parblock
1876 <strong>On success</strong>, this function sets \lt_p{*descrs}
1877 to the available system calls.
1878
1879 The #lttng_event instances of \lt_p{*descrs} have an
1880 lttng_event::flags member which indicates whether the described
1881 system call is 32-bit, 64-bit, or both.
1882
1883 Free \lt_p{*descrs} with <code>free()</code>.
1884 @endparblock
1885
1886@returns
1887 The number of items in \lt_p{*descrs} on success, or a \em
1888 negative #lttng_error_code enumerator otherwise.
1889
1890@lt_pre_conn
1891@lt_pre_not_null{descrs}
1892
1893@sa lttng_list_tracepoint_fields() --
1894 Returns all the field descriptions of all the available LTTng
1895 tracepoints.
1896@sa lttng_list_syscalls() --
1897 Returns the descriptors of all the available Linux system calls.
1898*/
1899LTTNG_EXPORT extern int lttng_list_syscalls(struct lttng_event **descrs);
1900
1901/*!
1902@brief
1903 Makes the future \ref api_rer "event records" of the
1904 \lt_obj_channel named \lt_p{channel_name} (or of a default channel
1905 or all the channels if \c NULL) within the
1906 \lt_obj_session and \lt_obj_domain of \lt_p{handle}
1907 have a context field described by \lt_p{context_field_descriptor}.
1908
1909@ingroup api_channel
1910
1911Context values (for example, the ID of the current process, the
1912instruction pointer, or the hostname) are always available during
1913tracing. This function makes LTTng record a specific context value as a
1914field for each future event record of the selected channel(s).
1915
1916@param[in] handle
1917 Recording session handle which contains the name of the recording
1918 session and the summary of the \lt_obj_domain which own the
1919 channel(s) to select.
1920@param[in] context_field_descriptor
1921 Descriptor of the context field to add to each event record of
1922 the selected channel(s).
1923@param[in] event_name
1924 Unused: must be \c NULL.
1925@param[in] channel_name
1926 @parblock
1927 Name of the channel to select.
1928
1929 If \c NULL, then:
1930
1931 <dl>
1932 <dt>
1933 If the recording session and tracing domain of
1934 \lt_p{handle} have no channels
1935 <dd>
1936 LTTng creates a new, default channel named \c channel0 within
1937 \lt_p{handle} which becomes the selected channel.
1938
1939 <dt>Otherwise
1940 <dd>
1941 LTTng selects all the channels of \lt_p{handle}.
1942 </dl>
1943 @endparblock
1944
1945@returns
1946 0 on success, or a \em negative #lttng_error_code enumerator
1947 otherwise.
1948
1949@lt_pre_conn
1950@lt_pre_not_null{handle}
1951@lt_pre_valid_c_str{handle->session_name}
1952@lt_pre_sess_exists{handle->session_name}
1953@lt_pre_sess_never_active{handle->session_name}
1954@pre
1955 \lt_p{handle->domain} is valid (you passed a
1956 \lt_obj_domain summary to
1957 lttng_create_handle() when you created \lt_p{handle}).
1958@pre
1959 \lt_p{context_field_descriptor} is valid according to the
1960 documentation of #lttng_event_context.
1961@pre
1962 \lt_p{event_name} is \c NULL.
1963@pre
1964 <strong>If not \c NULL</strong>, \lt_p{channel_name} names an
1965 existing channel within the recording session and tracing domain of
1966 \lt_p{handle}.
1967*/
4bd69c5f 1968LTTNG_EXPORT extern int lttng_add_context(struct lttng_handle *handle,
048f01ef 1969 struct lttng_event_context *context_field_descriptor,
28f23191
JG
1970 const char *event_name,
1971 const char *channel_name);
1239a312 1972
048f01ef
PP
1973/*!
1974@brief
1975 Alias of lttng_enable_event_with_exclusions() which passes the
1976 \ref api-rer-conds-filter "event payload and context filter"
1977 expression of \lt_p{event_rule}
1978 as the \lt_p{filter_expr} parameter and the
1979 \ref api-rer-conds-event-name "event name" exclusion patterns
1980 of \lt_p{event_rule} as the
1981 \lt_p{event_name_exclusion_count} and
1982 \lt_p{event_name_exclusions} parameters.
1239a312 1983
048f01ef
PP
1984@ingroup api_rer
1985
1986This function is equivalent to:
1987
1988@code
1989int ret;
1990int i;
1991char **event_name_exclusions = NULL;
1992const char *filter_expr = NULL;
1993const int event_name_exclusion_count = lttng_event_get_exclusion_name_count(event_rule);
1994
1995assert(event_name_exclusion_count >= 0);
1996
1997if (event_name_exclusion_count > 0) {
1998 event_name_exclusions = calloc(event_name_exclusion_count,
1999 sizeof(*event_name_exclusions));
2000 assert(event_name_exclusions);
2001
2002 for (i = 0; i < event_name_exclusion_count; i++) {
2003 const char *event_name_exclusion;
2004
2005 ret = lttng_event_get_exclusion_name(event_rule, (size_t) i,
2006 &event_name_exclusion);
2007 assert(ret == 0);
2008 event_name_exclusions[i] = (char *) event_name_exclusion;
2009 }
2010}
2011
2012ret = lttng_event_get_filter_expression(event_rule, &filter_expr);
2013assert(ret == 0);
2014ret = lttng_enable_event_with_exclusions(handle, event_rule, channel_name,
2015 filter_expr,
2016 event_name_exclusion_count,
2017 event_name_exclusions);
2018free(event_name_exclusions);
2019return ret;
2020@endcode
2021*/
2022LTTNG_EXPORT extern int lttng_enable_event(struct lttng_handle *handle,
2023 struct lttng_event *event_rule,
2024 const char *channel_name);
2025
2026/*!
2027@brief
2028 Alias of lttng_enable_event_with_exclusions() which passes the
2029 the \ref api-rer-conds-event-name "event name" exclusion patterns
2030 of \lt_p{event_rule} as the
2031 \lt_p{event_name_exclusion_count} and
2032 \lt_p{event_name_exclusions} parameters.
2033
2034@ingroup api_rer
2035
2036This function is equivalent to:
2037
2038@code
2039int ret;
2040int i;
2041char **event_name_exclusions = NULL;
2042const char *filter_expr = NULL;
2043const int event_name_exclusion_count = lttng_event_get_exclusion_name_count(event_rule);
2044
2045assert(event_name_exclusion_count >= 0);
2046
2047if (event_name_exclusion_count > 0) {
2048 event_name_exclusions = calloc(event_name_exclusion_count,
2049 sizeof(*event_name_exclusions));
2050 assert(event_name_exclusions);
2051
2052 for (i = 0; i < event_name_exclusion_count; i++) {
2053 const char *event_name_exclusion;
2054
2055 ret = lttng_event_get_exclusion_name(event_rule, (size_t) i,
2056 &event_name_exclusion);
2057 assert(ret == 0);
2058 event_name_exclusions[i] = (char *) event_name_exclusion;
2059 }
2060}
2061
2062ret = lttng_enable_event_with_exclusions(handle, event_rule, channel_name,
2063 filter_expr,
2064 event_name_exclusion_count,
2065 event_name_exclusions);
2066free(event_name_exclusions);
2067return ret;
2068@endcode
2069*/
4bd69c5f 2070LTTNG_EXPORT extern int lttng_enable_event_with_filter(struct lttng_handle *handle,
048f01ef 2071 struct lttng_event *event_rule,
28f23191 2072 const char *channel_name,
048f01ef 2073 const char *filter_expr);
1239a312 2074
048f01ef
PP
2075/*!
2076@brief
2077 Creates or enables a recording event rule
2078 described by \lt_p{event_rule}, having the
2079 \ref api-rer-conds-filter "event payload and context filter"
2080 expression \lt_p{filter_expr} and the
2081 \ref api-rer-conds-event-name "event name" exclusion patterns
2082 \lt_p{event_name_exclusions}, within
2083 the \lt_obj_channel named \lt_p{channel_name}
2084 (or within a default channel if \c NULL) within the recording
2085 session handle \lt_p{handle}.
2086
2087@ingroup api_rer
2088
2089This function, depending on the
2090\ref api-rer-conds-inst-pt-type "instrumentation point type",
2091\ref api-rer-conds-event-name "event name",
2092and \ref api-rer-conds-ll "log level" conditions of \lt_p{event_rule},
2093as well as on \lt_p{filter_expr} and \lt_p{event_name_exclusions}:
2094
2095<dl>
2096 <dt>
2097 The conditions and parameters describe an existing recording event
2098 rule within the selected channel
2099 <dd>
2100 Enables the existing recording event rule.
2101
2102 <dt>Otherwise
2103 <dd>
2104 Creates and enables a new recording event rule within the
2105 selected channel.
2106</dl>
2107
2108If \lt_p{event_rule->type} is #LTTNG_EVENT_ALL and
2109\lt_p{handle->domain.type} is #LTTNG_DOMAIN_KERNEL, then this
2110function actually creates or enables two recording event rules: one with
2111the #LTTNG_EVENT_TRACEPOINT type, and one with the #LTTNG_EVENT_SYSCALL
2112type.
2113
2114@param[in] handle
2115 Recording session handle which contains the name of the recording
2116 session and the summary of the \lt_obj_domain which own the selected
2117 channel.
2118@param[in] event_rule
2119 @parblock
2120 Descriptor of the recording event rule to create or enable.
2121
2122 This function:
2123
2124 - Ignores any event payload and context filter
2125 expression within \lt_p{event_rule}: it always uses
2126 \lt_p{filter_expr}.
2127
2128 - Ignores any event name exclusion patterns within
2129 \lt_p{event_rule}: it always uses \lt_p{event_name_exclusions}.
2130 @endparblock
2131@param[in] channel_name
2132 @parblock
2133 Name of the channel, within \lt_p{handle}, to select (that is,
2134 containing the recording event rule to create or enable).
2135
2136 If \c NULL, then this function uses \c channel0. If no channel named
2137 \c channel0 within \lt_p{handle} exists, then LTTng creates a new,
2138 default channel named as such and selects it before it creates the
2139 recording event rule described by \lt_p{event_rule}.
2140 @endparblock
2141@param[in] filter_expr
2142 @parblock
2143 Event payload and context filter expression of the recording
2144 event rule to create or enable.
2145
2146 <strong>If \c NULL</strong>, the created or enabled recording event
2147 rule has no event payload and context filter expression.
2148
2149 This parameter, even when \c NULL, overrides any existing
2150 event payload and context filter expression within
2151 \lt_p{event_rule}.
2152 @endparblock
2153@param[in] event_name_exclusion_count
2154 Number of items in \lt_p{event_name_exclusions}.
2155@param[in] event_name_exclusions
2156 @parblock
2157 Event name exclusion patterns of the recording event rule to create
2158 or enable.
2159
2160 This function copies the strings of this array.
2161
2162 \lt_p{event_name_exclusion_count} indicates the size of this
2163 array, which may be \c NULL if \lt_p{event_name_exclusion_count}
2164 is&nbsp;0.
2165
2166 This parameter, even when \c NULL or empty, overrides any existing
2167 event name exclusion patterns within \lt_p{event_rule}.
2168 @endparblock
2169
2170@returns
2171 0 on success, or a \em negative #lttng_error_code enumerator
2172 otherwise.
2173
2174@lt_pre_conn
2175@lt_pre_not_null{handle}
2176@lt_pre_valid_c_str{handle->session_name}
2177@lt_pre_sess_exists{handle->session_name}
2178@pre
2179 \lt_p{handle->domain} is valid as per the documentation of
2180 #lttng_domain.
2181@lt_pre_not_null{event_rule}
2182@pre
2183 \lt_p{event_rule} is \ref api-rer-valid-event-struct "valid".
2184@pre
2185 <strong>If \lt_p{handle->domain.type} is \em not
2186 #LTTNG_DOMAIN_KERNEL</strong>, then \lt_p{event_rule->type} is
2187 #LTTNG_EVENT_TRACEPOINT.
2188@pre
2189 <strong>If \lt_p{handle->domain.type} is \em not
2190 #LTTNG_DOMAIN_UST</strong>, then \lt_p{event_name_exclusion_count}
2191 is&nbsp;0.
2192@pre
2193 <strong>If this function must enable an existing recording event
2194 rule</strong>, then the recording event rule to enable is disabled.
2195@pre
2196 <strong>If not \c NULL</strong>, \lt_p{channel_name} names an
2197 existing channel within the recording session and tracing domain of
2198 \lt_p{handle}.
2199@pre
2200 <strong>If \lt_p{channel_name} is \c NULL</strong>, then
2201 \lt_p{handle} contains either no channels or a default channel named
2202 \c channel0.
2203@pre
2204 <strong>If not \c NULL</strong>, \lt_p{filter_expr} is a valid
2205 event payload and context filter expression.
2206@pre
2207 \lt_p{event_name_exclusion_count}&nbsp;≥&nbsp;0.
2208
2209@sa lttng_enable_event() --
2210 Alias which calls this function with the event payload and context
2211 filter expression and event name exclusion patterns of the
2212 recording event rule descriptor.
2213@sa lttng_enable_event_with_filter() --
2214 Alias which calls this function with the event name exclusion
2215 patterns of the recording event rule descriptor.
2216@sa lttng_disable_event_ext() --
2217 Disables a recording event rule.
2218*/
4bd69c5f 2219LTTNG_EXPORT extern int lttng_enable_event_with_exclusions(struct lttng_handle *handle,
048f01ef 2220 struct lttng_event *event_rule,
28f23191 2221 const char *channel_name,
048f01ef
PP
2222 const char *filter_expr,
2223 int event_name_exclusion_count,
2224 char **event_name_exclusions);
1239a312 2225
048f01ef
PP
2226/*!
2227@brief
2228 Alias of lttng_disable_event_ext() which creates a temporary
2229 recording event rule descriptor, settings its
2230 lttng_event::name member to \lt_p{event_name} if not \c NULL and
2231 its lttng_event::type member to #LTTNG_EVENT_ALL.
2232
2233@ingroup api_rer
2234
2235This function is equivalent to:
2236
2237@code
2238struct lttng_event event_rule = { 0 };
2239
2240event_rule.type = LTTNG_EVENT_ALL;
2241
2242if (event_name) {
2243 strcpy(event_rule.name, event_name);
2244}
2245
2246event_rule.loglevel = -1;
2247return lttng_disable_event_ext(handle, &event_rule, channel_name, NULL);
2248@endcode
2249*/
28f23191 2250LTTNG_EXPORT extern int
048f01ef 2251lttng_disable_event(struct lttng_handle *handle, const char *event_name, const char *channel_name);
1239a312 2252
048f01ef
PP
2253/*!
2254@brief
2255 Disables recording event rules by
2256 \ref api-rer-conds-inst-pt-type "instrumentation point type" and
2257 \ref api-rer-conds-event-name "event name" condition within the
2258 \lt_obj_channel named \lt_p{channel_name}
2259 (or within a default channel if \c NULL) within the recording
2260 session handle \lt_p{handle}.
2261
2262@ingroup api_rer
2263
2264Depending on \lt_p{event_rule->name}, this function:
2265
2266<dl>
2267 <dt>Not empty
2268 <dd>
2269 Depending on \lt_p{event_rule->type}:
2270
2271 <dl>
2272 <dt>#LTTNG_EVENT_ALL
2273 <dd>
2274 Disables \em all the recording event rules of which the event
2275 name pattern is exactly \lt_p{event_rule->name} within the
2276 selected channel.
2277
2278 <dt>Otherwise
2279 <dd>
2280 Disables all the recording event rules of which the
2281 instrumentation point type is
2282 \lt_p{event_rule->type} and the event
2283 name pattern is exactly \lt_p{event_rule->name} within the
2284 selected channel.
2285
2286 Only supported when \lt_p{handle->domain.type} is
2287 #LTTNG_DOMAIN_KERNEL.
2288 </dl>
2289
2290 <dt>Empty
2291 <dd>
2292 Depending on \lt_p{event_rule->type}:
2293
2294 <dl>
2295 <dt>#LTTNG_EVENT_ALL
2296 <dd>
2297 Disables \em all the recording event rules within the selected
2298 channel.
2299
2300 <dt>Otherwise
2301 <dd>
2302 Disables all the recording event rules of which the
2303 instrumentation point type is
2304 \lt_p{event_rule->type} within the
2305 selected channel.
2306
2307 Only supported when \lt_p{handle->domain.type} is
2308 #LTTNG_DOMAIN_KERNEL.
2309 </dl>
2310</dl>
2311
2312This function ignores all the other \ref api-rer-conds "condition"
2313properties of \lt_p{event_rule}.
2314
2315To use this function, create a temporary, zeroed
2316\link #lttng_event recording event rule descriptor\endlink,
2317setting only:
2318
2319- <strong>Optional, and only if \lt_p{handle->domain.type}
2320 is #LTTNG_DOMAIN_KERNEL</strong>: its lttng_event::type member.
2321
2322- <strong>Optional</strong>: its lttng_event::name member
2323
2324- Its lttng_event::loglevel member to&nbsp;-1.
2325
2326For example:
2327
2328@code
2329struct lttng_event event_rule = { 0 };
2330
2331event_rule.type = LTTNG_EVENT_SYSCALL;
2332strcpy(event_rule.name, "open*");
2333event_rule.loglevel = -1;
2334@endcode
2335
2336@param[in] handle
2337 Recording session handle which contains the name of the recording
2338 session and the summary of the \lt_obj_domain which own the selected
2339 channel.
2340@param[in] event_rule
2341 @parblock
2342 Recording event rule descriptor which contains the
2343 instrumentation point type and event name conditions to consider
2344 to disable recording event rules within the selected channel.
2345 @endparblock
2346@param[in] channel_name
2347 @parblock
2348 Name of the channel, within \lt_p{handle}, to select (that is,
2349 containing the recording event rules to disable).
2350
2351 If \c NULL, then this function uses \c channel0.
2352 @endparblock
2353@param[in] filter_expr
2354 Unused: must be \c NULL.
2355
2356@returns
2357 0 on success, or a \em negative #lttng_error_code enumerator
2358 otherwise.
2359
2360@lt_pre_conn
2361@lt_pre_not_null{handle}
2362@lt_pre_valid_c_str{handle->session_name}
2363@lt_pre_sess_exists{handle->session_name}
2364@pre
2365 \lt_p{handle->domain} is valid as per the documentation of
2366 #lttng_domain.
2367@lt_pre_not_null{event_rule}
2368@pre
2369 <strong>If \lt_p{handle->domain.type} is \em not
2370 #LTTNG_DOMAIN_KERNEL</strong>, then \lt_p{event_rule->type}
2371 is #LTTNG_EVENT_ALL.
2372@pre
2373 <strong>If not #LTTNG_EVENT_ALL</strong>, then
2374 \lt_p{event_rule->type} is the instrumentation point type of at
2375 least one Linux kernel recording event rule within the selected
2376 channel.
2377@pre
2378 <strong>If not empty</strong>, then \lt_p{event_rule->name} is the
2379 exact event name pattern of at least one recording event rule within
2380 the selected channel.
2381@pre
2382 The recording event rules to disable are enabled.
2383@pre
2384 <strong>If not \c NULL</strong>, then \lt_p{channel_name} names an
2385 existing channel within the recording session and tracing domain of
2386 \lt_p{handle}.
2387@pre
2388 <strong>If \lt_p{channel_name} is \c NULL</strong>, then the
2389 channel named \c channel0 exists within the recording session and
2390 tracing domain of \lt_p{handle}.
2391
2392@sa lttng_disable_event() --
2393 Alias which calls this function with \lt_p{event_rule->type}
2394 set to #LTTNG_EVENT_ALL.
2395@sa lttng_enable_event_with_exclusions() --
2396 Creates or enables a recording event rule.
2397*/
4bd69c5f 2398LTTNG_EXPORT extern int lttng_disable_event_ext(struct lttng_handle *handle,
048f01ef 2399 struct lttng_event *event_rule,
28f23191 2400 const char *channel_name,
048f01ef 2401 const char *filter_expr);
6e911cad 2402
1239a312
DG
2403#ifdef __cplusplus
2404}
2405#endif
2406
2407#endif /* LTTNG_EVENT_H */
This page took 0.187742 seconds and 5 git commands to generate.