* [PATCH] passt: Rename EPOLL_EVENTS to PASST_EPOLL_EVENTS
@ 2025-10-09 14:32 Laurent Vivier
2025-10-10 7:46 ` David Gibson
0 siblings, 1 reply; 3+ messages in thread
From: Laurent Vivier @ 2025-10-09 14:32 UTC (permalink / raw)
To: passt-dev; +Cc: Laurent Vivier
The macro EPOLL_EVENTS conflicts with enum EPOLL_EVENTS defined in
sys/epoll.h (glibc).
Rename the local macro to PASST_EPOLL_EVENTS to avoid this namespace
collision.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
passt.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/passt.c b/passt.c
index 31fbb75b1b12..8307e0057360 100644
--- a/passt.c
+++ b/passt.c
@@ -54,7 +54,7 @@
#include "migrate.h"
#include "repair.h"
-#define EPOLL_EVENTS 8
+#define PASST_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[PASST_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, PASST_EPOLL_EVENTS, TIMER_INTERVAL);
/* NOLINTEND(bugprone-branch-clone) */
if (nfds == -1 && errno != EINTR)
die_perror("epoll_wait() failed in main loop");
--
2.50.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] passt: Rename EPOLL_EVENTS to PASST_EPOLL_EVENTS
2025-10-09 14:32 [PATCH] passt: Rename EPOLL_EVENTS to PASST_EPOLL_EVENTS Laurent Vivier
@ 2025-10-10 7:46 ` David Gibson
2025-10-10 8:02 ` Laurent Vivier
0 siblings, 1 reply; 3+ messages in thread
From: David Gibson @ 2025-10-10 7:46 UTC (permalink / raw)
To: Laurent Vivier; +Cc: passt-dev
[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]
On Thu, Oct 09, 2025 at 04:32:29PM +0200, Laurent Vivier wrote:
> The macro EPOLL_EVENTS conflicts with enum EPOLL_EVENTS defined in
> sys/epoll.h (glibc).
>
> Rename the local macro to PASST_EPOLL_EVENTS to avoid this namespace
> collision.
Maybe "NUM_EPOLL_EVENTS" since this also has an entirely unrelated
meaning to the libc enum.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> passt.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/passt.c b/passt.c
> index 31fbb75b1b12..8307e0057360 100644
> --- a/passt.c
> +++ b/passt.c
> @@ -54,7 +54,7 @@
> #include "migrate.h"
> #include "repair.h"
>
> -#define EPOLL_EVENTS 8
> +#define PASST_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[PASST_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, PASST_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 --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] passt: Rename EPOLL_EVENTS to PASST_EPOLL_EVENTS
2025-10-10 7:46 ` David Gibson
@ 2025-10-10 8:02 ` Laurent Vivier
0 siblings, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2025-10-10 8:02 UTC (permalink / raw)
To: David Gibson; +Cc: passt-dev
On 10/10/2025 09:46, David Gibson wrote:
> On Thu, Oct 09, 2025 at 04:32:29PM +0200, Laurent Vivier wrote:
>> The macro EPOLL_EVENTS conflicts with enum EPOLL_EVENTS defined in
>> sys/epoll.h (glibc).
>>
>> Rename the local macro to PASST_EPOLL_EVENTS to avoid this namespace
>> collision.
>
> Maybe "NUM_EPOLL_EVENTS" since this also has an entirely unrelated
> meaning to the libc enum.
I update the patch.
Thanks,
Laurent
>
>>
>> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
>> ---
>> passt.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/passt.c b/passt.c
>> index 31fbb75b1b12..8307e0057360 100644
>> --- a/passt.c
>> +++ b/passt.c
>> @@ -54,7 +54,7 @@
>> #include "migrate.h"
>> #include "repair.h"
>>
>> -#define EPOLL_EVENTS 8
>> +#define PASST_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[PASST_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, PASST_EPOLL_EVENTS, TIMER_INTERVAL);
>> /* NOLINTEND(bugprone-branch-clone) */
>> if (nfds == -1 && errno != EINTR)
>> die_perror("epoll_wait() failed in main loop");
>> --
>> 2.50.1
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-10 8:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-09 14:32 [PATCH] passt: Rename EPOLL_EVENTS to PASST_EPOLL_EVENTS Laurent Vivier
2025-10-10 7:46 ` David Gibson
2025-10-10 8:02 ` Laurent Vivier
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).