@@ -20,17 +20,21 @@
#include "stdint.h"
-/* those are commonly provided by sys/types.h */
-typedef unsigned int dev_t;
-typedef unsigned long ino_t;
-typedef unsigned int mode_t;
-typedef signed int pid_t;
-typedef unsigned int uid_t;
-typedef unsigned int gid_t;
-typedef unsigned long nlink_t;
-typedef signed long off_t;
-typedef signed long blksize_t;
-typedef signed long blkcnt_t;
-typedef signed long time_t;
+#include <linux/posix_types.h>
+
+/* based on linux/types.h */
+typedef uint32_t __kernel_dev_t;
+
+typedef __kernel_dev_t dev_t;
+typedef __kernel_ulong_t ino_t;
+typedef __kernel_mode_t mode_t;
+typedef __kernel_pid_t pid_t;
+typedef __kernel_uid32_t uid_t;
+typedef __kernel_gid32_t gid_t;
+typedef __kernel_loff_t off_t;
+typedef __kernel_time64_t time_t;
+typedef uint32_t nlink_t;
+typedef uint32_t blksize_t;
+typedef uint64_t blkcnt_t;
#endif /* _NOLIBC_STD_H */
clean up std.h with include/uapi/linux/posix_types.h convert time_t to 64bit even in 32bit platforms, for y2038 issue. align off_t and blkcnt_t with 'struct statx' in include/uapi/linux/stat.h Suggested-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/linux-riscv/83ab9f47-e1ed-463c-a717-26aad6bf2b71@app.fastmail.com/ Signed-off-by: Zhangjin Wu <falcon@tinylab.org> --- tools/include/nolibc/std.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)