From: Simon Marchi <simon.marchi@efficios.com>
To: lttng-dev@lists.lttng.org
Subject: Re: [PATCH lttng-tools] Fix: fix compilation errors when using --disable-epoll
Date: Mon, 19 Aug 2019 21:47:24 -0400 [thread overview]
Message-ID: <6030d176-429d-da43-be7d-a85c2014bb8a__45694.2745762476$1566265686$gmane$org@efficios.com> (raw)
In-Reply-To: <20190527162838.11675-1-simon.marchi@efficios.com>
On 2019-05-27 12:28 p.m., Simon Marchi wrote:
> I get this error:
>
> CC compat-poll.lo
> /home/smarchi/src/lttng-tools/src/common/compat/compat-poll.c: In function ‘compat_poll_wait’:
> /home/smarchi/src/lttng-tools/src/common/compat/compat-poll.c:353:7: error: ‘ipfd’ undeclared (first use in this function)
> if (ipfd->revents != 0) {
> ^~~~
>
> which just seems like a typo.
>
> A second error occurs later:
>
> CC test_utils_compat_poll.o
> /home/smarchi/src/lttng-tools/tests/unit/test_utils_compat_poll.c: In function ‘test_mod_wait’:
> /home/smarchi/src/lttng-tools/tests/unit/test_utils_compat_poll.c:138:24: error: ‘MAGIC_VALUE’ undeclared (first use in this function)
> char rbuf = 0, tbuf = MAGIC_VALUE;
> ^~~~~~~~~~~
>
> The problem is that MAGIC_VALUE is defined inside an #ifdef HAVE_EPOLL,
> but is used even if !HAVE_EPOLL. Move it outside the ifdef, and adjust
> the spelling and grammatical errors in the comments.
>
> Note that compat-poll.c is only compiled if epoll is not available or
> disabled, which you can do with --disable-epoll. In my case,
> I ended up using compat-poll.c because the AX_HAVE_EPOLL macro does not
> work correctly when configuring with "-Wall -Werror". I'll tackle this
> issue separately.
>
> I only built-tested the proposed change, and I don't know anything about
> this code, so please check carefully that it is right.
>
> Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
> ---
> src/common/compat/compat-poll.c | 2 +-
> tests/unit/test_utils_compat_poll.c | 12 +++++++-----
> 2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/src/common/compat/compat-poll.c b/src/common/compat/compat-poll.c
> index 0220b27854ab..254ce271e71c 100644
> --- a/src/common/compat/compat-poll.c
> +++ b/src/common/compat/compat-poll.c
> @@ -350,7 +350,7 @@ int compat_poll_wait(struct lttng_poll_event *events, int timeout)
> struct pollfd *idle_pfd = &events->wait.events[idle_pfd_index];
> struct pollfd *current_pfd = &events->wait.events[i];
>
> - if (ipfd->revents != 0) {
> + if (idle_pfd->revents != 0) {
> swap_pfd = *current_pfd;
> *current_pfd = *idle_pfd;
> *idle_pfd = swap_pfd;
> diff --git a/tests/unit/test_utils_compat_poll.c b/tests/unit/test_utils_compat_poll.c
> index 1eb327a6a708..c8cac544d531 100644
> --- a/tests/unit/test_utils_compat_poll.c
> +++ b/tests/unit/test_utils_compat_poll.c
> @@ -47,6 +47,13 @@ int lttng_opt_mi;
> #define NUM_TESTS 45
> #endif
>
> +/*
> + * Non-zero 8-bits arbitrary value below 0x7f to ensure no sign extension
> + * occurs. It is used to verify that the value is properly propagated through
> + * the pipe.
> + */
> +#define MAGIC_VALUE ((char)0x5A)
> +
> #ifdef HAVE_EPOLL
> #if defined(HAVE_EPOLL_CREATE1) && defined(EPOLL_CLOEXEC)
> #define CLOE_VALUE EPOLL_CLOEXEC
> @@ -54,11 +61,6 @@ int lttng_opt_mi;
> #define CLOE_VALUE FD_CLOEXEC
> #endif
>
> -/* Non-zero 8-bits arbitrary value below 0x7f to ensure no sign extension
> - * used to verify that the value is properly propagated throught the pipe.
> - */
> -#define MAGIC_VALUE ((char)0x5A)
> -
> void test_epoll_compat(void)
> {
> /*
>
Ping.
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
parent reply other threads:[~2019-08-20 1:47 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20190527162838.11675-1-simon.marchi@efficios.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='6030d176-429d-da43-be7d-a85c2014bb8a__45694.2745762476$1566265686$gmane$org@efficios.com' \
--to=simon.marchi@efficios.com \
--cc=lttng-dev@lists.lttng.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).