-
Notifications
You must be signed in to change notification settings - Fork 202
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
WASI signal numbers out of sync with wasi-libc signal numbers #272
Comments
Can I ask what you using those macros for? __wasi_proc_raise (along with all the signal macros) was removed from WASI back in 2019: WebAssembly/WASI#136. Given that, I think it might make more sense to simply remove these macros from signal.h. |
the public WASI API still shows signals: and wasi-libc provides a signal.h still in latest git (along with emulated code). i'm not sure what you mean by "remove these macros from signal.h" -- if signal.h doesn't provide signal numbers, then there's no point in providing any signal functions, and at that point, why provide a signal.h at all ? the project i'm working on relies on SIGWINCH to get keep track of terminal size changes. so when that happens, the next time the app hits a WASI interface (and transitions to the JS side), i call back into the app to run the registered SIGWINCH handler. having the emulated signal APIs has helped so i didn't have to write all the stubs myself. |
Can you use case be supported solely by emulation code in libc? Or does it really the (since removed) Assuming it can all be done in emulation at the libc layer perhaps we can just remove the signal related stuff from our local copy of |
Yes, signals are meant to be removed from WASI, since WebAssembly itself doesn't support signal delivery. So yes, it seems we should use the values in libc-top-half/musl/arch/wasm32/bits/signal.h and delete the values in libc-bottom-half/headers/public/wasi/api.h. |
no, because the terminal isn't in WASM. it's a web component. it being resized is an async event. rewriting the code to constantly poll "has this been resized" means a lot of wasted CPU cycles.
i'm not using that API, so its removal doesn't matter to me ;). i've implemented my own delivery mechanism (app exports a symbol for the JS side to callback into). it's ugly which is why i'm not asking for it to be generalized.
fwiw, i think a signalfd approach would be feasible and wouldn't get into any async/messaging concerns. |
Sorry, I guess what I was really asking here was: are you dependent on any of the removed/legacy WASI signal stuff in It sounds like you are not, and you have instead rolled you own signal delivery mechanism outside of WASI? Assuming that is true I think we can just remove the signal stuff from wasi/api.h to resolve this issue. |
I'm fine if both places drop signal logic. the stubs are not significant or complicated. |
Actually, updating |
it makes using WASI difficult when the API/SDK/libc are out sync, and people don't fix bugs under the guise "it'll probably resolve itself eventually ... somehow" even the latest WASI API still defines signals. removing the raise syscall doesn't change that. |
I'm optimistic we can find a way to remove the signal values from wasi/api.h without too much trouble. |
I'm not sure what you mean, WebAssembly/WASI#136 didn't just remove the raise syscall, it also removed the entire enumeration of signals. |
sorry, my checkout was still stuck on master. not sure when it migrated to main, but there's still a bunch of references to master in there. at any rate, the snapshot still talks about signals, and it continues to have changes merged that aren't merged into ephemeral (like |
WASI is in a transitional state right now. The goal has always been for WASI to build on underlying WebAssembly standards, and avoid having its own competing ways of doing things. A lot of the things we started building for WASI weren't initially covered by other standards, such as the snapshot-style versioning scheme, "new-style commands", weak symbols, the witx tooling, and so on, however in part due to WASI's experience with these things, these are now being subsumed by lower layers, such as interface types, module linking, and wit tooling. That said, some of these things are still evolving, and the tooling is not quite ready for things like wasi-libc, and this puts WASI in a somewhat awkward position where we aren't working on major changes to the old systems because we're expecting them to be replaced, and the new systems aren't here yet. All that said, I think there are things we can do better within the old systems to make them better for people using them today, and I think cleaning up the signal numbers is one of those things we can do. I'll work on a PR to propose a way to do this. |
oblig https://goomics.net/50/ from a user's pov, it's hard to square things. the commit to remove signal logic landed over two years ago. presumably debate & review started even before that. yet the wasi-sdk release from a few months ago still has it (in the API & libc). i guess changing the API is a "major change" which is why it wasn't included, but it also sees llvm release upgrades which i would call "major". new changes to wasi-libc are still landing too. i grok that WASI is breaking new ground here, and there are growing pains. the messaging is a bit inconsistent, so i don't really know what to expect. https://wasi.dev points to examples & outdated repos & outdated branches. are bug reports for wasi-libc & wasi-sdk & WASI API not desirable ? they're are in a frozen state until WASI API figures things out ? wasi-sdk-14 seems to have all the functionality i need at this point, and i doubt WASM will break backwards compat with it. so maybe i should be freezing to that API & SDK release, bugs/idiosyncrasies & all, and check back in on WASI API every year to see when it's usable again ? if there's any functionality missing, i'll keep adding my own APIs in a parallel namespace. i've done this for signals, sockets, termios, and some basic file/fd stuff, so it's not a blocker for me. |
Yes, I'm not trying to say it's amazing; I'm just trying to describe the current situation. If it looks like fallible humans doing their best to build a coherent system while the foundation underneath them is radically changing, it's because that's what it is. The existing code and docs aren't explicitly frozen, but we don't have many people volunteering to help maintain them, so we have limited resources and we're doing the best we can. |
The WASI signal constants and proc_raise function were removed in the latest [ephemeral], which had been scheduled to be in the next snapshot, however WASI itself is now transitioning away from the snapshot system. WASI libc will also be transitioning to updated wit specs once they're ready, however until that time, we can make the simple change of removing these signal constants to avoid confusion. Fixes #271. Fixes #272. [ephemeral]: https://github.com/WebAssembly/WASI/tree/main/phases/ephemeral/witx
The WASI signal constants and proc_raise function were removed in the latest [ephemeral], which had been scheduled to be in the next snapshot, however WASI itself is now transitioning away from the snapshot system. WASI libc will also be transitioning to updated wit specs once they're ready, however until that time, we can make the simple change of removing these signal constants to avoid confusion. Fixes #271. Fixes #272. [ephemeral]: https://github.com/WebAssembly/WASI/tree/main/phases/ephemeral/witx
if we compare
wasi-libc/libc-top-half/musl/arch/wasm32/bits/signal.h
withwasi/api.h
, we see wasi-libc definesSIGSTKFLT
as signal 16, but this signal does not exist in the WASI spec at all. this causes all remaining signals to be off-by-one.for example, the first few around the desync:
this makes working with signals kind of a pita as we have to maintain 2 tables and their mappings between them. from a simplicity pov, wasi-libc should just use the same set of signals & signal numbers as wasi api and call it a day.
The text was updated successfully, but these errors were encountered: