2 * Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_EVENT_RULE_KPROBE_H
9 #define LTTNG_EVENT_RULE_KPROBE_H
11 #include <lttng/event-rule/event-rule.h>
17 struct lttng_kernel_probe_location
;
20 * Create a newly allocated kprobe event rule.
22 * Returns a new event rule on success, NULL on failure. The returned event rule
23 * must be destroyed using lttng_event_rule_destroy().
25 extern struct lttng_event_rule
*lttng_event_rule_kprobe_create(void);
28 * Set the kernel probe location of a kprobe event rule.
30 * The location is copied internally.
32 * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
33 * if invalid parameters are passed.
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
);
40 * Get the kernel probe location of a kprobe event rule.
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.
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
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
);
56 * Set the name of a kprobe event rule.
58 * The name is copied internally.
60 * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
61 * if invalid parameters are passed.
63 extern enum lttng_event_rule_status
lttng_event_rule_kprobe_set_name(
64 struct lttng_event_rule
*rule
, const char *name
);
67 * Get the name of a kprobe event rule.
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.
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.
77 extern enum lttng_event_rule_status
lttng_event_rule_kprobe_get_name(
78 const struct lttng_event_rule
*rule
, const char **name
);
84 #endif /* LTTNG_EVENT_RULE_KPROBE_H */