@@ -3383,6 +3383,137 @@ features:
33833383 Added the :attr: `st_birthtime ` member on Windows.
33843384
33853385
3386+ .. function :: statx(path, mask, *, dir_fd=None, follow_symlinks=True, sync=None)
3387+
3388+ Get the status of a file or file descriptor by performing a :c:func: `!statx `
3389+ system call on the given path. *path * may be specified as either a string or
3390+ bytes -- directly or indirectly through the :class: `PathLike ` interface --
3391+ or as an open file descriptor. *mask * is a combination of the module-level
3392+ :const: `STATX_* <STATX_TYPE> ` constants specifying the information to
3393+ retrieve. Returns a :class: `statx_result ` object whose
3394+ :attr: `~os.statx_result.stx_mask ` attribute specifies the information
3395+ actually retrieved (which may differ from *mask *).
3396+
3397+ The optional parameter *sync * controls the freshness of the returned
3398+ information. ``sync=True `` requests that the kernel return up-to-date
3399+ information, even when doing so is expensive (for example, requiring a
3400+ round trip to the server for a file on a network filesystem).
3401+ ``sync=False `` requests that the kernel return cached information if
3402+ available. ``sync=None `` expresses no preference, in which case the kernel
3403+ will return information as fresh as :func: `~os.stat ` does.
3404+
3405+ This function supports :ref: `specifying a file descriptor <path_fd >`,
3406+ :ref: `paths relative to directory descriptors <dir_fd >`, and
3407+ :ref: `not following symlinks <follow_symlinks >`.
3408+
3409+ .. seealso :: The :manpage:`statx(2)` man page.
3410+
3411+ .. availability :: Linux >= 4.11 with glibc >= 2.28.
3412+
3413+ .. versionadded :: next
3414+
3415+
3416+ .. class :: statx_result
3417+
3418+ Object whose attributes correspond roughly to the members of the
3419+ :c:struct: `!statx ` structure. It is used for the result of :func: `os.statx `.
3420+ :class: `!statx_result ` has all of the attributes of :class: `stat_result `
3421+ available on Linux, but is not a subclass of :class: `stat_result ` nor a
3422+ tuple. :class: `!statx_result ` has the following additional attributes:
3423+
3424+ .. attribute :: stx_mask
3425+
3426+ Bitmask of :const: `STATX_* <STATX_TYPE> ` constants specifying the
3427+ information retrieved, which may differ from what was requested depending
3428+ on the filesystem, filesystem type, and kernel version. All attributes
3429+ of this class are accessible regardless of the value of
3430+ :attr: `!stx_mask `, and they may have useful fictitious values. For
3431+ example, for a file on a network filesystem, :const: `STATX_UID ` and
3432+ :const: `STATX_GID ` may be unset because file ownership on the server is
3433+ based on an external user database, but :attr: `!st_uid ` and
3434+ :attr: `!st_gid ` may contain the IDs of the local user who controls the
3435+ mount.
3436+
3437+ .. attribute :: stx_attributes_mask
3438+
3439+ Bitmask of :const: `!STATX_ATTR_* <stat.STATX_ATTR_COMPRESSED> ` constants
3440+ specifying the attributes bits supported for this file.
3441+
3442+ .. attribute :: stx_attributes
3443+
3444+ Bitmask of :const: `!STATX_ATTR_* <stat.STATX_ATTR_COMPRESSED> ` constants
3445+ specifying the attributes of this file.
3446+
3447+ .. attribute :: stx_mnt_id
3448+
3449+ Mount ID.
3450+
3451+ .. attribute :: stx_dio_mem_align
3452+
3453+ Direct I/O memory buffer alignment requirement.
3454+
3455+ .. attribute :: stx_dio_offset_align
3456+
3457+ Direct I/O file offset alignment requirement.
3458+
3459+ .. attribute :: stx_subvol
3460+
3461+ Subvolume ID.
3462+
3463+ .. attribute :: stx_atomic_write_unit_min
3464+
3465+ Minimum size for direct I/O with torn-write protection.
3466+
3467+ .. attribute :: stx_atomic_write_unit_max
3468+
3469+ Maximum size for direct I/O with torn-write protection.
3470+
3471+ .. attribute :: stx_atomic_write_segments_max
3472+
3473+ Maximum iovecs for direct I/O with torn-write protection.
3474+
3475+ .. attribute :: stx_dio_read_offset_align
3476+
3477+ Direct I/O file offset alignment requirement for reads.
3478+
3479+ .. attribute :: stx_atomic_write_unit_max_opt
3480+
3481+ Maximum optimized size for direct I/O with torn-write protection.
3482+
3483+ .. seealso :: The :manpage:`statx(2)` man page.
3484+
3485+ .. availability :: Linux >= 4.11 with glibc >= 2.28.
3486+
3487+ .. versionadded :: next
3488+
3489+
3490+ .. data :: STATX_TYPE
3491+ STATX_MODE
3492+ STATX_NLINK
3493+ STATX_UID
3494+ STATX_GID
3495+ STATX_ATIME
3496+ STATX_MTIME
3497+ STATX_CTIME
3498+ STATX_INO
3499+ STATX_SIZE
3500+ STATX_BLOCKS
3501+ STATX_BASIC_STATS
3502+ STATX_BTIME
3503+ STATX_MNT_ID
3504+ STATX_DIOALIGN
3505+ STATX_MNT_ID_UNIQUE
3506+ STATX_SUBVOL
3507+ STATX_WRITE_ATOMIC
3508+ STATX_DIO_READ_ALIGN
3509+
3510+ Bitflags for use as the *mask * parameter to :func: `os.statx `.
3511+
3512+ .. availability :: Linux >= 4.11 with glibc >= 2.28.
3513+
3514+ .. versionadded :: next
3515+
3516+
33863517.. function :: statvfs(path)
33873518
33883519 Perform a :c:func: `!statvfs ` system call on the given path. The return value is
0 commit comments