-
Notifications
You must be signed in to change notification settings - Fork 199
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
Is it possible to not use preopen? #431
Comments
I think I kind of have my answer, looking here. So I implemented these: fd_prestat_get
fd_prestat_dir_name
fd_fdstat_get
path_filestat_get Since I was leaving out main, wasi's
It does the mapping for you, so now instead of 3, it's 6 (since the name was sent to wasm using I will close this. Sorry for the noise. |
I am working on a very simple browser-host, manually, and I having a tough time with preopens. I got some ideas from here and they seem to not use them, but I can't figure out how to make wasi-libc expose that.
I have a synchronous VFS in the host (it's a zip + localstorage, using browserfs) and I can access any file as needed, but I think I am missing some key part of how wasi/wasi-libc tries to access files.
stat
that file in the zip-file.Here is an example:
my test code:
I am not using
main
and compile with this:The
printf
works fine withstdout
:I see it calling
fd_prestat_get
withfd:3
:If I have to preload all the files, that sort of works, but I am not sure how to tell my host "
3
meansassets/cyberpunk.txt
". Without me telling the wasm, it just decided that is3
. Also, I am a bit concerned about files that are created from wasm, since the VFS can handle all that on the fly, but I will have to double-manage it (inserting things into some other out-of-vfs array, to keep them in sync.)I'd rather just be able to call something on the fly when it asks for
assets/cyberpunk.txt
, and just know what thefd
number means, in the host.My goal is that people can write "regular looking C" and have it work in browser & native, with the same zip file (for read, and however I do synchronous persistant filesystem for write.) I think the actual filesystem part is covered, I am just having trouble with how to expose it to wasm made with wasi-libc.
Here is what I would like to do, in order of preference:
fd
and filename before it uses it, so I can map it in the host: "whenever wasm asks for 3, give it this file"fd
path_
functions do this, right? Or maybe the otherfd_
functions?)3
to a filename.Are any of these possible?
The text was updated successfully, but these errors were encountered: