X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fevent-rule-kretprobe.c;fp=src%2Fcommon%2Fevent-rule-kretprobe.c;h=56916d9c9548e43e4191349cd5f5d240d0da09de;hp=0000000000000000000000000000000000000000;hb=1831ae68b70dece8e9b847081526495adbbf05e5;hpb=25357057de5ae4dd2a572e8f9b893c1b90cbd60a diff --git a/src/common/event-rule-kretprobe.c b/src/common/event-rule-kretprobe.c new file mode 100644 index 000000000..56916d9c9 --- /dev/null +++ b/src/common/event-rule-kretprobe.c @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2019 - Jonathan Rajotte-Julien + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License, version 2.1 only, + * as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include + +#define IS_KRETPROBE_EVENT_RULE(rule) ( \ + lttng_event_rule_get_type(rule) == LTTNG_EVENT_RULE_TYPE_KRETPROBE \ + ) + +static +void lttng_event_rule_kretprobe_destroy(struct lttng_event_rule *rule) +{ + struct lttng_event_rule_kretprobe *kretprobe; + + kretprobe = container_of(rule, struct lttng_event_rule_kretprobe, + parent); + + /* + * TODO + */ + free(kretprobe); +} + +static +bool lttng_event_rule_kretprobe_validate( + const struct lttng_event_rule *rule) +{ + /* TODO */ + return false; +} + +static +int lttng_event_rule_kretprobe_serialize( + const struct lttng_event_rule *rule, + struct lttng_dynamic_buffer *buf, int *fd_to_send) +{ + /* TODO */ + return -1; +} + +static +bool lttng_event_rule_kretprobe_is_equal(const struct lttng_event_rule *_a, + const struct lttng_event_rule *_b) +{ + /* TODO */ + return false; +} + +static +enum lttng_error_code lttng_event_rule_kretprobe_populate(struct lttng_event_rule *rule, uid_t uid, gid_t gid) +{ + /* Nothing to do */ + return LTTNG_OK; +} + +static const char *lttng_event_rule_kretprobe_get_filter( + const struct lttng_event_rule *rule) +{ + /* Not supported */ + return NULL; +} + +static const struct lttng_filter_bytecode * +lttng_event_rule_kretprobe_get_filter_bytecode( + const struct lttng_event_rule *rule) +{ + /* Not supported */ + return NULL; +} + +static struct lttng_event_exclusion * +lttng_event_rule_kretprobe_generate_exclusions(struct lttng_event_rule *rule) +{ + /* Not supported */ + return NULL; +} + +struct lttng_event_rule *lttng_event_rule_kretprobe_create() +{ + struct lttng_event_rule_kretprobe *rule; + + rule = zmalloc(sizeof(struct lttng_event_rule_kretprobe)); + if (!rule) { + return NULL; + } + + lttng_event_rule_init(&rule->parent, LTTNG_EVENT_RULE_TYPE_KRETPROBE); + rule->parent.validate = lttng_event_rule_kretprobe_validate; + rule->parent.serialize = lttng_event_rule_kretprobe_serialize; + rule->parent.equal = lttng_event_rule_kretprobe_is_equal; + rule->parent.destroy = lttng_event_rule_kretprobe_destroy; + rule->parent.populate = lttng_event_rule_kretprobe_populate; + rule->parent.get_filter = lttng_event_rule_kretprobe_get_filter; + rule->parent.get_filter_bytecode = lttng_event_rule_kretprobe_get_filter_bytecode; + rule->parent.generate_exclusions = lttng_event_rule_kretprobe_generate_exclusions; + return &rule->parent; +} + +LTTNG_HIDDEN +ssize_t lttng_event_rule_kretprobe_create_from_buffer( + const struct lttng_buffer_view *view, + struct lttng_event_rule **_event_rule) +{ + /* TODO */ + return -1; +} + +enum lttng_event_rule_status lttng_event_rule_kretprobe_set_source( + struct lttng_event_rule *rule, const char *source) +{ + return LTTNG_EVENT_RULE_STATUS_UNSUPPORTED; +} + +enum lttng_event_rule_status lttng_event_rule_kretprobe_set_name( + struct lttng_event_rule *rule, const char *name) +{ + return LTTNG_EVENT_RULE_STATUS_UNSUPPORTED; +} + +enum lttng_event_rule_status lttng_event_rule_kretprobe_get_name( + const struct lttng_event_rule *rule, const char **name) +{ + return LTTNG_EVENT_RULE_STATUS_UNSUPPORTED; +} + +LTTNG_HIDDEN +uint64_t lttng_event_rule_kretprobe_get_address( + const struct lttng_event_rule *rule) +{ + assert("Not implemented" && 0); +} + +LTTNG_HIDDEN +uint64_t lttng_event_rule_kretprobe_get_offset( + const struct lttng_event_rule *rule) +{ + assert("Not implemented" && 0); +} + +LTTNG_HIDDEN +const char *lttng_event_rule_kretprobe_get_symbol_name( + const struct lttng_event_rule *rule) +{ + assert("Not implemented" && 0); +}