Fix: fix compilation errors when using --disable-epoll
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 71 lines · Simon Marchi
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_VALUEis defined inside an #ifdefHAVE_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.cis only compiled if epoll is not available or disabled, which you can do with --disable-epoll. In my case, I ended up usingcompat-poll.cbecause theAX_HAVE_EPOLLmacro 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 <[email protected]>--- src/common/compat/compat-poll.c | 2 +- tests/unit/test_utils_compat_poll.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-)src/common/compat/compat-poll.c +1
-1@@ -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;tests/unit/test_utils_compat_poll.c +7
-0@@ -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
tests/unit/test_utils_compat_poll.c int lttng_opt_mi; · line 66
Quoted 10 lines
tests/unit/test_utils_compat_poll.c +0
-5#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
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev