mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 23:00:07 +00:00
y2038: include: Move struct __timespec64 definition to a separate file
The struct __timespec64's definition has been moved from ./include/time.h to ./include/struct___timespec64.h. This change would prevent from polluting other glibc namespaces (when headers are modified to support 64 bit time on architectures with __WORDSIZE==32). Now it is possible to just include definition of this particular structure when needed. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
parent
b9cde4e3aa
commit
390b5a4727
27
include/struct___timespec64.h
Normal file
27
include/struct___timespec64.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef _STRUCT_TIMESPEC64_H
|
||||||
|
#define _STRUCT_TIMESPEC64_H
|
||||||
|
|
||||||
|
#if __TIMESIZE == 64
|
||||||
|
# define __timespec64 timespec
|
||||||
|
#else
|
||||||
|
#include <endian.h>
|
||||||
|
/* The glibc Y2038-proof struct __timespec64 structure for a time value.
|
||||||
|
To keep things Posix-ish, we keep the nanoseconds field a 32-bit
|
||||||
|
signed long, but since the Linux field is a 64-bit signed int, we
|
||||||
|
pad our tv_nsec with a 32-bit unnamed bit-field padding.
|
||||||
|
|
||||||
|
As a general rule the Linux kernel is ignoring upper 32 bits of
|
||||||
|
tv_nsec field. */
|
||||||
|
struct __timespec64
|
||||||
|
{
|
||||||
|
__time64_t tv_sec; /* Seconds */
|
||||||
|
# if BYTE_ORDER == BIG_ENDIAN
|
||||||
|
__int32_t :32; /* Padding */
|
||||||
|
__int32_t tv_nsec; /* Nanoseconds */
|
||||||
|
# else
|
||||||
|
__int32_t tv_nsec; /* Nanoseconds */
|
||||||
|
__int32_t :32; /* Padding */
|
||||||
|
# endif
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
#endif /* _STRUCT_TIMESPEC64_H */
|
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
#ifndef _ISOMAC
|
#ifndef _ISOMAC
|
||||||
# include <bits/types/struct_timeval.h>
|
# include <bits/types/struct_timeval.h>
|
||||||
|
# include <struct___timespec64.h>
|
||||||
# include <bits/types/locale_t.h>
|
# include <bits/types/locale_t.h>
|
||||||
# include <stdbool.h>
|
# include <stdbool.h>
|
||||||
# include <time/mktime-internal.h>
|
# include <time/mktime-internal.h>
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <endian.h>
|
|
||||||
# include <time-clockid.h>
|
# include <time-clockid.h>
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
|
|
||||||
@ -61,28 +61,6 @@ extern void __tzset_parse_tz (const char *tz) attribute_hidden;
|
|||||||
extern void __tz_compute (__time64_t timer, struct tm *tm, int use_localtime)
|
extern void __tz_compute (__time64_t timer, struct tm *tm, int use_localtime)
|
||||||
__THROW attribute_hidden;
|
__THROW attribute_hidden;
|
||||||
|
|
||||||
#if __TIMESIZE == 64
|
|
||||||
# define __timespec64 timespec
|
|
||||||
#else
|
|
||||||
/* The glibc Y2038-proof struct __timespec64 structure for a time value.
|
|
||||||
To keep things Posix-ish, we keep the nanoseconds field a 32-bit
|
|
||||||
signed long, but since the Linux field is a 64-bit signed int, we
|
|
||||||
pad our tv_nsec with a 32-bit unnamed bit-field padding.
|
|
||||||
|
|
||||||
As a general rule the Linux kernel is ignoring upper 32 bits of
|
|
||||||
tv_nsec field. */
|
|
||||||
struct __timespec64
|
|
||||||
{
|
|
||||||
__time64_t tv_sec; /* Seconds */
|
|
||||||
# if BYTE_ORDER == BIG_ENDIAN
|
|
||||||
__int32_t :32; /* Padding */
|
|
||||||
__int32_t tv_nsec; /* Nanoseconds */
|
|
||||||
# else
|
|
||||||
__int32_t tv_nsec; /* Nanoseconds */
|
|
||||||
__int32_t :32; /* Padding */
|
|
||||||
# endif
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __TIMESIZE == 64
|
#if __TIMESIZE == 64
|
||||||
# define __itimerspec64 itimerspec
|
# define __itimerspec64 itimerspec
|
||||||
|
Loading…
Reference in New Issue
Block a user