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> | |
13 | ||
14 | #ifdef __cplusplus | |
15 | extern "C" { | |
16 | #endif | |
17 | ||
18 | /* | |
19 | * Create a newly allocated kernel tracepoint event rule. | |
20 | * | |
21 | * The default pattern is '*'. | |
22 | * | |
23 | * Returns a new event rule on success, NULL on failure. This event rule must be | |
24 | * destroyed using lttng_event_rule_destroy(). | |
25 | */ | |
26 | extern struct lttng_event_rule *lttng_event_rule_kernel_tracepoint_create(void); | |
27 | ||
28 | /* | |
29 | * Set the name pattern of a kernel tracepoint event rule. | |
30 | * | |
31 | * Pattern can contain wildcard '*'. See man lttng-enable-event. | |
32 | * | |
33 | * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID | |
34 | * if invalid parameters are passed. | |
35 | */ | |
36 | extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_name_pattern( | |
37 | struct lttng_event_rule *rule, const char *pattern); | |
38 | ||
39 | /* | |
40 | * Get the name pattern of a kernel tracepoint event rule. | |
41 | * | |
42 | * The caller does not assume the ownership of the returned pattern. The | |
43 | * pattern shall only only be used for the duration of the event rule's | |
44 | * lifetime, or before a different pattern is set. | |
45 | * | |
46 | * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's pattern | |
47 | * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid | |
48 | * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern | |
49 | * was not set prior to this call. | |
50 | */ | |
51 | extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_name_pattern( | |
52 | const struct lttng_event_rule *rule, const char **pattern); | |
53 | ||
54 | /* | |
55 | * Set the filter expression of a kernel tracepoint event rule. | |
56 | * | |
57 | * The expression is copied internally. | |
58 | * | |
59 | * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID | |
60 | * if invalid parameters are passed. | |
61 | */ | |
62 | extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_set_filter( | |
63 | struct lttng_event_rule *rule, const char *expression); | |
64 | ||
65 | /* | |
66 | * Get the filter expression of a kernel tracepoint event rule. | |
67 | * | |
68 | * The caller does not assume the ownership of the returned filter expression. | |
69 | * The filter expression shall only only be used for the duration of the event | |
70 | * rule's lifetime, or before a different filter expression is set. | |
71 | * | |
72 | * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's filter | |
73 | * expression on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid | |
74 | * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression | |
75 | * was not set prior to this call. | |
76 | */ | |
77 | extern enum lttng_event_rule_status lttng_event_rule_kernel_tracepoint_get_filter( | |
78 | const struct lttng_event_rule *rule, const char **expression); | |
79 | ||
80 | #ifdef __cplusplus | |
81 | } | |
82 | #endif | |
83 | ||
84 | #endif /* LTTNG_EVENT_RULE_KERNEL_TRACEPOINT_H */ |