doc: mention timestamp portability issues
authorEric Blake <ebb9@byu.net>
Wed, 7 Oct 2009 17:58:54 +0000 (11:58 -0600)
committerEric Blake <ebb9@byu.net>
Sat, 10 Oct 2009 14:25:15 +0000 (08:25 -0600)
* doc/glibc-functions/lutimes.texi (lutimes): Refer to utimensat
instead.
* doc/posix-functions/utime.texi (utime): Likewise.
* doc/posix-functions/utimes.texi (utimes): Likewise.
* doc/glibc-functions/futimes.texi (futimes): Refer to futimens
instead.
* doc/posix-functions/futimens.texi (futimens): Mention utimens
module.
* doc/posix-functions/utimensat.texi (utimensat): Likewise.
Mention weakness with symlink timestamps.
* doc/glibc-functions/futimesat.texi (futimesat): New file; refer
to utimensat/futimens instead.
* doc/gnulib.texi (Glibc sys/time.h): Include new file.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
doc/glibc-functions/futimes.texi
doc/glibc-functions/futimesat.texi [new file with mode: 0644]
doc/glibc-functions/lutimes.texi
doc/gnulib.texi
doc/posix-functions/futimens.texi
doc/posix-functions/utime.texi
doc/posix-functions/utimensat.texi
doc/posix-functions/utimes.texi

index f2427e4..8a34a5b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2009-10-10  Eric Blake  <ebb9@byu.net>
 
+       doc: mention timestamp portability issues
+       * doc/glibc-functions/lutimes.texi (lutimes): Refer to utimensat
+       instead.
+       * doc/posix-functions/utime.texi (utime): Likewise.
+       * doc/posix-functions/utimes.texi (utimes): Likewise.
+       * doc/glibc-functions/futimes.texi (futimes): Refer to futimens
+       instead.
+       * doc/posix-functions/futimens.texi (futimens): Mention utimens
+       module.
+       * doc/posix-functions/utimensat.texi (utimensat): Likewise.
+       Mention weakness with symlink timestamps.
+       * doc/glibc-functions/futimesat.texi (futimesat): New file; refer
+       to utimensat/futimens instead.
+       * doc/gnulib.texi (Glibc sys/time.h): Include new file.
+
        test-dup2: enhance test
        * tests/test-dup2.c (main): Also check AT_FDCWD.
 
index e53b6ed..0df4706 100644 (file)
@@ -12,5 +12,9 @@ Portability problems not fixed by Gnulib:
 @itemize
 @item
 This function is missing on some platforms:
-AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw, Interix 3.5, BeOS.
+AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw, Interix
+3.5, BeOS.
+@item
+This function cannot set full timestamp resolution.  Use
+@code{futimens(fd,times)} instead.
 @end itemize
diff --git a/doc/glibc-functions/futimesat.texi b/doc/glibc-functions/futimesat.texi
new file mode 100644 (file)
index 0000000..dbd3d1d
--- /dev/null
@@ -0,0 +1,21 @@
+@node futimesat
+@subsection @code{futimesat}
+@findex futimesat
+
+Gnulib module: ---
+
+Portability problems fixed by Gnulib:
+@itemize
+@end itemize
+
+Portability problems not fixed by Gnulib:
+@itemize
+@item
+This function is missing on some platforms:
+glibc 2.3.6, MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX
+5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 8, Cygwin 1.5.x, mingw,
+Interix 3.5, BeOS.
+@item
+This function cannot set full timestamp resolution.  Use
+@code{file ? utimensat(fd,file,times,0) : futimens(fd,times)} instead.
+@end itemize
index 96308e0..2971c99 100644 (file)
@@ -12,5 +12,14 @@ Portability problems not fixed by Gnulib:
 @itemize
 @item
 This function is missing on some platforms:
-MacOS X 10.3, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, mingw, Interix 3.5, BeOS.
+MacOS X 10.3, OpenBSD 3.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1,
+Solaris 10, mingw, Interix 3.5, BeOS.
+@item
+This function cannot set full timestamp resolution.  Use
+@code{utimensat(AT_FDCWD,file,times,AT_SYMLINK_NOFOLLOW)} instead.
+@item
+The mere act of using @code{lstat} modifies the access time of
+symlinks on some platforms, so @code{lutimes} can only effectively
+change modification time:
+Cygwin.
 @end itemize
