diff options
author | Matt Turner <mattst88@gmail.com> | 2020-12-21 09:09:43 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2020-12-21 09:09:43 -0300 |
commit | d552058570ea2c00fb88b4621be3285cda03033f (patch) | |
tree | 1a0e1808c551ddc443f17fc43f719cbd8a8f5231 /sysdeps/unix/sysv/linux/alpha/bits | |
parent | cad5ad81d2f7f58a7ad0d8afa8c1b7101a0301fb (diff) | |
download | glibc-d552058570ea2c00fb88b4621be3285cda03033f.zip glibc-d552058570ea2c00fb88b4621be3285cda03033f.tar.gz glibc-d552058570ea2c00fb88b4621be3285cda03033f.tar.bz2 |
alpha: Remove anonymous union in struct stat [BZ #27042]
This is clever, but it confuses downstream detection in at least zstd
and GNOME's glib. zstd has preprocessor tests for the 'st_mtime' macro,
which is not provided by the path using the anonymous union; glib checks
for the presence of 'st_mtimensec' in struct stat but then tries to
access that field in struct statx (which might be a bug on its own).
Checked with a build for alpha-linux-gnu.
Diffstat (limited to 'sysdeps/unix/sysv/linux/alpha/bits')
-rw-r--r-- | sysdeps/unix/sysv/linux/alpha/bits/struct_stat.h | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/struct_stat.h b/sysdeps/unix/sysv/linux/alpha/bits/struct_stat.h index 1c9b424..d2aae9f 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/struct_stat.h @@ -23,37 +23,6 @@ #ifndef _BITS_STRUCT_STAT_H #define _BITS_STRUCT_STAT_H 1 -/* Nanosecond resolution timestamps are stored in a format equivalent to - 'struct timespec'. This is the type used whenever possible but the - Unix namespace rules do not allow the identifier 'timespec' to appear - in the <sys/stat.h> header. Therefore we have to handle the use of - this header in strictly standard-compliant sources special. - - Use neat tidy anonymous unions and structures when possible. */ - -#ifdef __USE_XOPEN2K8 -# if __GNUC_PREREQ(3,3) -# define __ST_TIME(X) \ - __extension__ union { \ - struct timespec st_##X##tim; \ - struct { \ - __time_t st_##X##time; \ - unsigned long st_##X##timensec; \ - }; \ - } -# else -# define __ST_TIME(X) struct timespec st_##X##tim -# define st_atime st_atim.tv_sec -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -# endif -#else -# define __ST_TIME(X) \ - __time_t st_##X##time; \ - unsigned long st_##X##timensec -#endif - - struct stat { __dev_t st_dev; /* Device. */ @@ -77,9 +46,27 @@ struct stat __blksize_t st_blksize; /* Optimal block size for I/O. */ __nlink_t st_nlink; /* Link count. */ int __pad2; /* Real padding. */ - __ST_TIME(a); /* Time of last access. */ - __ST_TIME(m); /* Time of last modification. */ - __ST_TIME(c); /* Time of last status change. */ +#ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif long __glibc_reserved[3]; }; @@ -98,15 +85,31 @@ struct stat64 __blksize_t st_blksize; /* Optimal block size for I/O. */ __nlink_t st_nlink; /* Link count. */ int __pad0; /* Real padding. */ - __ST_TIME(a); /* Time of last access. */ - __ST_TIME(m); /* Time of last modification. */ - __ST_TIME(c); /* Time of last status change. */ +#ifdef __USE_XOPEN2K8 + /* Nanosecond resolution timestamps are stored in a format + equivalent to 'struct timespec'. This is the type used + whenever possible but the Unix namespace rules do not allow the + identifier 'timespec' to appear in the <sys/stat.h> header. + Therefore we have to handle the use of this header in strictly + standard-compliant sources special. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ +# define st_atime st_atim.tv_sec /* Backward compatibility. */ +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#else + __time_t st_atime; /* Time of last access. */ + unsigned long int st_atimensec; /* Nscecs of last access. */ + __time_t st_mtime; /* Time of last modification. */ + unsigned long int st_mtimensec; /* Nsecs of last modification. */ + __time_t st_ctime; /* Time of last status change. */ + unsigned long int st_ctimensec; /* Nsecs of last status change. */ +#endif long __glibc_reserved[3]; }; #endif -#undef __ST_TIME - /* Tell code we have these members. */ #define _STATBUF_ST_BLKSIZE #define _STATBUF_ST_RDEV |