event-rule: introduce event-rule kprobe
[lttng-tools.git] / include / lttng / event-rule / kprobe.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_KPROBE_H
9 #define LTTNG_EVENT_RULE_KPROBE_H
10
11 #include <lttng/event-rule/event-rule.h>
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 struct lttng_kernel_probe_location;
18
19 /*
20 * Create a newly allocated kprobe event rule.
21 *
22 * Returns a new event rule on success, NULL on failure. The returned event rule
23 * must be destroyed using lttng_event_rule_destroy().
24 */
25 extern struct lttng_event_rule *lttng_event_rule_kprobe_create(void);
26
27 /*
28 * Set the kernel probe location of a kprobe event rule.
29 *
30 * The location is copied internally.
31 *
32 * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
33 * if invalid parameters are passed.
34 */
35 extern enum lttng_event_rule_status lttng_event_rule_kprobe_set_location(
36 struct lttng_event_rule *rule,
37 const struct lttng_kernel_probe_location *location);
38
39 /*
40 * Get the kernel probe location of a kprobe event rule.
41 *
42 * The caller does not assume the ownership of the returned location.
43 * The location shall only be used for the duration of the event
44 * rule's lifetime, or before a different location is set.
45 *
46 * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's location
47 * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
48 * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a location was not set prior to
49 * this call.
50 */
51 extern enum lttng_event_rule_status lttng_event_rule_kprobe_get_location(
52 const struct lttng_event_rule *rule,
53 const struct lttng_kernel_probe_location **location);
54
55 /*
56 * Set the name of a kprobe event rule.
57 *
58 * The name is copied internally.
59 *
60 * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
61 * if invalid parameters are passed.
62 */
63 extern enum lttng_event_rule_status lttng_event_rule_kprobe_set_name(
64 struct lttng_event_rule *rule, const char *name);
65
66 /*
67 * Get the name of a kprobe event rule.
68 *
69 * The caller does not assume the ownership of the returned name.
70 * The name shall only only be used for the duration of the event
71 * rule's lifetime, or before a different name is set.
72 *
73 * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's name on
74 * success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is passed,
75 * or LTTNG_EVENT_RULE_STATUS_UNSET if a name was not set prior to this call.
76 */
77 extern enum lttng_event_rule_status lttng_event_rule_kprobe_get_name(
78 const struct lttng_event_rule *rule, const char **name);
79
80 #ifdef __cplusplus
81 }
82 #endif
83
84 #endif /* LTTNG_EVENT_RULE_KPROBE_H */
This page took 0.041727 seconds and 4 git commands to generate.