Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3566,9 +3566,9 @@ features:
STATX_WRITE_ATOMIC
STATX_DIO_READ_ALIGN

Bitflags for use in the *mask* parameter to :func:`os.statx`. Flags
including and after :const:`!STATX_MNT_ID` are only available when their
corresponding members in :class:`statx_result` are available.
Bitflags for use in the *mask* parameter to :func:`os.statx`. Some of these
flags may be available even when their corresponding members in
:class:`statx_result` are not available.

.. availability:: Linux >= 4.11 with glibc >= 2.28.

Expand Down
20 changes: 10 additions & 10 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3364,15 +3364,15 @@ static PyMemberDef pystatx_result_members[] = {
STATX_GET_UINT(st_uid, stx_uid, STATX_UID)
STATX_GET_UINT(st_gid, stx_gid, STATX_GID)
STATX_GET_UINT(st_nlink, stx_nlink, STATX_NLINK)
#ifdef STATX_DIOALIGN
#ifdef HAVE_STRUCT_STATX_STX_DIO_MEM_ALIGN
STATX_GET_UINT(stx_dio_mem_align, stx_dio_mem_align, STATX_DIOALIGN)
STATX_GET_UINT(stx_dio_offset_align, stx_dio_offset_align, STATX_DIOALIGN)
#endif
#ifdef STATX_DIO_READ_ALIGN
#ifdef HAVE_STRUCT_STATX_STX_DIO_READ_OFFSET_ALIGN
STATX_GET_UINT(stx_dio_read_offset_align, stx_dio_read_offset_align,
STATX_DIO_READ_ALIGN)
#endif
#ifdef STATX_WRITE_ATOMIC
#ifdef HAVE_STRUCT_STATX_STX_ATOMIC_WRITE_UNIT_MIN
STATX_GET_UINT(stx_atomic_write_unit_min, stx_atomic_write_unit_min,
STATX_WRITE_ATOMIC)
STATX_GET_UINT(stx_atomic_write_unit_max, stx_atomic_write_unit_max,
Expand Down Expand Up @@ -3401,10 +3401,10 @@ STATX_GET_UINT(stx_atomic_write_unit_max_opt, stx_atomic_write_unit_max_opt,
STATX_GET_ULONGLONG(st_blocks, stx_blocks, STATX_BLOCKS)
STATX_GET_ULONGLONG(st_ino, stx_ino, STATX_INO)
STATX_GET_ULONGLONG(st_size, stx_size, STATX_SIZE)
#ifdef STATX_MNT_ID
#ifdef HAVE_STRUCT_STATX_STX_MNT_ID
STATX_GET_ULONGLONG(stx_mnt_id, stx_mnt_id, STATX_MNT_ID)
#endif
#ifdef STATX_SUBVOL
#ifdef HAVE_STRUCT_STATX_STX_SUBVOL
STATX_GET_ULONGLONG(stx_subvol, stx_subvol, STATX_SUBVOL)
#endif

Expand Down Expand Up @@ -3463,25 +3463,25 @@ static PyGetSetDef pystatx_result_getset[] = {
G(st_ctime_ns, "time of last change in nanoseconds"),
G(st_mtime, "time of last modification"),
G(st_mtime_ns, "time of last modification in nanoseconds"),
#ifdef STATX_MNT_ID
#ifdef HAVE_STRUCT_STATX_STX_MNT_ID
G(stx_mnt_id, "mount ID"),
#endif
#ifdef STATX_DIOALIGN
#ifdef HAVE_STRUCT_STATX_STX_DIO_MEM_ALIGN
G(stx_dio_mem_align, "direct I/O memory buffer alignment"),
G(stx_dio_offset_align, "direct I/O file offset alignment"),
#endif
#ifdef STATX_SUBVOL
#ifdef HAVE_STRUCT_STATX_STX_SUBVOL
G(stx_subvol, "subvolume ID"),
#endif
#ifdef STATX_WRITE_ATOMIC
#ifdef HAVE_STRUCT_STATX_STX_ATOMIC_WRITE_UNIT_MIN
G(stx_atomic_write_unit_min,
"minimum size for direct I/O with torn-write protection"),
G(stx_atomic_write_unit_max,
"maximum size for direct I/O with torn-write protection"),
G(stx_atomic_write_segments_max,
"maximum iovecs for direct I/O with torn-write protection"),
#endif
#ifdef STATX_DIO_READ_ALIGN
#ifdef HAVE_STRUCT_STATX_STX_DIO_READ_OFFSET_ALIGN
G(stx_dio_read_offset_align, "direct I/O file offset alignment for reads"),
#endif
#ifdef HAVE_STRUCT_STATX_STX_ATOMIC_WRITE_UNIT_MAX_OPT
Expand Down
51 changes: 51 additions & 0 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -5826,6 +5826,17 @@ AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_passwd], [], [], [[
AC_CHECK_MEMBERS([siginfo_t.si_band], [], [], [[@%:@include <signal.h>]])

if test "$ac_cv_func_statx" = yes; then
# Some systems have the definitions of the mask bits without having the
# corresponding members in struct statx. Check for members added after Linux
# 4.11 (when statx itself was added).
AC_CHECK_MEMBERS([struct statx.stx_mnt_id])
AC_CHECK_MEMBERS([struct statx.stx_dio_mem_align])
# stx_dio_offset_align was added together with stx_dio_mem_align
AC_CHECK_MEMBERS([struct statx.stx_subvol])
AC_CHECK_MEMBERS([struct statx.stx_atomic_write_unit_min])
# stx_atomic_write_unit_max and stx_atomic_write_segments_max were added
# together with stx_atomic_write_unit_min
AC_CHECK_MEMBERS([struct statx.stx_dio_read_offset_align])
# stx_atomic_write_unit_max_opt was added in Linux 6.16, but is controlled by
# the STATX_WRITE_ATOMIC mask bit added in Linux 6.11, so having the mask bit
# doesn't imply having the member.
Expand Down
17 changes: 17 additions & 0 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,23 @@
statx'. */
#undef HAVE_STRUCT_STATX_STX_ATOMIC_WRITE_UNIT_MAX_OPT

/* Define to 1 if 'stx_atomic_write_unit_min' is a member of 'struct statx'.
*/
#undef HAVE_STRUCT_STATX_STX_ATOMIC_WRITE_UNIT_MIN

/* Define to 1 if 'stx_dio_mem_align' is a member of 'struct statx'. */
#undef HAVE_STRUCT_STATX_STX_DIO_MEM_ALIGN

/* Define to 1 if 'stx_dio_read_offset_align' is a member of 'struct statx'.
*/
#undef HAVE_STRUCT_STATX_STX_DIO_READ_OFFSET_ALIGN

/* Define to 1 if 'stx_mnt_id' is a member of 'struct statx'. */
#undef HAVE_STRUCT_STATX_STX_MNT_ID

/* Define to 1 if 'stx_subvol' is a member of 'struct statx'. */
#undef HAVE_STRUCT_STATX_STX_SUBVOL

/* Define to 1 if 'st_birthtime' is a member of 'struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BIRTHTIME

Expand Down
Loading