Fix: lttng-ctl: erroneous uses of LTTNG_PACKED
[lttng-tools.git] / include / lttng / kernel-probe.h
1 /*
2 * Copyright (C) 2020 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8 #ifndef LTTNG_KERNEL_PROBE_H
9 #define LTTNG_KERNEL_PROBE_H
10
11 #include <stdint.h>
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 struct lttng_kernel_probe_location;
18
19 enum lttng_kernel_probe_location_status {
20 LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK = 0,
21 /* Invalid parameters provided. */
22 LTTNG_KERNEL_PROBE_LOCATION_STATUS_INVALID = -1,
23 };
24
25 enum lttng_kernel_probe_location_type {
26 LTTNG_KERNEL_PROBE_LOCATION_TYPE_UNKNOWN = -1,
27 /* Location derived from a symbol and an offset. */
28 LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET = 0,
29 /* Location derived from an address. */
30 LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS = 1,
31 };
32
33 /*
34 * Get the type of the kernel probe location.
35 */
36 extern enum lttng_kernel_probe_location_type
37 lttng_kernel_probe_location_get_type(
38 const struct lttng_kernel_probe_location *location);
39
40 /*
41 * Destroy the kernel probe location.
42 */
43 extern void lttng_kernel_probe_location_destroy(
44 struct lttng_kernel_probe_location *location);
45
46 /*
47 * Create a symbol derived probe location.
48 * On failure, NULL is returned.
49 */
50 extern struct lttng_kernel_probe_location *
51 lttng_kernel_probe_location_symbol_create(const char *symbol_name,
52 uint64_t offset);
53
54 /*
55 * Get the symbol name of a symbol derived probe location.
56 */
57 extern const char *lttng_kernel_probe_location_symbol_get_name(
58 const struct lttng_kernel_probe_location *location);
59
60 /*
61 * Get the offset of a symbol derived location.
62 */
63 extern enum lttng_kernel_probe_location_status
64 lttng_kernel_probe_location_symbol_get_offset(
65 const struct lttng_kernel_probe_location *location,
66 uint64_t *offset);
67
68 /*
69 * Create an address derived probe location.
70 * On failure, NULL is returned.
71 */
72 extern struct lttng_kernel_probe_location *
73 lttng_kernel_probe_location_address_create(uint64_t address);
74
75 /*
76 * Get the address of an address derived probe location.
77 */
78 extern enum lttng_kernel_probe_location_status
79 lttng_kernel_probe_location_address_get_address(
80 const struct lttng_kernel_probe_location *location,
81 uint64_t *offset);
82
83 #ifdef __cplusplus
84 }
85 #endif
86
87 #endif /* LTTNG_KERNEL_PROBE_H */
This page took 0.030208 seconds and 4 git commands to generate.