index b3085d4..8566eb3 100644 (file)
@@ -5482,12 +5482,14 @@ This list of functions is sorted according to the header that declares them.
 @menu
 * adjtime::
 * futimes::
+* futimesat::
 * lutimes::
 * settimeofday::
 @end menu
 
 @include glibc-functions/adjtime.texi
 @include glibc-functions/futimes.texi
+@include glibc-functions/futimesat.texi
 @include glibc-functions/lutimes.texi
 @include glibc-functions/settimeofday.texi
 
index 0fb5935..2a1a779 100644 (file)
@@ -15,5 +15,20 @@ Portability problems not fixed by Gnulib:
 @item
 This function is missing on some platforms:
 glibc 2.3.6, MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX
-5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
+5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw,
+Interix 3.5, BeOS.
+@item
+This function returns a bogus value instead of failing with
+@code{ENOSYS} on some platforms:
+Linux kernel 2.6.21.
+@item
+When using @code{UTIME_OMIT} or @code{UTIME_NOW}, some systems require
+the @code{tv_sec} argument to be 0, and don't necessarily handle all
+file permissions in the manner required by POSIX:
+Linux kernel 2.6.25.
+@item
+Some platforms lack the ability to change the timestamps of a file
+descriptor, so this function can fail with @code{ENOSYS}.
 @end itemize
+
+The gnulib module utimens provides a similar interface.
index 9b5a7ee..d14685c 100644 (file)
@@ -15,4 +15,12 @@ file's timestamp to the current time.
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+This function cannot set full timestamp resolution.  Use
+@code{utimensat(AT_FDCWD,file,times,0)} instead.
+@item
+On some platforms, the prototype for @code{utime} omits @code{const}
+for the second argument.  Fortunately, the argument is not modified,
+so it is safe to cast away const:
+mingw.
 @end itemize
index 23a5582..1dcfe8c 100644 (file)
@@ -15,5 +15,26 @@ Portability problems not fixed by Gnulib:
 @item
 This function is missing on some platforms:
 glibc 2.3.6, MacOS X 10.3, FreeBSD 6.0, NetBSD 3.0, OpenBSD 3.8, AIX
-5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw, Interix 3.5, BeOS.
+5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x, mingw,
+Interix 3.5, BeOS.
+@item
+This function returns a bogus value instead of failing with
+@code{ENOSYS} on some platforms:
+Linux kernel 2.6.21.
+@item
+When using @code{UTIME_OMIT} or @code{UTIME_NOW}, some systems require
+the @code{tv_sec} argument to be 0, and don't necessarily handle all
+file permissions in the manner required by POSIX:
+Linux kernel 2.6.25.
+@item
+On some platforms, timestamps of symbolic links cannot be modified, so
+this function fails with @code{ENOSYS} if passed the flag
+@code{AT_SYMLINK_NOFOLLOW}.
+@item
+The mere act of using @code{lstat} modifies the access time of
+symlinks on some platforms, so @code{utimensat} with
+@code{AT_SYMLINK_NOFOLLOW} can only effectively change modification time:
+Cygwin.
 @end itemize
+
+The gnulib module utimens provides a similar interface.
index 8ab90d9..5f6cb7b 100644 (file)
@@ -16,6 +16,15 @@ Portability problems not fixed by Gnulib:
 This function is missing on some platforms:
 mingw, Interix 3.5, BeOS.
 @item
-This function is marked as ``legacy'' in POSIX.  Better use @code{utime}
-instead.
+This function cannot set full timestamp resolution.  In particular,
+some platforms incorrectly round rather than truncate.  Use
+@code{utimensat(AT_FDCWD,file,times,0)} instead.
+@item
+On some platforms, @code{utimes (file, NULL)} fails to set the
+file's timestamp to the current time:
+glibc 2.3.3.
+@item
+On some platforms, @code{utimes} failed on read-only files when
+@code{utime} worked fine.
+glibc 2.2.5.
 @end itemize