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

Emulate <signal.h> #183

Merged
merged 1 commit into from
May 29, 2020
Merged

Emulate <signal.h> #183

merged 1 commit into from
May 29, 2020

Conversation

sunfishcode
Copy link
Member

@sunfishcode sunfishcode commented Mar 10, 2020

wasm doesn't support signals, so therefore wasi-libc doesn't support signals.

But we can emulate them, at least for the synchronous raise case. This PR now implements basic signal emulation.

[edited to reflect the new content of the PR]

Copy link
Collaborator

@pchickey pchickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good place to start. Not sure how I feel about raise(SIGABRT) either, but clearly most of this should be deleted. We can look into adding the very limited functionality we do support in follow-up PR.

wasm doesn't support signals, so provide an emulation layer, enabled
with -D_WASI_EMULATED_SIGNAL and -lwasi-emulated-signal.
@sunfishcode
Copy link
Member Author

I ended up rewriting this PR to implement an emulation layer instead of just removing everything, so this PR now supports raise(SIGABRT), and even signal(SIGABRT, SIG_IGN). The emulation layer is disabled by default, and enabled with -D_WASI_EMULATED_SIGNAL, similar to -D_WASI_EMULATED_MMAN which provides mmap support.

I have some tests that I'll submit to wasi-sdk's testsuite separately.

Copy link
Collaborator

@pchickey pchickey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me!

@sunfishcode sunfishcode changed the title Don't install <signal.h>. Emulate <signal.h> May 29, 2020
@sunfishcode sunfishcode merged commit d1cd4f4 into master May 29, 2020
@sunfishcode sunfishcode deleted the no-signal branch May 29, 2020 20:07
sbc100 added a commit to WebAssembly/waterfall that referenced this pull request May 30, 2020
sbc100 added a commit to WebAssembly/waterfall that referenced this pull request May 30, 2020
sbc100 added a commit to llvm/llvm-project that referenced this pull request Jun 1, 2020
arichardson pushed a commit to arichardson/llvm-project that referenced this pull request Jul 6, 2020
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.

2 participants