Skip to content

[libc] Add ppoll stub to match existing pselect stub. NFC#26084

Merged
sbc100 merged 1 commit intoemscripten-core:mainfrom
sbc100:ppoll
Jan 12, 2026
Merged

[libc] Add ppoll stub to match existing pselect stub. NFC#26084
sbc100 merged 1 commit intoemscripten-core:mainfrom
sbc100:ppoll

Conversation

@sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Jan 11, 2026

This is mostly just for consistency and completeness.

This is mostly just for consistency and completeness.
@sbc100 sbc100 changed the title Ppoll [libc] Add ppoll stub to match existing pselect stub. NFC Jan 11, 2026
@sbc100 sbc100 requested review from aheejin and kripken January 11, 2026 15:24
@sbc100 sbc100 enabled auto-merge (squash) January 11, 2026 21:22
@sbc100 sbc100 merged commit 42da3c5 into emscripten-core:main Jan 12, 2026
35 checks passed
@sbc100 sbc100 deleted the ppoll branch January 12, 2026 16:53
inolen pushed a commit to inolen/emscripten that referenced this pull request Feb 13, 2026
@thiblahute
Copy link

Why are we defining function that won't work at runtime? In the GLib we have a check in meson.build to check if the function exists, and if it doesn't us poll() instead, but with that stub, we end up using ppoll and fail.

@sbc100
Copy link
Collaborator Author

sbc100 commented Mar 18, 2026

Why are we defining function that won't work at runtime? In the GLib we have a check in meson.build to check if the function exists, and if it doesn't us poll() instead, but with that stub, we end up using ppoll and fail.

IIUC, this is how emscripten has worked since its inception. If you don't want the stubs we have a setting to disabled them: https://emscripten.org/docs/tools_reference/settings_reference.html#allow-unimplemented-syscalls

@kleisauke
Copy link
Collaborator

@thiblahute For GLib specifically, you might also be interested in this changeset:
GNOME/glib@2.88.0...kleisauke:wasm-vips-2.88.0
(see e.g. https://gist.github.com/kleisauke/acfa1c09522705efa5eb0541d2d00887)

This would also remove the need for the performance-unfriendly -sEMULATE_FUNCTION_POINTER_CASTS linker option.

@thiblahute
Copy link

@kleisauke You mean GNOME/glib@db7b8c4 or something else? This is not gonna get upstreamed, so I do not think it is an option. Have you measured the overhead of using -sEMULATE_FUNCTION_POINTER_CASTS ?

@kleisauke
Copy link
Collaborator

For poll() it's kleisauke/glib@bb3098f, which makes GPollFD APIs (e.g. g_wakeup_get_pollfd()) no-op. But you're right, these patches are not suitable for upstreaming, hence why I marked them as blocked here:
Stable release for wasm-vips

Have you measured the overhead of using -sEMULATE_FUNCTION_POINTER_CASTS ?

It's been over six years since I last measured this, so the results may no longer be accurate. Perhaps it was the same issue as observed in PR #26478.

@sbc100
Copy link
Collaborator Author

sbc100 commented Mar 18, 2026

For ppoll specifically, I think we can followup by actually implement ppoll and pselect in emscripten (since we already support poll and select and these are basically the same modulo some signal handling stuff which emscripten doesn't support anyway).

I will probably do something very similar to what I did for pipe2 here: #26480

sbc100 added a commit to sbc100/emscripten that referenced this pull request Mar 18, 2026
Because we don't support true async signals this is safe to do in
userspace.

Followup to emscripten-core#26084
sbc100 added a commit to sbc100/emscripten that referenced this pull request Mar 18, 2026
Because we don't support true async signals this is safe to do in
userspace.

Followup to emscripten-core#26084
sbc100 added a commit to sbc100/emscripten that referenced this pull request Mar 18, 2026
Because we don't support true async signals this is safe to do in
userspace.

Followup to emscripten-core#26084
sbc100 added a commit to sbc100/emscripten that referenced this pull request Mar 18, 2026
Because we don't support true async signals this is safe to do in
userspace.

Followup to emscripten-core#26084
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.

4 participants