sys_stat: guarantee struct timespec
[pspp] / lib / sys_stat.in.h
index cc438229e7d68db6e383d8d0bc9adeada686abfb..296cedde3325a0aa0b4a4b11b1c2c732a5fbf880 100644 (file)
@@ -38,6 +38,9 @@
 /* Get nlink_t.  */
 #include <sys/types.h>
 
+/* Get struct timespec.  */
+#include <time.h>
+
 /* The include_next requires a split double-inclusion guard.  */
 #@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
 
 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
 #endif
 
+/* Macros for futimens and utimensat.  */
+#ifndef UTIME_NOW
+# define UTIME_NOW (-1)
+# define UTIME_OMIT (-2)
+#endif
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -349,6 +358,23 @@ extern int fstatat (int fd, char const *name, struct stat *st, int flags);
 #endif
 
 
+#if @GNULIB_FUTIMENS@
+# if @REPLACE_FUTIMENS@
+#  undef futimens
+#  define futimens rpl_futimens
+# endif
+# if !@HAVE_FUTIMENS@ || @REPLACE_FUTIMENS@
+extern int futimens (int fd, struct timespec const times[2]);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef futimens
+# define futimens(f,t)                         \
+    (GL_LINK_WARNING ("futimens is not portable - " \
+                      "use gnulib module futimens for portability"), \
+     futimens (f, t))
+#endif
+
+
 #if @GNULIB_MKDIRAT@
 # if !@HAVE_MKDIRAT@
 extern int mkdirat (int fd, char const *file, mode_t mode);