aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/_timespec.h
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2010-03-28 13:13:22 +0000
committerEd Schouten <ed@FreeBSD.org>2010-03-28 13:13:22 +0000
commit510ea843baf66ae678ca6ddbbbca9816177be5b0 (patch)
tree303a032d575560ac8850d94e75f68865c40f1161 /sys/sys/_timespec.h
parent4e87d54a579146edac6c6b431a2e97ae05a885b9 (diff)
downloadsrc-510ea843baf66ae678ca6ddbbbca9816177be5b0.tar.gz
src-510ea843baf66ae678ca6ddbbbca9816177be5b0.zip
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.
Notes
Notes: svn path=/head/; revision=205792
Diffstat (limited to 'sys/sys/_timespec.h')
-rw-r--r--sys/sys/_timespec.h26
1 files changed, 9 insertions, 17 deletions
diff --git a/sys/sys/_timespec.h b/sys/sys/_timespec.h
index 9dcd5f8910dc..d51559c2a41a 100644
--- a/sys/sys/_timespec.h
+++ b/sys/sys/_timespec.h
@@ -31,26 +31,18 @@
* $FreeBSD$
*/
-/*
- * Prerequisite: <sys/_types.h>
- *
- * This file must be kept synchronized with <sys/timespec.h>.
- * It defines a structure which must be a type pun for
- * `struct timespec'; this structure is used in header files where
- * the ABI uses a `struct timespec' but standards prohibit its
- * definition. (Currently only <sys/stat.h>.)
- *
- * XXX should just declare struct __timespec as necessary. It's simple,
- * so is easy to keep synchronized, and hopefully not needed in as many
- * places as struct timespec, so we don't need this extra header.
- * Perhaps we don't need timespec.h either.
- */
-
#ifndef _SYS__TIMESPEC_H_
#define _SYS__TIMESPEC_H_
-struct __timespec {
- __time_t tv_sec; /* seconds */
+#include <sys/_types.h>
+
+#ifndef _TIME_T_DECLARED
+typedef __time_t time_t;
+#define _TIME_T_DECLARED
+#endif
+
+struct timespec {
+ time_t tv_sec; /* seconds */
long tv_nsec; /* and nanoseconds */
};