X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-filter-interpreter.c;h=8640960801b323d9ce5403d01c2234abfd21392c;hb=refs%2Fheads%2Fstable-2.1;hp=e6e96dbff9a9bf53cdb346b68cd63a9b4728d457;hpb=9b33aac411033000adafce04f947c7aca892c342;p=lttng-ust.git diff --git a/liblttng-ust/lttng-filter-interpreter.c b/liblttng-ust/lttng-filter-interpreter.c index e6e96dbf..86409608 100644 --- a/liblttng-ust/lttng-filter-interpreter.c +++ b/liblttng-ust/lttng-filter-interpreter.c @@ -59,18 +59,28 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type) int escaped_r0 = 0; if (unlikely(p - estack_bx(stack, top)->u.s.str > estack_bx(stack, top)->u.s.seq_len || *p == '\0')) { - if (q - estack_ax(stack, top)->u.s.str > estack_ax(stack, top)->u.s.seq_len || *q == '\0') - diff = 0; - else - diff = -1; - break; + if (q - estack_ax(stack, top)->u.s.str > estack_ax(stack, top)->u.s.seq_len || *q == '\0') { + return 0; + } else { + if (estack_ax(stack, top)->u.s.literal) { + ret = parse_char(&q); + if (ret == -1) + return 0; + } + return -1; + } } if (unlikely(q - estack_ax(stack, top)->u.s.str > estack_ax(stack, top)->u.s.seq_len || *q == '\0')) { - if (p - estack_bx(stack, top)->u.s.str > estack_bx(stack, top)->u.s.seq_len || *p == '\0') - diff = 0; - else - diff = 1; - break; + if (p - estack_bx(stack, top)->u.s.str > estack_bx(stack, top)->u.s.seq_len || *p == '\0') { + return 0; + } else { + if (estack_bx(stack, top)->u.s.literal) { + ret = parse_char(&p); + if (ret == -1) + return 0; + } + return 1; + } } if (estack_bx(stack, top)->u.s.literal) { ret = parse_char(&p); @@ -105,7 +115,7 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type) return diff; } -int lttng_filter_false(void *filter_data, +uint64_t lttng_filter_false(void *filter_data, const char *filter_stack_data) { return 0; @@ -157,13 +167,18 @@ LABEL_##name #endif -int lttng_filter_interpret_bytecode(void *filter_data, +/* + * Return 0 (discard), or raise the 0x1 flag (log event). + * Currently, other flags are kept for future extensions and have no + * effect. + */ +uint64_t lttng_filter_interpret_bytecode(void *filter_data, const char *filter_stack_data) { struct bytecode_runtime *bytecode = filter_data; void *pc, *next_pc, *start_pc; int ret = -EINVAL; - int retval = 0; + uint64_t retval = 0; struct estack _stack; struct estack *stack = &_stack; register int64_t ax = 0, bx = 0; @@ -279,6 +294,7 @@ int lttng_filter_interpret_bytecode(void *filter_data, goto end; OP(FILTER_OP_RETURN): + /* LTTNG_FILTER_DISCARD or LTTNG_FILTER_RECORD_FLAG */ retval = !!estack_ax_v; ret = 0; goto end;