-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-83714: Use statx on more recent Linux to expose st_flags and st_btime on all platforms
#19125
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
Conversation
1c474bf to
bd158bb
Compare
bd158bb to
8a8bab2
Compare
667ece4 to
4d1edcc
Compare
On BSD/macOS this uses the value of `st_birthtime` (which remains for compatibity reasons), on Windows it duplicates the value of `st_ctime`. A Linux implementation is added in subsequent commits.
It cannot be enabled by default because this implementation does not have any fallback to plain stat for older kernels and Linux 4.11 is still fairly recent. The configure checks also ensure that the C library expose the proper stub functions (glibc 2.28+ only).
…D UF_* equivalent as defined by FreeBSD
4d1edcc to
9aae324
Compare
| Use the ``statx(2)`` system call for :func:`os.stat` under Linux to provide | ||
| cross-platform support for btime (time of file creation) and file | ||
| attributes. On Windows btime is emulated using ctime and both Linux and | ||
| Windows file attributes are converted to their (Free)BSD equivalent were |
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.
typo - "were" should be "where"
| STATX_ATTR_VERITY | ||
| STATX_ATTR_DAX | ||
|
|
||
| .. versionadded:: 3.12 |
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.
tip - update version markers in docs to "next" and it'll automagically use the right version.
|
Could this be performance checked against the existing |
|
Another take on this: How about not modifying The |
statx on more recent Linux to expose st_flags and st_btime on all platformsstatx on more recent Linux to expose st_flags and st_btime on all platforms
os.statx() has been added. This PR is now outdated, I close it. There is a discussion on using os.statx() in pathlib. |
|
Thanks @ntninja for your contribution even if it was taken as it is. Exposing new syscalls is non trivial, it takes time to decide how to expose it in Python. |
Still missing tests, but I'd appreciate feedback on the changes themselves in the meantime. Also ideas for properly testing
btimewould be appreciated.#83714