diff options
Diffstat (limited to 'libc/include/sys/stat.h')
-rw-r--r-- | libc/include/sys/stat.h | 95 |
1 files changed, 46 insertions, 49 deletions
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h index 9c7373a..c22516f 100644 --- a/libc/include/sys/stat.h +++ b/libc/include/sys/stat.h @@ -25,91 +25,81 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ + #ifndef _SYS_STAT_H_ #define _SYS_STAT_H_ +#include <linux/stat.h> +#include <machine/timespec.h> #include <sys/cdefs.h> #include <sys/types.h> -#include <sys/time.h> -#include <linux/stat.h> - -#include <endian.h> __BEGIN_DECLS -#if defined(__aarch64__) +#if defined(__aarch64__) || (defined(__mips__) && defined(__LP64__)) #define __STAT64_BODY \ - unsigned long st_dev; \ - unsigned long st_ino; \ - unsigned int st_mode; \ - unsigned int st_nlink; \ + dev_t st_dev; \ + ino_t st_ino; \ + mode_t st_mode; \ + nlink_t st_nlink; \ uid_t st_uid; \ gid_t st_gid; \ - unsigned long st_rdev; \ + dev_t st_rdev; \ unsigned long __pad1; \ - long st_size; \ + off_t st_size; \ int st_blksize; \ int __pad2; \ long st_blocks; \ - long st_atime; \ - unsigned long st_atime_nsec; \ - long st_mtime; \ - unsigned long st_mtime_nsec; \ - long st_ctime; \ - unsigned long st_ctime_nsec; \ + struct timespec st_atim; \ + struct timespec st_mtim; \ + struct timespec st_ctim; \ unsigned int __unused4; \ unsigned int __unused5; \ -#elif defined(__mips__) +#elif defined(__mips__) && !defined(__LP64__) #define __STAT64_BODY \ unsigned int st_dev; \ unsigned int __pad0[3]; \ unsigned long long st_ino; \ - unsigned int st_mode; \ - unsigned int st_nlink; \ + mode_t st_mode; \ + nlink_t st_nlink; \ uid_t st_uid; \ gid_t st_gid; \ unsigned int st_rdev; \ unsigned int __pad1[3]; \ long long st_size; \ - unsigned int st_atime; \ - unsigned int st_atime_nsec; \ - unsigned int st_mtime; \ - unsigned int st_mtime_nsec; \ - unsigned int st_ctime; \ - unsigned int st_ctime_nsec; \ + struct timespec st_atim; \ + struct timespec st_mtim; \ + struct timespec st_ctim; \ unsigned int st_blksize; \ unsigned int __pad2; \ unsigned long long st_blocks; \ #elif defined(__x86_64__) #define __STAT64_BODY \ - unsigned long st_dev; \ - unsigned long st_ino; \ + dev_t st_dev; \ + ino_t st_ino; \ unsigned long st_nlink; \ - unsigned int st_mode; \ + mode_t st_mode; \ uid_t st_uid; \ gid_t st_gid; \ unsigned int __pad0; \ - unsigned long st_rdev; \ - long st_size; \ + dev_t st_rdev; \ + off_t st_size; \ long st_blksize; \ long st_blocks; \ - unsigned long st_atime; \ - unsigned long st_atime_nsec; \ - unsigned long st_mtime; \ - unsigned long st_mtime_nsec; \ - unsigned long st_ctime; \ - unsigned long st_ctime_nsec; \ + struct timespec st_atim; \ + struct timespec st_mtim; \ + struct timespec st_ctim; \ long __pad3[3]; \ -#else +#else /* __arm__ || __i386__ */ #define __STAT64_BODY \ unsigned long long st_dev; \ unsigned char __pad0[4]; \ unsigned long __st_ino; \ unsigned int st_mode; \ - unsigned int st_nlink; \ + nlink_t st_nlink; \ uid_t st_uid; \ gid_t st_gid; \ unsigned long long st_rdev; \ @@ -117,12 +107,9 @@ __BEGIN_DECLS long long st_size; \ unsigned long st_blksize; \ unsigned long long st_blocks; \ - unsigned long st_atime; \ - unsigned long st_atime_nsec; \ - unsigned long st_mtime; \ - unsigned long st_mtime_nsec; \ - unsigned long st_ctime; \ - unsigned long st_ctime_nsec; \ + struct timespec st_atim; \ + struct timespec st_mtim; \ + struct timespec st_ctim; \ unsigned long long st_ino; \ #endif @@ -132,9 +119,14 @@ struct stat64 { __STAT64_BODY }; #undef __STAT64_BODY -#define st_atimensec st_atime_nsec -#define st_mtimensec st_mtime_nsec -#define st_ctimensec st_ctime_nsec +/* Compatibility with older versions of POSIX. */ +#define st_atime st_atim.tv_sec +#define st_mtime st_mtim.tv_sec +#define st_ctime st_ctim.tv_sec +/* Compatibility with glibc. */ +#define st_atimensec st_atim.tv_nsec +#define st_mtimensec st_mtim.tv_nsec +#define st_ctimensec st_ctim.tv_nsec #ifdef __USE_BSD /* Permission macros provided by glibc for compatibility with BSDs. */ @@ -179,7 +171,8 @@ mode_t umask(mode_t mode) { } #endif /* defined(__BIONIC_FORTIFY) */ -extern int mkfifo(const char*, mode_t); +_BIONIC_NOT_BEFORE_21(extern int mkfifo(const char*, mode_t);) +extern int mkfifoat(int, const char*, mode_t); extern int fchmodat(int, const char*, mode_t, int); extern int mkdirat(int, const char*, mode_t); @@ -190,6 +183,10 @@ extern int mknodat(int, const char*, mode_t, dev_t); extern int utimensat(int fd, const char *path, const struct timespec times[2], int flags); extern int futimens(int fd, const struct timespec times[2]); +#if __ANDROID_API__ < 21 +#include <android/legacy_sys_stat_inlines.h> +#endif + __END_DECLS #endif /* _SYS_STAT_H_ */ |