Commit | Line | Data |
---|---|---|
e6a39346 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 | ||
4f7da553 JR |
8 | #ifndef LTTNG_EVENT_RULE_KERNEL_SYSCALL_H |
9 | #define LTTNG_EVENT_RULE_KERNEL_SYSCALL_H | |
e6a39346 JR |
10 | |
11 | #include <lttng/event-rule/event-rule.h> | |
12 | ||
13 | #ifdef __cplusplus | |
14 | extern "C" { | |
15 | #endif | |
16 | ||
4f7da553 JR |
17 | enum lttng_event_rule_kernel_syscall_emission_site { |
18 | LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY_EXIT = 0, | |
19 | LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY = 1, | |
20 | LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_EXIT = 2, | |
21 | LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_UNKNOWN = -1, | |
57739a6b JR |
22 | }; |
23 | ||
e6a39346 | 24 | /* |
4f7da553 | 25 | * Create a newly allocated kernel syscall event rule. |
e6a39346 | 26 | * |
67d38b93 | 27 | * The default pattern is '*'. |
4f7da553 | 28 | * The default emission site is LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY_EXIT. |
67d38b93 | 29 | * |
e6a39346 JR |
30 | * Returns a new event rule on success, NULL on failure. This event rule must be |
31 | * destroyed using lttng_event_rule_destroy(). | |
32 | */ | |
4f7da553 JR |
33 | extern struct lttng_event_rule *lttng_event_rule_kernel_syscall_create(enum |
34 | lttng_event_rule_kernel_syscall_emission_site emission_site); | |
e6a39346 JR |
35 | |
36 | /* | |
4f7da553 | 37 | * Set the name pattern of a kernel syscall event rule. |
e6a39346 JR |
38 | * |
39 | * Pattern can contain wildcard '*'. See man lttng-enable-event. | |
40 | * | |
41 | * The pattern is copied internally. | |
42 | * | |
43 | * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID | |
44 | * if invalid parameters are passed. | |
45 | */ | |
4f7da553 | 46 | extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_name_pattern( |
e6a39346 JR |
47 | struct lttng_event_rule *rule, const char *pattern); |
48 | ||
49 | /* | |
4f7da553 | 50 | * Get the name pattern of a kernel syscall event rule. |
e6a39346 JR |
51 | * |
52 | * The caller does not assume the ownership of the returned pattern. The | |
53 | * pattern shall only only be used for the duration of the event rule's | |
54 | * lifetime, or before a different pattern is set. | |
55 | * | |
56 | * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's pattern | |
57 | * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid | |
58 | * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern | |
59 | * was not set prior to this call. | |
60 | */ | |
4f7da553 | 61 | extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_get_name_pattern( |
e6a39346 JR |
62 | const struct lttng_event_rule *rule, const char **pattern); |
63 | ||
64 | /* | |
4f7da553 | 65 | * Set the filter expression of a kernel syscall event rule. |
e6a39346 JR |
66 | * |
67 | * The expression is copied internally. | |
68 | * | |
69 | * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID | |
70 | * if invalid parameters are passed. | |
71 | */ | |
4f7da553 | 72 | extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_set_filter( |
e6a39346 JR |
73 | struct lttng_event_rule *rule, const char *expression); |
74 | ||
75 | /* | |
4f7da553 | 76 | * Get the filter expression of a kernel syscall event rule. |
e6a39346 JR |
77 | * |
78 | * The caller does not assume the ownership of the returned filter expression. | |
79 | * The filter expression shall only only be used for the duration of the event | |
80 | * rule's lifetime, or before a different filter expression is set. | |
81 | * | |
82 | * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's filter | |
83 | * expression on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid | |
84 | * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression | |
85 | * was not set prior to this call. | |
86 | */ | |
4f7da553 | 87 | extern enum lttng_event_rule_status lttng_event_rule_kernel_syscall_get_filter( |
e6a39346 JR |
88 | const struct lttng_event_rule *rule, const char **expression); |
89 | ||
57739a6b | 90 | /* |
4f7da553 | 91 | * Get the emission site of a kernel syscall event rule. |
57739a6b | 92 | * |
4f7da553 | 93 | * Returns a enum lttng_event_rule_kernel_syscall_emission_site. |
57739a6b | 94 | */ |
4f7da553 JR |
95 | extern enum lttng_event_rule_kernel_syscall_emission_site |
96 | lttng_event_rule_kernel_syscall_get_emission_site( | |
57739a6b JR |
97 | const struct lttng_event_rule *rule); |
98 | ||
e6a39346 JR |
99 | #ifdef __cplusplus |
100 | } | |
101 | #endif | |
102 | ||
4f7da553 | 103 | #endif /* LTTNG_EVENT_RULE_KERNEL_SYSCALL_H */ |