From 3c97dc14d078aed5b96eac2ce78bd8a18726819c Mon Sep 17 00:00:00 2001 From: deadwood Date: Sun, 29 Jan 2023 13:43:55 +0100 Subject: [PATCH 1/4] Introduce __time_t for consistency with other types --- compiler/stdc/include/aros/types/time_t.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/stdc/include/aros/types/time_t.h b/compiler/stdc/include/aros/types/time_t.h index 2096dc56bfe..bbcc074be2c 100644 --- a/compiler/stdc/include/aros/types/time_t.h +++ b/compiler/stdc/include/aros/types/time_t.h @@ -10,6 +10,11 @@ #include -typedef signed AROS_32BIT_TYPE time_t; +typedef signed AROS_32BIT_TYPE __time_t; + +#if !defined(__time_t_defined) +typedef __time_t time_t; +# define __time_t_defined +#endif #endif /* _AROS_TYPES_TIME_T_H */ From 562edc6860ebf6b33482f31556a95e3152955d3b Mon Sep 17 00:00:00 2001 From: deadwood Date: Sun, 29 Jan 2023 14:14:17 +0100 Subject: [PATCH 2/4] Make fpos_t a 64-bit type on 64-bit systems This makes fpos_t consistent with off_t and other file system types. fpos_t will now be 64-bit on 64-bit system and on 32-bit systems when _FILE_OFFSET_BITS=64. In other case it will be 32-bit wide. This sizing behavior was also validated with GNU Linux. --- compiler/stdc/include/aros/types/fpos_t.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/stdc/include/aros/types/fpos_t.h b/compiler/stdc/include/aros/types/fpos_t.h index e6d00493735..a3c3895caae 100644 --- a/compiler/stdc/include/aros/types/fpos_t.h +++ b/compiler/stdc/include/aros/types/fpos_t.h @@ -10,7 +10,11 @@ #include +#if (__WORDSIZE==64) +typedef unsigned AROS_64BIT_TYPE __fpos_t; +#else typedef unsigned AROS_32BIT_TYPE __fpos_t; +#endif typedef unsigned AROS_64BIT_TYPE __fpos64_t; #if !defined(__fpos_t_defined) @@ -22,4 +26,9 @@ typedef __fpos64_t fpos_t; # define __fpos_t_defined #endif +#if defined(__USE_LARGEFILE64) && !defined(__fpos64_t_defined) +# define __fpos64_t_defined +typedef __fpos64_t fpos64_t; +#endif + #endif /* _AROS_TYPES_FPOS_T_H */ From c3a4f07a4f2ba7294faa27d6ac207012a71c8eb7 Mon Sep 17 00:00:00 2001 From: deadwood Date: Sun, 29 Jan 2023 19:44:53 +0100 Subject: [PATCH 3/4] Make ino_t a 64-bit type on 64-bit systems This makes ino_t consistent with other file system types. ino_t will now be 64-bit on 64-bit system and on 32-bit systems when _FILE_OFFSET_BITS=64. In other case it will be 32-bit wide. This sizing behavior was also validated with GNU Linux. --- compiler/posixc/include/aros/types/ino_t.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/posixc/include/aros/types/ino_t.h b/compiler/posixc/include/aros/types/ino_t.h index 38c8750699d..0633455151d 100644 --- a/compiler/posixc/include/aros/types/ino_t.h +++ b/compiler/posixc/include/aros/types/ino_t.h @@ -12,16 +12,20 @@ #include +#if (__WORDSIZE==64) +typedef signed AROS_64BIT_TYPE __ino_t; +#else typedef signed AROS_32BIT_TYPE __ino_t; +#endif typedef signed AROS_64BIT_TYPE __ino64_t; #if defined(__USE_XOPEN) # if !defined(__ino_t_defined) -/* NOTIMPL # if !defined(__USE_FILE_OFFSET64) */ +# if !defined(__USE_FILE_OFFSET64) typedef __ino_t ino_t; -/* NOTIMPL # else +# else typedef __ino64_t ino_t; -# endif */ +# endif # define __ino_t_defined # endif # if defined(__USE_LARGEFILE64) && !defined(__ino64_t_defined) From 99137ab310a8bd13dd6bf6e6fa606df193a25b70 Mon Sep 17 00:00:00 2001 From: deadwood Date: Wed, 1 Mar 2023 09:33:28 +0100 Subject: [PATCH 4/4] Allow stat, lstat, fstat prototypes declaration This matches behavior of other function defined as static inline in headers and allows code re-implementing these functions to compile --- compiler/posixc/include/aros/posixc/sys/stat.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/compiler/posixc/include/aros/posixc/sys/stat.h b/compiler/posixc/include/aros/posixc/sys/stat.h index 46577900a3d..057954f61e2 100644 --- a/compiler/posixc/include/aros/posixc/sys/stat.h +++ b/compiler/posixc/include/aros/posixc/sys/stat.h @@ -138,6 +138,7 @@ __BEGIN_DECLS int chmod(const char *path, mode_t mode); int fchmod(int fildes, mode_t mode); /* NOTIMPL int fchmodat(int, const char *, mode_t, int); */ +#if !defined(NO_POSIX_WRAPPERS) int __posixc_fstat(int fd, struct stat *sb); int fstat64(int fd, struct stat64 *sb); #if defined(__USE_FILE_OFFSET64) @@ -152,8 +153,12 @@ static __inline__ int fstat(int fd, struct stat *sb) return __posixc_fstat(fd, sb); } #endif +#else /* NO_POSIX_WRAPPERS */ +int fstat(int fd, struct stat *sb); +#endif /* NO_POSIX_WRAPPERS */ /* NOTIMPL int fstatat(int, const char *restrict, struct stat *restrict, int); */ /* NOTIMPL int futimens(int, const struct timespec [2]); */ +#if !defined(NO_POSIX_WRAPPERS) int __posixc_lstat(const char * restrict path, struct stat * restrict sb); int lstat64(const char * restrict path, struct stat64 * restrict sb); #if defined(__USE_FILE_OFFSET64) @@ -168,12 +173,16 @@ static __inline__ int lstat(const char * restrict path, struct stat * restrict return __posixc_lstat(path, sb); } #endif +#else /* NO_POSIX_WRAPPERS */ +int lstat(const char * restrict path, struct stat * restrict sb); +#endif /* NO_POSIX_WRAPPERS */ int mkdir(const char *path, mode_t mode); /* NOTIMPL int mkdirat(int, const char *, mode_t); */ /* NOTIMPL int mkfifo(const char *path, mode_t mode); */ /* NOTIMPL int mkfifoat(int, const char *, mode_t); */ int mknod(const char *path, mode_t mode, dev_t dev); /* NOTIMPL int mknodat(int, const char *, mode_t, dev_t); */ +#if !defined(NO_POSIX_WRAPPERS) int __posixc_stat(const char * restrict path, struct stat * restrict sb); int stat64(const char * restrict path, struct stat64 * restrict sb); #if defined(__USE_FILE_OFFSET64) @@ -188,6 +197,9 @@ static __inline__ int stat(const char * restrict path, struct stat * restrict s return __posixc_stat(path, sb); } #endif +#else /* NO_POSIX_WRAPPERS */ +int stat(const char * restrict path, struct stat * restrict sb); +#endif /* NO_POSIX_WRAPPERS */ mode_t umask(mode_t numask); /* NOTIMPL int utimensat(int, const char *, const struct timespec [2], int); */