Skip to content
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

Add nanosecond precision to File.utime (UNIX) #15335

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ysbaddaden
Copy link
Contributor

Reopens #9392 with fixes to the android and solaris bindings, and #system_utime has already been updated to support nanosecond precision when available.

@straight-shoota straight-shoota added this to the 1.16.0 milestone Jan 10, 2025
@straight-shoota
Copy link
Member

AT_FDCWD seems to be missing for aarch64-linux-android.

@Sija
Copy link
Contributor

Sija commented Jan 10, 2025

I hope that unlike #9392, this won't drop support for macOS < 10.13, High Sierra

@straight-shoota
Copy link
Member

straight-shoota commented Jan 10, 2025

I suppose it would, assuming utimensat isn't available on MacOS < 10.13. The implementation is pretty much identical to #9392.

What's your concern with MacOS < 10.13? It has been EOL since 2019 so I don't see much reason to keep up support.
Also we might already not support such old versions anyway: #9392 (comment)

It might be possible to do something similar to bytecodealliance/rustix#275 to keep old versions supported, but I doubt the effort would be justified.

The `utimensat` and `futimens` syscalls only appeared in macOS 10.14. To
keep some backward compatibility, the x86_64 bindings are fixed to not
declare them. We can however assume the syscalls to be present when
compiling for aarch64.

`Crystal::System::File.utime` now falls back to `utimes` when `futimens`
isn't defined.

Adds the missing `AT_FDCWD` constant to aarch64-android bindings. Fixes
the DragonflyBSD binding.
@ysbaddaden
Copy link
Contributor Author

ysbaddaden commented Jan 10, 2025

I kept the legacy syscalls for macOS x86_64 builds to keep support with macOS < 10.14, but use the new ones for aarch64 targets that's only supported since macOS 11+ (hence always fine).

I also fixed the aarch64-android and dragonflybsd bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants