From cbc190407df71e058ef656d4eaf30cee31b4bb58 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sat, 11 Mar 2017 13:46:10 -0500 Subject: [PATCH] Fix: introduce LTTNG_SIZE_MAX for older kernels Signed-off-by: Mathieu Desnoyers --- lttng-events.c | 4 +++- lttng-filter-interpreter.c | 11 ++++++----- wrapper/types.h | 26 ++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 wrapper/types.h diff --git a/lttng-events.c b/lttng-events.c index 95a79cf7..6aa994ca 100644 --- a/lttng-events.c +++ b/lttng-events.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -1146,7 +1147,8 @@ static int lttng_match_enabler_star_glob(const char *desc_name, const char *pattern) { - if (!strutils_star_glob_match(pattern, SIZE_MAX, desc_name, SIZE_MAX)) + if (!strutils_star_glob_match(pattern, LTTNG_SIZE_MAX, + desc_name, LTTNG_SIZE_MAX)) return 0; return 1; } diff --git a/lttng-filter-interpreter.c b/lttng-filter-interpreter.c index f4d5a946..e1314624 100644 --- a/lttng-filter-interpreter.c +++ b/lttng-filter-interpreter.c @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -726,7 +727,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, ret = -EINVAL; goto end; } - estack_ax(stack, top)->u.s.seq_len = SIZE_MAX; + estack_ax(stack, top)->u.s.seq_len = LTTNG_SIZE_MAX; estack_ax(stack, top)->u.s.literal_type = ESTACK_STRING_LITERAL_TYPE_NONE; estack_ax(stack, top)->u.s.user = 0; @@ -790,7 +791,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, dbg_printk("load string %s\n", insn->data); estack_push(stack, top, ax, bx); estack_ax(stack, top)->u.s.str = insn->data; - estack_ax(stack, top)->u.s.seq_len = SIZE_MAX; + estack_ax(stack, top)->u.s.seq_len = LTTNG_SIZE_MAX; estack_ax(stack, top)->u.s.literal_type = ESTACK_STRING_LITERAL_TYPE_PLAIN; estack_ax(stack, top)->u.s.user = 0; @@ -805,7 +806,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, dbg_printk("load globbing pattern %s\n", insn->data); estack_push(stack, top, ax, bx); estack_ax(stack, top)->u.s.str = insn->data; - estack_ax(stack, top)->u.s.seq_len = SIZE_MAX; + estack_ax(stack, top)->u.s.seq_len = LTTNG_SIZE_MAX; estack_ax(stack, top)->u.s.literal_type = ESTACK_STRING_LITERAL_TYPE_STAR_GLOB; estack_ax(stack, top)->u.s.user = 0; @@ -870,7 +871,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, ret = -EINVAL; goto end; } - estack_ax(stack, top)->u.s.seq_len = SIZE_MAX; + estack_ax(stack, top)->u.s.seq_len = LTTNG_SIZE_MAX; estack_ax(stack, top)->u.s.literal_type = ESTACK_STRING_LITERAL_TYPE_NONE; estack_ax(stack, top)->u.s.user = 0; @@ -920,7 +921,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data, ret = -EINVAL; goto end; } - estack_ax(stack, top)->u.s.seq_len = SIZE_MAX; + estack_ax(stack, top)->u.s.seq_len = LTTNG_SIZE_MAX; estack_ax(stack, top)->u.s.literal_type = ESTACK_STRING_LITERAL_TYPE_NONE; estack_ax(stack, top)->u.s.user = 1; diff --git a/wrapper/types.h b/wrapper/types.h new file mode 100644 index 00000000..556a67c5 --- /dev/null +++ b/wrapper/types.h @@ -0,0 +1,26 @@ +#ifndef _LTTNG_WRAPPER_TYPES_H +#define _LTTNG_WRAPPER_TYPES_H + +/* + * wrapper/types.h + * + * Copyright (C) 2017 Mathieu Desnoyers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; only + * version 2.1 of the License. + * + * 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 + */ + +#define LTTNG_SIZE_MAX (~(size_t)0) + +#endif /* _LTTNG_WRAPPER_TYPES_H */ -- 2.34.1