f9fd2aba37f53e77c2551b8102918f4fe7c158b9
[lttng-tools.git] / include / lttng / event-rule / syscall.h
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_SYSCALL_H
9 #define LTTNG_EVENT_RULE_SYSCALL_H
10
11 #include <lttng/event-rule/event-rule.h>
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 enum lttng_event_rule_syscall_emission_site {
18 LTTNG_EVENT_RULE_SYSCALL_EMISSION_SITE_ENTRY_EXIT = 0,
19 LTTNG_EVENT_RULE_SYSCALL_EMISSION_SITE_ENTRY = 1,
20 LTTNG_EVENT_RULE_SYSCALL_EMISSION_SITE_EXIT = 2,
21 LTTNG_EVENT_RULE_SYSCALL_EMISSION_SITE_UNKNOWN = -1,
22 };
23
24 /*
25 * Create a newly allocated syscall event rule.
26 *
27 * The default pattern is '*'.
28 * The default emission site is LTTNG_EVENT_RULE_SYSCALL_EMISSION_SITE_ENTRY_EXIT.
29 *
30 * Returns a new event rule on success, NULL on failure. This event rule must be
31 * destroyed using lttng_event_rule_destroy().
32 */
33 extern struct lttng_event_rule *lttng_event_rule_syscall_create(enum
34 lttng_event_rule_syscall_emission_site emission_site);
35
36 /*
37 * Set the name pattern of a syscall event rule.
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 */
46 extern enum lttng_event_rule_status lttng_event_rule_syscall_set_name_pattern(
47 struct lttng_event_rule *rule, const char *pattern);
48
49 /*
50 * Get the name pattern of a syscall event rule.
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 */
61 extern enum lttng_event_rule_status lttng_event_rule_syscall_get_name_pattern(
62 const struct lttng_event_rule *rule, const char **pattern);
63
64 /*
65 * Set the filter expression of a syscall event rule.
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 */
72 extern enum lttng_event_rule_status lttng_event_rule_syscall_set_filter(
73 struct lttng_event_rule *rule, const char *expression);
74
75 /*
76 * Get the filter expression of a syscall event rule.
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 */
87 extern enum lttng_event_rule_status lttng_event_rule_syscall_get_filter(
88 const struct lttng_event_rule *rule, const char **expression);
89
90 /*
91 * Get the emission site of a syscall event rule.
92 *
93 * Returns a enum lttng_event_rule_syscall_emission_site.
94 */
95 extern enum lttng_event_rule_syscall_emission_site
96 lttng_event_rule_syscall_get_emission_site(
97 const struct lttng_event_rule *rule);
98
99 #ifdef __cplusplus
100 }
101 #endif
102
103 #endif /* LTTNG_EVENT_RULE_SYSCALL_H */
This page took 0.035837 seconds and 3 git commands to generate.