-
Notifications
You must be signed in to change notification settings - Fork 200
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
AT_FDCWD undefined? #42
Comments
So WASI has no working directory. https://github.com/musec/libpreopen emulates it instead. https://github.com/musec/libpreopen probably need to wrap even |
That's right. The WASI API layer has no concept of |
Issue already exists musec/libpreopen#11 . |
Ah I see the libraries are vendored in. @sunfishcode if |
We do have numerous local changes to libpreopen, so it's not trivial to do. At a high level, libpreopen is architected to work in a Capsicum-like environment where it's a library on top of libc. However in WASI libc, we're using it as part of the libc, which changes how some things work. If anyone wants to implement this in upstream libpreopen, I'm happy to update WASI's vendored copy. That said, this feature seems like it will be a little tricky to do as a library on top of libc. It would want to intercept For example, we could do this:
|
Yeah fair point about this interposition being such a pain with C having no namespacing. |
I almost want to go rewrite with https://gitlab.redox-os.org/redox-os/relibc, haha. |
It's straightforward (if a bit ugly) to intercept *at and conditionally pass through to the real function, using |
That's a clever idea. WASI libc doesn't support dynamic linking yet though, so for our purposes here, we'll still need some other approach. |
@emaste it would also be interesting to use CPP / configure script to prefix the function names. that would work for static linking too to some extent. |
I started sketching out a minimal version of my idea above, but many of the changes are relatively mechanical and I ended up with a complete, though still rough, draft: #54. |
AT_FDCWD is a special constant in POSIX that can be passed to *at functions to indicate the current working directory. Since the current working directory is emulated in wasi libc, add emulated AT_FDCWD support as well. Fixes #42.
AT_FDCWD is a special constant in POSIX that can be passed to *at functions to indicate the current working directory. Since the current working directory is emulated in wasi libc, add emulated AT_FDCWD support as well. Fixes #42.
This is now fixed, in #230. |
AT_FDCWD is a special constant in POSIX that can be passed to *at functions to indicate the current working directory. Since the current working directory is emulated in wasi libc, add emulated AT_FDCWD support as well. Fixes WebAssembly#42.
I'm getting this issue building gnulib areadlink.c. The source is available here:
https://github.com/coreutils/gnulib/blob/master/lib/areadlink.c
The error is this:
AT_FDCWD should be available in wasi, correct? I can't find any direct references outside of Musl though. If it's not provided, what alternatives are available?
You can repro this with nix:
/cc @Ericson2314
The text was updated successfully, but these errors were encountered: