summaryrefslogtreecommitdiff
path: root/debian/patches/y2038-force-2.diff
blob: 4403d98538582b654230d51e4209c3017475c179 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
commit 60e147c762e532345755bd68a3d012ba44db004c
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Wed Mar 4 15:25:30 2020 +0100

    y2038: force time64 symbols
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Index: glibc-2.31-2038-5/include/features.h
===================================================================
--- glibc-2.31-2038-5.orig/include/features.h
+++ glibc-2.31-2038-5/include/features.h
@@ -376,13 +376,23 @@
 # define __USE_LARGEFILE64	1
 #endif
 
+/* We need to know the word size in order to check the time size.  */
+#include <bits/timesize.h>
+
+/* force _FILE_OFFSET_BITS and _TIME_BITS */
+#if !defined _LIBC && __TIMESIZE == 32
+#if !(defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64)
+#define _FILE_OFFSET_BITS 64
+#endif
+#if !(defined _TIME_BITS && _TIME_BITS == 64)
+#define _TIME_BITS 64
+#endif
+#endif
+
 #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
 # define __USE_FILE_OFFSET64	1
 #endif
 
-/* We need to know the word size in order to check the time size.  */
-#include <bits/wordsize.h>
-
 #if defined _TIME_BITS
 # if _TIME_BITS == 64
 #  if ! defined (_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64
Index: glibc-2.31-2038-5/sysdeps/unix/sysv/linux/kernel-features.h
===================================================================
--- glibc-2.31-2038-5.orig/sysdeps/unix/sysv/linux/kernel-features.h
+++ glibc-2.31-2038-5/sysdeps/unix/sysv/linux/kernel-features.h
@@ -178,35 +178,9 @@
      timerfd_settime(64)
      utimensat(_time64)
 
-   On architectures where time_t has historically been 64 bits,
-   only the 64-bit version of each system call exists, and there
-   are no suffixes on the __NR_ constants.
-
-   On architectures where time_t has historically been 32 bits,
-   both 32-bit and 64-bit versions of each system call may exist,
-   depending on the kernel version.  When the 64-bit version exists,
-   there is a '64' or '_time64' suffix on the name of its __NR_
-   constant, as shown above.
-
-   This flag is always set for Linux 5.1 and later.  Prior to that
-   version, it is set only for some CPU architectures and ABIs:
-
-   - __WORDSIZE == 64 - all supported architectures where pointers
-     are 64 bits also have always had 64-bit time_t.
-
-   - __WORDSIZE == 32 && __SYSCALL_WORDSIZE == 64 - this describes
-     only one supported configuration, x86's 'x32' subarchitecture,
-     where pointers are 32 bits but time_t has always been 64 bits.
-
-   __ASSUME_TIME64_SYSCALLS being set does not mean __TIMESIZE is 64,
-   and __TIMESIZE equal to 64 does not mean __ASSUME_TIME64_SYSCALLS
-   is set.  All four cases are possible.  */
-
-#if __LINUX_KERNEL_VERSION >= 0x050100                          \
-  || __WORDSIZE == 64                                           \
-  || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64)
+     Assume we are using a new kernel for now
+*/
 # define __ASSUME_TIME64_SYSCALLS 1
-#endif
 
 /* Linux waitid prior kernel 5.4 does not support waiting for the current
    process group.  */
Index: glibc-2.31-2038-5/sysdeps/unix/sysv/linux/x86/bits/timesize.h
===================================================================
--- glibc-2.31-2038-5.orig/sysdeps/unix/sysv/linux/x86/bits/timesize.h
+++ glibc-2.31-2038-5/sysdeps/unix/sysv/linux/x86/bits/timesize.h
@@ -16,6 +16,8 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <bits/wordsize.h>
+
 #if defined __x86_64__ && defined __ILP32__
 /* For x32, time is 64-bit even though word size is 32-bit.  */
 # define __TIMESIZE	64