X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fevent-rule%2Fsyscall.c;h=b1b556aba3aa6bf5b7dcc45b65d0e408a2a7f832;hb=e957bf98e634c79b13281d0a2fe144be0245d310;hp=826953c21fe6cc965bc1064a8434f0ebea412112;hpb=3e6e0df2f8f9f23d252c2508b6d741916dfcc4b3;p=lttng-tools.git diff --git a/src/common/event-rule/syscall.c b/src/common/event-rule/syscall.c index 826953c21..b1b556aba 100644 --- a/src/common/event-rule/syscall.c +++ b/src/common/event-rule/syscall.c @@ -6,11 +6,14 @@ */ #include +#include #include #include #include #include #include +#include +#include #include #include @@ -137,14 +140,15 @@ end: } static enum lttng_error_code lttng_event_rule_syscall_generate_filter_bytecode( - struct lttng_event_rule *rule, uid_t uid, gid_t gid) + struct lttng_event_rule *rule, + const struct lttng_credentials *creds) { int ret; enum lttng_error_code ret_code = LTTNG_OK; struct lttng_event_rule_syscall *syscall; enum lttng_event_rule_status status; const char *filter; - struct lttng_filter_bytecode *bytecode = NULL; + struct lttng_bytecode *bytecode = NULL; assert(rule); @@ -177,7 +181,7 @@ static enum lttng_error_code lttng_event_rule_syscall_generate_filter_bytecode( } ret = run_as_generate_filter_bytecode( - syscall->internal_filter.filter, uid, gid, &bytecode); + syscall->internal_filter.filter, creds, &bytecode); if (ret) { ret_code = LTTNG_ERR_FILTER_INVAL; } @@ -201,7 +205,7 @@ static const char *lttng_event_rule_syscall_get_internal_filter( return syscall->internal_filter.filter; } -static const struct lttng_filter_bytecode * +static const struct lttng_bytecode * lttng_event_rule_syscall_get_internal_filter_bytecode( const struct lttng_event_rule *rule) { @@ -213,15 +217,35 @@ lttng_event_rule_syscall_get_internal_filter_bytecode( return syscall->internal_filter.bytecode; } -static struct lttng_event_exclusion * -lttng_event_rule_syscall_generate_exclusions( +static enum lttng_event_rule_generate_exclusions_status +lttng_event_rule_syscall_generate_exclusions(const struct lttng_event_rule *rule, + struct lttng_event_exclusion **exclusions) +{ + /* Unsupported. */ + *exclusions = NULL; + return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE; +} + +static unsigned long +lttng_event_rule_syscall_hash( const struct lttng_event_rule *rule) { - /* Not supported. */ - return NULL; + unsigned long hash; + struct lttng_event_rule_syscall *syscall_rule = + container_of(rule, typeof(*syscall_rule), parent); + + hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_SYSCALL, + lttng_ht_seed); + hash ^= hash_key_str(syscall_rule->pattern, lttng_ht_seed); + if (syscall_rule->filter_expression) { + hash ^= hash_key_str(syscall_rule->filter_expression, + lttng_ht_seed); + } + + return hash; } -struct lttng_event_rule *lttng_event_rule_syscall_create() +struct lttng_event_rule *lttng_event_rule_syscall_create(void) { struct lttng_event_rule *rule = NULL; struct lttng_event_rule_syscall *syscall_rule; @@ -246,6 +270,7 @@ struct lttng_event_rule *lttng_event_rule_syscall_create() lttng_event_rule_syscall_get_internal_filter_bytecode; syscall_rule->parent.generate_exclusions = lttng_event_rule_syscall_generate_exclusions; + syscall_rule->parent.hash = lttng_event_rule_syscall_hash; end: return rule; }