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 statx linux system call so we can implement fs::Metadata::created on Linux #1178

Closed
ariasuni opened this issue Dec 17, 2018 · 4 comments · Fixed by #1378
Closed

Add statx linux system call so we can implement fs::Metadata::created on Linux #1178

ariasuni opened this issue Dec 17, 2018 · 4 comments · Fixed by #1378

Comments

@ariasuni
Copy link

Right now, std::fs::Metadata::created returns an Err on Linux. But the creation time is available with the statx system call.

https://unix.stackexchange.com/a/407305/289105

@alexcrichton
Copy link
Member

Should be fine to send a PR to add this API!

@gnzlbg
Copy link
Contributor

gnzlbg commented Dec 17, 2018

We haven't added other syscalls in the past (e.g. memfd_create: #902 (comment)). There is nothing blocking using this syscall in std::fs btw, you can just use syscall to call it yourselfe, like, e.g., I did with memfd_create here: https://github.com/gnzlbg/slice_deque/blob/master/src/mirrored/linux.rs#L18


EDIT: e.g. in the docs of statx it says:

There is no glibc wrapper for statx(); see NOTES.

such that the only easy way to call it is using syscall anyways. If there isn't a const for doing this call, we should probably expose that constant here though.

@ariasuni
Copy link
Author

@gnzlbg There is a statx() wrapper in glibc but the man page is not up-to-date (fixed upstream but not yet released).

I’m not sure what’s the best way to access the creation information under Linux (if I want to implement a workaround in the meantime), since you mentioned using the syscall directly (note btw that there’s no SYS_statx in the libc crate).

@ariasuni ariasuni mentioned this issue Dec 23, 2018
gnzlbg added a commit to gnzlbg/libc that referenced this issue May 29, 2019
@gnzlbg
Copy link
Contributor

gnzlbg commented May 29, 2019

There does not seem to be any open rust-lang/rust issues about this.

bors added a commit that referenced this issue May 29, 2019
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 a pull request may close this issue.

3 participants