[PATCH 2/2] linux: Keep time64 stat size independent of feature macros [BZ #32119]
Matthias Goergens <[email protected]> Wed, 5 Aug 2026 16:03:04 +0800
| Newsgroups | gmane.comp.lib.glibc.alpha |
|---|---|
| Message-ID | <[email protected]> |
The time64 stat helper adds two reserved words only when POSIX.1-2008 interfaces are hidden. This makes the public structure larger under an older feature-test macro, although stat does not populate these fields. Remove the reserved words and compare sizes in the feature-mode test. This restores the strict-mode layout used before the helper refactoring and matches the default and internal time64 layouts. Signed-off-by: Matthias Goergens <[email protected]> --- io/tst-stat-layout-time64-legacy.c | 6 ++++++ io/tst-stat-layout-time64.c | 2 ++ sysdeps/unix/sysv/linux/bits/struct_stat_time64_helper.h | 3 --- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/io/tst-stat-layout-time64-legacy.c b/io/tst-stat-layout-time64-legacy.c index 1694b3d3..b5547aaa 100644 --- a/io/tst-stat-layout-time64-legacy.c +++ b/io/tst-stat-layout-time64-legacy.c @@ -33,3 +33,9 @@ stat_ctimensec_offset_with_posix_2001 (void) { return offsetof (struct stat, st_ctimensec); } + +size_t +stat_size_with_posix_2001 (void) +{ + return sizeof (struct stat); +} diff --git a/io/tst-stat-layout-time64.c b/io/tst-stat-layout-time64.c index 52b19b48..62d82eb6 100644 --- a/io/tst-stat-layout-time64.c +++ b/io/tst-stat-layout-time64.c @@ -22,6 +22,7 @@ size_t stat_ctime_offset_with_posix_2001 (void); size_t stat_ctimensec_offset_with_posix_2001 (void); +size_t stat_size_with_posix_2001 (void); static int do_test (void) @@ -30,6 +31,7 @@ do_test (void) stat_ctime_offset_with_posix_2001 ()); TEST_COMPARE (offsetof (struct stat, st_ctim.tv_nsec), stat_ctimensec_offset_with_posix_2001 ()); + TEST_COMPARE (sizeof (struct stat), stat_size_with_posix_2001 ()); return 0; } diff --git a/sysdeps/unix/sysv/linux/bits/struct_stat_time64_helper.h b/sysdeps/unix/sysv/linux/bits/struct_stat_time64_helper.h index 1399f3f4..0ce85352 100644 --- a/sysdeps/unix/sysv/linux/bits/struct_stat_time64_helper.h +++ b/sysdeps/unix/sysv/linux/bits/struct_stat_time64_helper.h @@ -61,8 +61,5 @@ __fieldts64 (st_mtime); __fieldts64 (st_ctime); - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; - # undef __fieldts64 #endif -- 2.55.0