-
Notifications
You must be signed in to change notification settings - Fork 189
Follow-up fixes to make it work with wasi-libc #1095
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
Follow-up fixes to make it work with wasi-libc #1095
Conversation
They are not available on WASI, so we gate them behind `os(WASI)`.
wasi-libc does not provide `futimes` as it is a legacy function. https://github.com/WebAssembly/wasi-libc/blob/574b88da481569b65a237cb80daf9a2d5aeaf82d/libc-top-half/musl/include/sys/time.h#L34
@swift-ci test |
try $0.withMemoryRebound(to: timeval.self, capacity: 2) { | ||
if futimes(dstFD, $0) != 0 { | ||
try $0.withMemoryRebound(to: timespec.self, capacity: 2) { | ||
if futimens(dstFD, $0) != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I just spent some time looking into and working around this issue for Android before I saw your pull, so I'm all for this futimens()
change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Gate `fchown` and `fchmod` calls behind `os(WASI)` They are not available on WASI, so we gate them behind `os(WASI)`. * Add missing constant shims for wasi-libc * Use `futimens` instead of legacy `futimes` wasi-libc does not provide `futimes` as it is a legacy function. https://github.com/WebAssembly/wasi-libc/blob/574b88da481569b65a237cb80daf9a2d5aeaf82d/libc-top-half/musl/include/sys/time.h#L34
* Fix WASI build of `_copyDirectoryMetadata` (#1094) Extended attributes don't exist in WASI, so we need to exclude the use of xattr-related APIs including `flistxattr`. * Follow-up fixes to make it work with wasi-libc (#1095) * Gate `fchown` and `fchmod` calls behind `os(WASI)` They are not available on WASI, so we gate them behind `os(WASI)`. * Add missing constant shims for wasi-libc * Use `futimens` instead of legacy `futimes` wasi-libc does not provide `futimes` as it is a legacy function. https://github.com/WebAssembly/wasi-libc/blob/574b88da481569b65a237cb80daf9a2d5aeaf82d/libc-top-half/musl/include/sys/time.h#L34 * Don't try to set extended attributes on Android (#1106) Normal users don't have permission to change these, even for their own files. --------- Co-authored-by: finagolfin <finagolfin@tuta.io>
Fix remaining build issues with wasi-libc for missing functions, some constant shims, and replace a legacy libc function use (
futimes
) withfutimens