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