Commit | Line | Data |
---|---|---|
af0818ef JR |
1 | /* |
2 | * Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> | |
3 | * | |
4 | * SPDX-License-Identifier: LGPL-2.1-only | |
5 | * | |
6 | */ | |
7 | ||
8 | #ifndef LTTNG_EVENT_RULE_KERNEL_TRACEPOINT_H | |
9 | #define LTTNG_EVENT_RULE_KERNEL_TRACEPOINT_H | |
10 | ||
11 | #include <lttng/event-rule/event-rule.h> | |
12 | #include <lttng/event.h> | |
4bd69c5f | 13 | #include <lttng/lttng-export.h> |
af0818ef JR |
14 | |
15 | #ifdef __cplusplus | |
16 | extern "C" { | |
17 | #endif | |
18 | ||
19 | /* | |
20 | * Create a newly allocated kernel tracepoint event rule. | |
21 | * | |
22 | * The default pattern is '*'. | |
23 | * | |
24 | * Returns a new event rule on success, NULL on failure. This event rule must be | |
25 | * destroyed using lttng_event_rule_destroy(). | |
26 | */ | |
4bd69c5f | 27 | LTTNG_EXPORT extern struct lttng_event_rule *lttng_event_rule_kernel_tracepoint_create(void); |
af0818ef JR |
28 | |
29 | /* | |
30 | * Set the name pattern of a kernel tracepoint event rule. | |
31 | * | |
32 | * Pattern can contain wildcard '*'. See man lttng-enable-event. | |
33 | * | |
34 | * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID | |
35 | * if invalid parameters are passed. | |
36 | */ | |
28f23191 JG |
37 | LTTNG_EXPORT extern enum lttng_event_rule_status |
38 | lttng_event_rule_kernel_tracepoint_set_name_pattern(struct lttng_event_rule *rule, | |
39 | const char *pattern); | |
af0818ef JR |
40 | |
41 | /* | |
42 | * Get the name pattern of a kernel tracepoint event rule. | |
43 | * | |
44 | * The caller does not assume the ownership of the returned pattern. The | |
45 | * pattern shall only only be used for the duration of the event rule's | |
46 | * lifetime, or before a different pattern is set. | |
47 | * | |
48 | * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's pattern | |
49 | * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid | |
50 | * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern | |
51 | * was not set prior to this call. | |
52 | */ | |
28f23191 JG |
53 | LTTNG_EXPORT extern enum lttng_event_rule_status |
54 | lttng_event_rule_kernel_tracepoint_get_name_pattern(const struct lttng_event_rule *rule, | |
55 | const char **pattern); | |
af0818ef JR |
56 | |
57 | /* | |
58 | * Set the filter expression of a kernel tracepoint event rule. | |
59 | * | |
60 | * The expression is copied internally. | |
61 | * | |
62 | * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID | |
63 | * if invalid parameters are passed. | |
64 | */ | |
28f23191 JG |
65 | LTTNG_EXPORT extern enum lttng_event_rule_status |
66 | lttng_event_rule_kernel_tracepoint_set_filter(struct lttng_event_rule *rule, | |
67 | const char *expression); | |
af0818ef JR |
68 | |
69 | /* | |
70 | * Get the filter expression of a kernel tracepoint event rule. | |
71 | * | |
72 | * The caller does not assume the ownership of the returned filter expression. | |
73 | * The filter expression shall only only be used for the duration of the event | |
74 | * rule's lifetime, or before a different filter expression is set. | |
75 | * | |
76 | * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's filter | |
77 | * expression on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid | |
78 | * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression | |
79 | * was not set prior to this call. | |
80 | */ | |
28f23191 JG |
81 | LTTNG_EXPORT extern enum lttng_event_rule_status |
82 | lttng_event_rule_kernel_tracepoint_get_filter(const struct lttng_event_rule *rule, | |
83 | const char **expression); | |
af0818ef JR |
84 | |
85 | #ifdef __cplusplus | |
86 | } | |
87 | #endif | |
88 | ||
89 | #endif /* LTTNG_EVENT_RULE_KERNEL_TRACEPOINT_H */ |