diff mbox series

[v2,06/13] tools/nolibc: add pure 64bit off_t, time_t and blkcnt_t

Message ID b41f3cb75a71fc7ecb855cc82e85a3a0fbb39318.1685387484.git.falcon@tinylab.org (mailing list archive)
State Superseded
Headers show
Series nolibc: add part2 of support for rv32 | expand

Checks

Context Check Description
conchuod/tree_selection fail Failed to apply to next/pending-fixes, riscv/for-next or riscv/master

Commit Message

Zhangjin Wu May 29, 2023, 7:53 p.m. UTC
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(-)
diff mbox series

Patch

diff --git a/tools/include/nolibc/std.h b/tools/include/nolibc/std.h
index 933bc0be7e1c..0f458c1c24de 100644
--- a/tools/include/nolibc/std.h
+++ b/tools/include/nolibc/std.h
@@ -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 */