Tests: Add test to check shared-memory FD leaks after relayd dies
[lttng-tools.git] / include / lttng / kernel-probe-internal.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_INTERNAL_H
9 #define LTTNG_KERNEL_PROBE_INTERNAL_H
10
11 #include <common/fd-handle.h>
12 #include <common/macros.h>
13 #include <lttng/lttng-error.h>
14 #include <lttng/kernel-probe.h>
15 #include <lttng/lttng-error.h>
16 #include <stdbool.h>
17 #include <stdint.h>
18 #include <sys/types.h>
19
20 struct lttng_payload;
21 struct lttng_payload_view;
22 struct lttng_dynamic_buffer;
23 struct mi_writer;
24
25 typedef bool (*kernel_probe_location_equal_cb)(
26 const struct lttng_kernel_probe_location *a,
27 const struct lttng_kernel_probe_location *b);
28 typedef int (*kernel_probe_location_serialize_cb)(
29 const struct lttng_kernel_probe_location *kernel_probe_location,
30 struct lttng_payload *payload);
31 typedef bool (*kernel_probe_location_equal_cb)(
32 const struct lttng_kernel_probe_location *a,
33 const struct lttng_kernel_probe_location *b);
34 typedef ssize_t (*kernel_probe_location_create_from_payload_cb)(
35 struct lttng_payload_view *view,
36 struct lttng_kernel_probe_location **kernel_probe_location);
37 typedef unsigned long (*kernel_probe_location_hash_cb)(
38 const struct lttng_kernel_probe_location *location);
39 typedef enum lttng_error_code (*kernel_probe_location_mi_serialize_cb)(
40 const struct lttng_kernel_probe_location *location,
41 struct mi_writer *writer);
42
43 struct lttng_kernel_probe_location_comm {
44 /* enum lttng_kernel_probe_location_type */
45 int8_t type;
46 /*
47 * Payload is composed of, in that order,
48 * - type-specific payload
49 */
50 char payload[];
51 } LTTNG_PACKED;
52
53 struct lttng_kernel_probe_location_symbol_comm {
54 /* Includes the trailing \0. */
55 uint32_t symbol_len;
56 /* The offset from the symbol. */
57 uint64_t offset;
58 /*
59 * Payload is composed of, in that order,
60 * - symbol name (with trailing \0).
61 */
62 char payload[];
63 } LTTNG_PACKED;
64
65 struct lttng_kernel_probe_location_address_comm {
66 uint64_t address;
67 } LTTNG_PACKED;
68
69 /* Common ancestor of all kernel probe locations. */
70 struct lttng_kernel_probe_location {
71 enum lttng_kernel_probe_location_type type;
72 kernel_probe_location_equal_cb equal;
73 kernel_probe_location_serialize_cb serialize;
74 kernel_probe_location_hash_cb hash;
75 kernel_probe_location_mi_serialize_cb mi_serialize;
76 };
77
78 struct lttng_kernel_probe_location_symbol {
79 struct lttng_kernel_probe_location parent;
80 char *symbol_name;
81 uint64_t offset;
82 };
83
84 struct lttng_kernel_probe_location_address {
85 struct lttng_kernel_probe_location parent;
86 uint64_t address;
87 };
88
89 int lttng_kernel_probe_location_serialize(
90 const struct lttng_kernel_probe_location *location,
91 struct lttng_payload *payload);
92
93 ssize_t lttng_kernel_probe_location_create_from_payload(
94 struct lttng_payload_view *view,
95 struct lttng_kernel_probe_location **probe_location);
96
97 bool lttng_kernel_probe_location_is_equal(
98 const struct lttng_kernel_probe_location *a,
99 const struct lttng_kernel_probe_location *b);
100
101 struct lttng_kernel_probe_location *lttng_kernel_probe_location_copy(
102 const struct lttng_kernel_probe_location *location);
103
104 unsigned long lttng_kernel_probe_location_hash(
105 const struct lttng_kernel_probe_location *location);
106
107 enum lttng_error_code lttng_kernel_probe_location_mi_serialize(
108 const struct lttng_kernel_probe_location *location,
109 struct mi_writer *writer);
110
111 #endif /* LTTNG_KERNEL_PROBE_INTERNAL_H */
This page took 0.030724 seconds and 4 git commands to generate.