-struct stat
-{
- dev_t st_dev; /* inode's device */
- ino_t st_ino; /* inode's number */
- mode_t st_mode; /* inode protection mode */
- nlink_t st_nlink; /* number of hard links */
- uid_t st_uid; /* user ID of the file's owner */
- gid_t st_gid; /* group ID of the file's group */
- dev_t st_rdev; /* device type */
- off_t st_size; /* file size, in bytes */
- time_t st_atime; /* time of last access */
- long st_spare1;
- time_t st_mtime; /* time of last data modification */
- long st_spare2;
- time_t st_ctime; /* time of last file status change */
- long st_spare3;
- long st_blksize; /* optimal blocksize for I/O */
- long st_blocks; /* blocks allocated for file */
- u_long st_flags; /* user defined flags for file */
- u_long st_gen; /* file generation number */
+#ifndef _SYS_STAT_H_
+#define _SYS_STAT_H_
+
+#include <sys/time.h>
+
+#ifndef _POSIX_SOURCE
+struct ostat {
+ u_int16_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ u_int16_t st_uid; /* user ID of the file's owner */
+ u_int16_t st_gid; /* group ID of the file's group */
+ u_int16_t st_rdev; /* device type */
+ int32_t st_size; /* file size, in bytes */
+ struct timespec st_atimespec; /* time of last access */
+ struct timespec st_mtimespec; /* time of last data modification */
+ struct timespec st_ctimespec; /* time of last file status change */
+ int32_t st_blksize; /* optimal blocksize for I/O */
+ int32_t st_blocks; /* blocks allocated for file */
+ u_int32_t st_flags; /* user defined flags for file */
+ u_int32_t st_gen; /* file generation number */
+};
+#endif /* !_POSIX_SOURCE */
+
+struct stat {
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
+#ifndef _POSIX_SOURCE
+ struct timespec st_atimespec; /* time of last access */
+ struct timespec st_mtimespec; /* time of last data modification */
+ struct timespec st_ctimespec; /* time of last file status change */
+#else
+ time_t st_atime; /* time of last access */
+ long st_atimensec; /* nsec of last access */
+ time_t st_mtime; /* time of last data modification */
+ long st_mtimensec; /* nsec of last data modification */
+ time_t st_ctime; /* time of last file status change */
+ long st_ctimensec; /* nsec of last file status change */
+#endif
+ off_t st_size; /* file size, in bytes */
+ int64_t st_blocks; /* blocks allocated for file */
+ u_int32_t st_blksize; /* optimal blocksize for I/O */
+ u_int32_t st_flags; /* user defined flags for file */
+ u_int32_t st_gen; /* file generation number */
+ int32_t st_lspare;
+ int64_t st_qspare[2];