From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v2] passt: Rename EPOLL_EVENTS to NUM_EPOLL_EVENTS
Date: Sat, 11 Oct 2025 10:34:57 +1100 [thread overview]
Message-ID: <aOmYIT8MhnyQxcCE@zatzit> (raw)
In-Reply-To: <20251010084651.1426628-1-lvivier@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2008 bytes --]
On Fri, Oct 10, 2025 at 10:46:51AM +0200, Laurent Vivier wrote:
> The macro EPOLL_EVENTS conflicts with enum EPOLL_EVENTS defined in
> sys/epoll.h (glibc).
>
> Rename the local macro to NUM_EPOLL_EVENTS to avoid this namespace
> collision.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>
> Notes:
> v2: Rename PASST_EPOLL_EVENTS to NUM_EPOLL_EVENTS for better clarity
>
> passt.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/passt.c b/passt.c
> index 31fbb75b1b12..bdb7b6935f0c 100644
> --- a/passt.c
> +++ b/passt.c
> @@ -54,7 +54,7 @@
> #include "migrate.h"
> #include "repair.h"
>
> -#define EPOLL_EVENTS 8
> +#define NUM_EPOLL_EVENTS 8
>
> #define TIMER_INTERVAL__ MIN(TCP_TIMER_INTERVAL, UDP_TIMER_INTERVAL)
> #define TIMER_INTERVAL_ MIN(TIMER_INTERVAL__, ICMP_TIMER_INTERVAL)
> @@ -245,7 +245,7 @@ static void print_stats(const struct ctx *c, const struct passt_stats *stats,
> */
> int main(int argc, char **argv)
> {
> - struct epoll_event events[EPOLL_EVENTS];
> + struct epoll_event events[NUM_EPOLL_EVENTS];
> struct passt_stats stats = { 0 };
> int nfds, i, devnull_fd = -1;
> struct ctx c = { 0 };
> @@ -349,7 +349,7 @@ int main(int argc, char **argv)
> loop:
> /* NOLINTBEGIN(bugprone-branch-clone): intervals can be the same */
> /* cppcheck-suppress [duplicateValueTernary, unmatchedSuppression] */
> - nfds = epoll_wait(c.epollfd, events, EPOLL_EVENTS, TIMER_INTERVAL);
> + nfds = epoll_wait(c.epollfd, events, NUM_EPOLL_EVENTS, TIMER_INTERVAL);
> /* NOLINTEND(bugprone-branch-clone) */
> if (nfds == -1 && errno != EINTR)
> die_perror("epoll_wait() failed in main loop");
> --
> 2.50.1
>
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2025-10-10 23:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-10 8:46 Laurent Vivier
2025-10-10 23:34 ` David Gibson [this message]
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=aOmYIT8MhnyQxcCE@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--cc=passt-dev@passt.top \
/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.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
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 IMAP folder(s).