History

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.

Thomas Weißschuh committed 1 year ago

Commit d5094bc1 parent 750aef51 file · +3 −1Browse files

Showing the changes to tools/include (1 of 1 file). Show all

Unified · Split

tools/include/nolibc/std.h+3−1
@@ -16,6 +16,8 @@ · 15 unmodified lines
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; · 5 unmodified lines
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 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t