Skip to content

Commit d5094bc

Browse files
committed
tools/nolibc: define time_t in terms of __kernel_old_time_t
Nolibc assumes that the kernel ABI is using a time values that are as large as a long integer. For most ABIs this holds true. But for x32 this is not correct, as it uses 32bit longs but 64bit times. Also the 'struct stat' implementation of nolibc relies on timespec::tv_sec and time_t being the same type. While timespec::tv_sec comes from the kernel and is of type __kernel_old_time_t, time_t is defined within nolibc. Switch to the __kernel_old_time_t to always get the correct type. Signed-off-by: Thomas Weißschuh <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Willy Tarreau <[email protected]>
1 parent 750aef5 commit d5094bc

File tree

1 file changed

+3
-1
lines changed
  • tools/include/nolibc

1 file changed

+3
-1
lines changed

tools/include/nolibc/std.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include "stdint.h"
1717
#include "stddef.h"
1818

19+
#include <linux/types.h>
20+
1921
/* those are commonly provided by sys/types.h */
2022
typedef unsigned int dev_t;
2123
typedef unsigned long ino_t;
@@ -27,6 +29,6 @@ typedef unsigned long nlink_t;
2729
typedef signed long off_t;
2830
typedef signed long blksize_t;
2931
typedef signed long blkcnt_t;
30-
typedef signed long time_t;
32+
typedef __kernel_old_time_t time_t;
3133

3234
#endif /* _NOLIBC_STD_H */

0 commit comments

Comments
 (0)