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
16#include "stdint.h"16#include "stdint.h"
17#include "stddef.h"17#include "stddef.h"
18 18
19#include <linux/types.h>
20
19/* those are commonly provided by sys/types.h */21/* those are commonly provided by sys/types.h */
20typedef unsigned int dev_t;22typedef unsigned int dev_t;
21typedef unsigned long ino_t;23typedef unsigned long ino_t;
@@ -27,6 +29,6 @@ typedef unsigned long nlink_t; · 5 unmodified lines
27typedef signed long off_t;29typedef signed long off_t;
28typedef signed long blksize_t;30typedef signed long blksize_t;
29typedef signed long blkcnt_t;31typedef signed long blkcnt_t;
30typedef signed long time_t;32typedef __kernel_old_time_t time_t;
31 33
32#endif /* _NOLIBC_STD_H */34#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