Skip to content

Commit d2b1254

Browse files
committed
y2038: Use a common definition for stat for sparc32
The sparc32 misses support for support done by 4e85213. Checked on sparcv9-linux-gnu.
1 parent a0f0c08 commit d2b1254

File tree

1 file changed

+31
-23
lines changed

1 file changed

+31
-23
lines changed

sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,35 @@
2828

2929
struct stat
3030
{
31+
#ifdef __USE_TIME_BITS64
32+
# include <bits/struct_stat_time64_helper.h>
33+
#else
3134
__dev_t st_dev; /* Device. */
32-
#if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64
35+
# if __WORDSIZE == 64 || !defined __USE_FILE_OFFSET64
3336
unsigned short int __pad1;
3437
__ino_t st_ino; /* File serial number. */
35-
#else
38+
# else
3639
__ino64_t st_ino; /* File serial number. */
37-
#endif
40+
# endif
3841
__mode_t st_mode; /* File mode. */
3942
__nlink_t st_nlink; /* Link count. */
4043
__uid_t st_uid; /* User ID of the file's owner. */
4144
__gid_t st_gid; /* Group ID of the file's group.*/
4245
__dev_t st_rdev; /* Device number, if device. */
4346
unsigned short int __pad2;
44-
#ifndef __USE_FILE_OFFSET64
47+
# ifndef __USE_FILE_OFFSET64
4548
__off_t st_size; /* Size of file, in bytes. */
46-
#else
49+
# else
4750
__off64_t st_size; /* Size of file, in bytes. */
48-
#endif
51+
# endif
4952
__blksize_t st_blksize; /* Optimal block size for I/O. */
5053

51-
#ifndef __USE_FILE_OFFSET64
54+
# ifndef __USE_FILE_OFFSET64
5255
__blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
53-
#else
56+
# else
5457
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
55-
#endif
56-
#ifdef __USE_XOPEN2K8
58+
# endif
59+
# ifdef __USE_XOPEN2K8
5760
/* Nanosecond resolution timestamps are stored in a format
5861
equivalent to 'struct timespec'. This is the type used
5962
whenever possible but the Unix namespace rules do not allow the
@@ -63,28 +66,32 @@ struct stat
6366
struct timespec st_atim; /* Time of last access. */
6467
struct timespec st_mtim; /* Time of last modification. */
6568
struct timespec st_ctim; /* Time of last status change. */
66-
# define st_atime st_atim.tv_sec /* Backward compatibility. */
67-
# define st_mtime st_mtim.tv_sec
68-
# define st_ctime st_ctim.tv_sec
69-
#else
69+
# define st_atime st_atim.tv_sec /* Backward compatibility. */
70+
# define st_mtime st_mtim.tv_sec
71+
# define st_ctime st_ctim.tv_sec
72+
# else
7073
__time_t st_atime; /* Time of last access. */
7174
unsigned long int st_atimensec; /* Nscecs of last access. */
7275
__time_t st_mtime; /* Time of last modification. */
7376
unsigned long int st_mtimensec; /* Nsecs of last modification. */
7477
__time_t st_ctime; /* Time of last status change. */
7578
unsigned long int st_ctimensec; /* Nsecs of last status change. */
76-
#endif
79+
# endif
7780
unsigned long int __glibc_reserved4;
7881
unsigned long int __glibc_reserved5;
82+
#endif /* __USE_TIME_BITS64 */
7983
};
8084

8185
#ifdef __USE_LARGEFILE64
8286
struct stat64
8387
{
88+
# ifdef __USE_TIME_BITS64
89+
# include <bits/struct_stat_time64_helper.h>
90+
# else
8491
__dev_t st_dev; /* Device. */
85-
# if __WORDSIZE == 64
92+
# if __WORDSIZE == 64
8693
unsigned short int __pad1;
87-
# endif
94+
# endif
8895
__ino64_t st_ino; /* File serial number. */
8996
__mode_t st_mode; /* File mode. */
9097
__nlink_t st_nlink; /* Link count. */
@@ -96,7 +103,7 @@ struct stat64
96103
__blksize_t st_blksize; /* Optimal block size for I/O. */
97104

98105
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
99-
# ifdef __USE_XOPEN2K8
106+
# ifdef __USE_XOPEN2K8
100107
/* Nanosecond resolution timestamps are stored in a format
101108
equivalent to 'struct timespec'. This is the type used
102109
whenever possible but the Unix namespace rules do not allow the
@@ -106,19 +113,20 @@ struct stat64
106113
struct timespec st_atim; /* Time of last access. */
107114
struct timespec st_mtim; /* Time of last modification. */
108115
struct timespec st_ctim; /* Time of last status change. */
109-
# define st_atime st_atim.tv_sec /* Backward compatibility. */
110-
# define st_mtime st_mtim.tv_sec
111-
# define st_ctime st_ctim.tv_sec
112-
# else
116+
# define st_atime st_atim.tv_sec /* Backward compatibility. */
117+
# define st_mtime st_mtim.tv_sec
118+
# define st_ctime st_ctim.tv_sec
119+
# else
113120
__time_t st_atime; /* Time of last access. */
114121
unsigned long int st_atimensec; /* Nscecs of last access. */
115122
__time_t st_mtime; /* Time of last modification. */
116123
unsigned long int st_mtimensec; /* Nsecs of last modification. */
117124
__time_t st_ctime; /* Time of last status change. */
118125
unsigned long int st_ctimensec; /* Nsecs of last status change. */
119-
# endif
126+
# endif
120127
unsigned long int __glibc_reserved4;
121128
unsigned long int __glibc_reserved5;
129+
# endif /* __USE_TIME_BITS64 */
122130
};
123131
#endif
124132

0 commit comments

Comments
 (0)