Skip to content

Fix epoll_pwait2 feature detection#184

Merged
ioquatix merged 1 commit into
mainfrom
gaia-autopr-fix-epoll-pwait2-probe
Jun 15, 2026
Merged

Fix epoll_pwait2 feature detection#184
ioquatix merged 1 commit into
mainfrom
gaia-autopr-fix-epoll-pwait2-probe

Conversation

@samuel-williams-shopify

@samuel-williams-shopify samuel-williams-shopify commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Fix epoll_pwait2 feature detection so Android/Termux can fall back to epoll_wait when the header does not declare epoll_pwait2.

Context

Closes #155

The reported Termux build has a linkable epoll_pwait2 symbol, so mkmf's bare have_func("epoll_pwait2") probe can define HAVE_EPOLL_PWAIT2. However, Android's <sys/epoll.h> in that environment does not declare epoll_pwait2, so compiling epoll.c fails with an implicit function declaration error under C99.

Changes

The probe now checks an epoll_pwait2(0, 0, 0, 0, 0) call expression through <sys/epoll.h>. This keeps the generated macro as HAVE_EPOLL_PWAIT2 while requiring the declaration to be visible to the compiler.

Platforms whose headers expose the API still use epoll_pwait2; Android/Termux configurations that only expose the symbol leave the macro undefined and continue using the existing epoll_wait fallback.

Tophatting

  • bundle exec rubocop -A
  • ruby ext/extconf.rb

The local extconf run reports checking for epoll_pwait2(0, 0, 0, 0, 0) in sys/epoll.h... no on this machine, which matches the intended header-aware fallback behavior when the declaration is unavailable.

@samuel-williams-shopify samuel-williams-shopify force-pushed the gaia-autopr-fix-epoll-pwait2-probe branch 4 times, most recently from b208330 to df460d5 Compare June 15, 2026 09:51
The Termux Android build can expose an epoll_pwait2 symbol while omitting the corresponding declaration from <sys/epoll.h>. The previous mkmf probe only checked whether the symbol could be linked, so extconf.rb generated HAVE_EPOLL_PWAIT2 even though epoll.c could not compile a real call to the function under C99 implicit-declaration rules.

Probe epoll_pwait2 using the same header and a concrete call expression instead. This keeps HAVE_EPOLL_PWAIT2 enabled on platforms where the header declares the API, while allowing Android/Termux to fall back to the existing epoll_wait path.

Closes #155
@samuel-williams-shopify samuel-williams-shopify force-pushed the gaia-autopr-fix-epoll-pwait2-probe branch from df460d5 to 734c25d Compare June 15, 2026 10:15
@ioquatix ioquatix marked this pull request as ready for review June 15, 2026 12:44
@ioquatix ioquatix merged commit 08ce4e2 into main Jun 15, 2026
75 of 96 checks passed
@ioquatix ioquatix deleted the gaia-autopr-fix-epoll-pwait2-probe branch June 15, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to install.io-event: error: call to undeclared function 'epoll_pwait2'

2 participants