Stream: wasm

Topic: ✔ wasi, open, and O_CLOEXEC


view this post on Zulip Scott Waye (Feb 05 2022 at 15:55):

I understand the O_CLOEXEC was for a fork/exec race condition. If it's specified to open in wasi-sdk, is it just ignored?

view this post on Zulip Dan Gohman (Feb 05 2022 at 16:01):

Yes; O_CLOEXEC is defined to be 0 on WASI.

view this post on Zulip Dan Gohman (Feb 05 2022 at 16:05):

WASI in the future will gain a way to spawn new programs which will likely need to be different from POSIX fork/exec, and as such, will likely avoid the whole O_CLOEXEC situation. But it's also possible that libc will re-introduce a concept of child "processes" inheriting non-O_CLOEXEC file descriptors as compatibility constructs to support existing code.

view this post on Zulip Dan Gohman (Feb 05 2022 at 16:06):

When that happens, O_CLOEXEC will become significant. But for now, it's ignored.

view this post on Zulip Scott Waye (Feb 05 2022 at 16:32):

Ok, thanks. Emscripten defines it as 0x80000 for some reason so I had a problem mixing emscripten object files with wasi-sdk. I shouldn't do that.....

view this post on Zulip Notification Bot (Feb 05 2022 at 17:07):

Scott Waye has marked this topic as resolved.


Last updated: Dec 23 2024 at 12:05 UTC