Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds wait4/wait3 to libc build, fixes #19188 #22397

Merged
merged 2 commits into from
Aug 25, 2024

Conversation

Mai-Lapyst
Copy link
Contributor

Fixes missing wait4 and wait3 functions by adding the relevant source files from the musl libc to the build process of the libc.

@kripken
Copy link
Member

kripken commented Aug 22, 2024

Do these functions work in our environment? They are related to process management, which we have only minimal support for.

@Mai-Lapyst
Copy link
Contributor Author

Do these functions work in our environment? They are related to process management, which we have only minimal support for.

They "work" the same way as waitpid works, which is currently implemented. It internally calls __syscall_wait4 which then gets a warning with wasmtime for example, but atleast the binary now compiles which previously it wouldn't (see #19188). This is annoying when trying to compile code that relies on the wait4 symbol to be present.

@sbc100
Copy link
Collaborator

sbc100 commented Aug 23, 2024

Hm,.. but I don't see __syscall_wait4 defined anywhere, so I would have though this would still be a linker error.

Presumably you should add __syscall_wait4 to system/lib/libc/emscripten_syscall_stubs.c and then also add a test to confirm that linking against wait4 and wait3 doesn't fail?

@sbc100
Copy link
Collaborator

sbc100 commented Aug 23, 2024

Oh, sorry I see that we do already have stub for __syscall_wait4.. its was just hard to grep for:

UNIMPLEMENTED(wait4,(int pid, intptr_t wstatus, int options, int rusage))

In that case I think all we need is a test for these new functions (and maybe waitpid while you are at it). Maybe add a new test/other/test_syscall_stubs.c?

@Mai-Lapyst
Copy link
Contributor Author

Oh, sorry I see that we do already have stub for __syscall_wait4.. its was just hard to grep for:

UNIMPLEMENTED(wait4,(int pid, intptr_t wstatus, int options, int rusage))

In that case I think all we need is a test for these new functions (and maybe waitpid while you are at it). Maybe add a new test/other/test_syscall_stubs.c?

Have added it like requested. Also manually verified that it fails prior to this change, and succeeds after applying it.

@sbc100 sbc100 enabled auto-merge (squash) August 25, 2024 04:09
@sbc100 sbc100 merged commit c66e8cf into emscripten-core:main Aug 25, 2024
27 checks passed
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.

3 participants