summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2010-03-28 13:13:22 +0000
committered <ed@FreeBSD.org>2010-03-28 13:13:22 +0000
commit4f08ecd7ed8b39a0e0cd094967835fa85d105793 (patch)
tree303a032d575560ac8850d94e75f68865c40f1161 /lib/libc/sys
parent9eaa28fa3641501bd3b827e9b55aa8240713c80d (diff)
downloadFreeBSD-src-4f08ecd7ed8b39a0e0cd094967835fa85d105793.zip
FreeBSD-src-4f08ecd7ed8b39a0e0cd094967835fa85d105793.tar.gz
Rename st_*timespec fields to st_*tim for POSIX 2008 compliance.
A nice thing about POSIX 2008 is that it finally standardizes a way to obtain file access/modification/change times in sub-second precision, namely using struct timespec, which we already have for a very long time. Unfortunately POSIX uses different names. This commit adds compatibility macros, so existing code should still build properly. Also change all source code in the kernel to work without any of the compatibility macros. This makes it all a less ambiguous. I am also renaming st_birthtime to st_birthtim, even though it was a local extension anyway. It seems Cygwin also has a st_birthtim.
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/stat.228
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/libc/sys/stat.2 b/lib/libc/sys/stat.2
index 3085ef0..917b6be 100644
--- a/lib/libc/sys/stat.2
+++ b/lib/libc/sys/stat.2
@@ -149,8 +149,8 @@ fields together identify the file uniquely within the system.
The time-related fields of
.Vt "struct stat"
are as follows:
-.Bl -tag -width ".Va st_birthtime"
-.It Va st_atime
+.Bl -tag -width ".Va st_birthtim"
+.It Va st_atim
Time when file data last accessed.
Changed by the
.Xr mknod 2 ,
@@ -159,7 +159,7 @@ Changed by the
and
.Xr readv 2
system calls.
-.It Va st_mtime
+.It Va st_mtim
Time when file data last modified.
Changed by the
.Xr mkdir 2 ,
@@ -170,7 +170,7 @@ Changed by the
and
.Xr writev 2
system calls.
-.It Va st_ctime
+.It Va st_ctim
Time when file status was last changed (inode data modification).
Changed by the
.Xr chflags 2 ,
@@ -191,18 +191,24 @@ Changed by the
and
.Xr writev 2
system calls.
-.It Va st_birthtime
+.It Va st_birthtim
Time when the inode was created.
.El
.Pp
-If
-.Dv _POSIX_SOURCE
-is not defined, the time-related fields are defined as:
+The following time-related macros are defined for compatibility:
.Bd -literal
+#define st_atime st_atim.tv_sec
+#define st_mtime st_mtim.tv_sec
+#define st_ctime st_ctim.tv_sec
+#ifndef _POSIX_SOURCE
+#define st_birthtime st_birthtim.tv_sec
+#endif
+
#ifndef _POSIX_SOURCE
-#define st_atime st_atimespec.tv_sec
-#define st_mtime st_mtimespec.tv_sec
-#define st_ctime st_ctimespec.tv_sec
+#define st_atimespec st_atim
+#define st_mtimespec st_mtim
+#define st_ctimespec st_ctim
+#define st_birthtimespec st_birthtim
#endif
.Ed
.Pp
OpenPOWER on IntegriCloud