Commit | Line | Data |
---|---|---|
5024c2ac JR |
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 | #include <assert.h> | |
9 | #include <common/error.h> | |
10 | #include <common/macros.h> | |
11 | #include <common/runas.h> | |
12 | #include <lttng/event-rule/event-rule-internal.h> | |
13 | #include <lttng/event-rule/kretprobe-internal.h> | |
14 | ||
15 | #define IS_KRETPROBE_EVENT_RULE(rule) \ | |
16 | (lttng_event_rule_get_type(rule) == LTTNG_EVENT_RULE_TYPE_KRETPROBE) | |
17 | ||
18 | static void lttng_event_rule_kretprobe_destroy(struct lttng_event_rule *rule) | |
19 | { | |
20 | struct lttng_event_rule_kretprobe *kretprobe; | |
21 | ||
22 | kretprobe = container_of( | |
23 | rule, struct lttng_event_rule_kretprobe, parent); | |
24 | ||
25 | /* | |
26 | * TODO | |
27 | */ | |
28 | free(kretprobe); | |
29 | } | |
30 | ||
31 | static bool lttng_event_rule_kretprobe_validate( | |
32 | const struct lttng_event_rule *rule) | |
33 | { | |
34 | /* TODO */ | |
35 | return false; | |
36 | } | |
37 | ||
38 | static int lttng_event_rule_kretprobe_serialize( | |
39 | const struct lttng_event_rule *rule, | |
40 | struct lttng_dynamic_buffer *buf, | |
41 | int *fd_to_send) | |
42 | { | |
43 | /* TODO */ | |
44 | return -1; | |
45 | } | |
46 | ||
47 | static bool lttng_event_rule_kretprobe_is_equal( | |
48 | const struct lttng_event_rule *_a, | |
49 | const struct lttng_event_rule *_b) | |
50 | { | |
51 | /* TODO */ | |
52 | return false; | |
53 | } | |
54 | ||
55 | static enum lttng_error_code lttng_event_rule_kretprobe_populate( | |
56 | struct lttng_event_rule *rule, uid_t uid, gid_t gid) | |
57 | { | |
58 | /* Nothing to do */ | |
59 | return LTTNG_OK; | |
60 | } | |
61 | ||
62 | static const char *lttng_event_rule_kretprobe_get_filter( | |
63 | const struct lttng_event_rule *rule) | |
64 | { | |
65 | /* Not supported */ | |
66 | return NULL; | |
67 | } | |
68 | ||
69 | static const struct lttng_bytecode * | |
70 | lttng_event_rule_kretprobe_get_filter_bytecode( | |
71 | const struct lttng_event_rule *rule) | |
72 | { | |
73 | /* Not supported */ | |
74 | return NULL; | |
75 | } | |
76 | ||
77 | static struct lttng_event_exclusion * | |
78 | lttng_event_rule_kretprobe_generate_exclusions(struct lttng_event_rule *rule) | |
79 | { | |
80 | /* Not supported */ | |
81 | return NULL; | |
82 | } | |
83 | ||
84 | struct lttng_event_rule *lttng_event_rule_kretprobe_create() | |
85 | { | |
86 | struct lttng_event_rule_kretprobe *rule; | |
87 | ||
88 | rule = zmalloc(sizeof(struct lttng_event_rule_kretprobe)); | |
89 | if (!rule) { | |
90 | return NULL; | |
91 | } | |
92 | ||
93 | lttng_event_rule_init(&rule->parent, LTTNG_EVENT_RULE_TYPE_KRETPROBE); | |
94 | rule->parent.validate = lttng_event_rule_kretprobe_validate; | |
95 | rule->parent.serialize = lttng_event_rule_kretprobe_serialize; | |
96 | rule->parent.equal = lttng_event_rule_kretprobe_is_equal; | |
97 | rule->parent.destroy = lttng_event_rule_kretprobe_destroy; | |
98 | rule->parent.populate = lttng_event_rule_kretprobe_populate; | |
99 | rule->parent.get_filter = lttng_event_rule_kretprobe_get_filter; | |
100 | rule->parent.get_filter_bytecode = | |
101 | lttng_event_rule_kretprobe_get_filter_bytecode; | |
102 | rule->parent.generate_exclusions = | |
103 | lttng_event_rule_kretprobe_generate_exclusions; | |
104 | return &rule->parent; | |
105 | } | |
106 | ||
107 | LTTNG_HIDDEN | |
108 | ssize_t lttng_event_rule_kretprobe_create_from_buffer( | |
109 | const struct lttng_buffer_view *view, | |
110 | struct lttng_event_rule **_event_rule) | |
111 | { | |
112 | /* TODO */ | |
113 | return -1; | |
114 | } | |
115 | ||
116 | enum lttng_event_rule_status lttng_event_rule_kretprobe_set_source( | |
117 | struct lttng_event_rule *rule, const char *source) | |
118 | { | |
119 | return LTTNG_EVENT_RULE_STATUS_UNSUPPORTED; | |
120 | } | |
121 | ||
122 | enum lttng_event_rule_status lttng_event_rule_kretprobe_set_name( | |
123 | struct lttng_event_rule *rule, const char *name) | |
124 | { | |
125 | return LTTNG_EVENT_RULE_STATUS_UNSUPPORTED; | |
126 | } | |
127 | ||
128 | enum lttng_event_rule_status lttng_event_rule_kretprobe_get_name( | |
129 | const struct lttng_event_rule *rule, const char **name) | |
130 | { | |
131 | return LTTNG_EVENT_RULE_STATUS_UNSUPPORTED; | |
132 | } | |
133 | ||
134 | LTTNG_HIDDEN | |
135 | uint64_t lttng_event_rule_kretprobe_get_address( | |
136 | const struct lttng_event_rule *rule) | |
137 | { | |
138 | assert("Not implemented" && 0); | |
139 | } | |
140 | ||
141 | LTTNG_HIDDEN | |
142 | uint64_t lttng_event_rule_kretprobe_get_offset( | |
143 | const struct lttng_event_rule *rule) | |
144 | { | |
145 | assert("Not implemented" && 0); | |
146 | } | |
147 | ||
148 | LTTNG_HIDDEN | |
149 | const char *lttng_event_rule_kretprobe_get_symbol_name( | |
150 | const struct lttng_event_rule *rule) | |
151 | { | |
152 | assert("Not implemented" && 0); | |
153 | } |