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

Remove redundant checked_cast, add utimes family #128

Merged
merged 9 commits into from
Jul 19, 2022

Conversation

carbotaniuman
Copy link
Contributor

As the comment in one of the files says, I'm not sure what Rustix's story is wrt 64bit time on 32-bit systems.

This also adds some_or_ret_einval, which I'm down to bikeshed, but it should get rid of all the unwraps for parsing flags from bits.

@carbotaniuman
Copy link
Contributor Author

Hmmm I thought x86 kernels didn't have 64 bit time support until 5.1, and we were still on 2.x something... Weird. It looks like we're 64-bit time always?

@sunfishcode
Copy link
Owner

Rustix uses 64-bit time types always, and uses the 64-bit APIs when the platform has them. It falls back to the 32-bit APIs when it needs to, though it converts everything to/from 64-bit types, and fails if the conversions ever fail. The idea is to be y2038-compatible when running on kernels that support the APIs to be y2038-compatible.

@sunfishcode
Copy link
Owner

That said, I believe mustang doesn't currently handle this correctly. Mustang should use libc's timespec_t and other types in its APIs, and convert to/from rustix's Timespec etc. as needed.

@carbotaniuman
Copy link
Contributor Author

I am so confused as to how this breaks... It appears to be an ICE in some macro expansion code?

@carbotaniuman
Copy link
Contributor Author

Ah, new Rust nightly ICE... Any reason with Rustix provides both futimes and utimensat? Just for ergonomic purposes, or is there some kernel difference?

@sunfishcode
Copy link
Owner

Passing a NULL pathname in utimensat is not portable outside of Linux, so having a separate futimens more closely reflects how the libc backend works. And ergonomics :-).

@sunfishcode
Copy link
Owner

It looks like the ICE might be due to rust-lang/rust#99261.

@sunfishcode
Copy link
Owner

main now has pinned a version of nightly; so if you rebase this on main it should be fixed.

c-scape/src/fs/utime.rs Outdated Show resolved Hide resolved
c-scape/src/time/mod.rs Outdated Show resolved Hide resolved
@sunfishcode sunfishcode merged commit c1ce132 into sunfishcode:main Jul 19, 2022
@sunfishcode
Copy link
Owner

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants