-
Notifications
You must be signed in to change notification settings - Fork 19
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
fd_allocate on Windows #19
Comments
There doesn't appear to be a way to implement |
yamt
added a commit
to yamt/toywasm
that referenced
this issue
Oct 3, 2022
add a reference to WebAssembly/wasi-filesystem#19
it makes sense as the functionality is rarely used at best. otherwise, another option would be to provide an api w/o changing the size instead.
|
sunfishcode
added a commit
that referenced
this issue
Oct 10, 2022
There does not appear to be a way to implement `allocate` in a non-racy way on Windows or macOS. Fixes #19.
Merged
sunfishcode
added a commit
that referenced
this issue
Oct 19, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have not found a way to implement
fd_allocate
on Windows in a non-racy way.SetFileInformationByHandle
andSetEndOfFile
can change a file's size, but will also silently truncate a file if it happens to be longer than the requested length.WriteFile
can change a file's size, but needs to write at least one byte in order to do so.One option would be to remove
fd_allocate
from WASI. Use cases wherefd_allocate
is being used to increase a file's size may be able to usefilestat_set_size
orpwrite
themselves. It may make sense to have wasi-libc provide an optional emulated version ofposix_fallocate
that works in terms offileestat_set_size
-- it would be racy, but some applications would be ok with that, and applications are in a better position to make that determination than WASI implementations.Another option would be to specify that
fd_allocate
can truncate files. This would differ fromposix_fallocate
, but would be more portable. It may make sense for wasi-libc to provide an optional emulated version ofposix_fallocate
which checks the file length and adjusts the requested length before callingfd_allocate
-- it would be racy, but as above, some applications would be ok with that.The text was updated successfully, but these errors were encountered: