3 ms·
At my previous job, I needed to access the birth time attribute of a file on Linux. If I am not mistaken, the standard library doesn't support getting it on Lin
by chriskaneen 6y ago
At my previous job, I needed to access the birth time attribute of a file on Linux. If I am not mistaken, the standard library doesn't support getting it on Linux (st_birthtime - time of file creation is supported on other unix systems, such as freebsd, see: https://docs.python.org/2/library/os.html#os.stat https://docs.python.org/2/library/os.html#os.stat). So, I created this wrapper for getting the file status (birth time, etc.) using the statx(2) linux system call.
- cmeacham98 6y agoWhy not use the statx wrapper in glibc, seeing as you already seem to be using the syscall wrapper via ctypes.CDLL(None).syscall? Possible self-answer: that wrapper only exists on glibc >= 2.28.
- LukeShu 6y agoFor reference for other readers: The statx(2) system call was added in Linux 4.11, released on 2017-04-30. The statx(3) libc wrapper was added in GNU libc 2.28, released on 2018-08-01.