From f4aa4c78c73d6bc79d6e3f3a407660c526c98ebb Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Thu, 9 Jun 2016 22:14:58 +0000 Subject: [PATCH] utimes(2),utime(3): Add deprecation in favour of utimensat(2) and futimens(2). Setting time by seconds or microseconds may cause unexpected effects especially if sysctl vfs.timestamp_precision=3 (not default). Calling the obsolete functions with NULL timestamps is acceptable. --- lib/libc/gen/utime.3 | 6 ++++-- lib/libc/sys/utimes.2 | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/libc/gen/utime.3 b/lib/libc/gen/utime.3 index 1951613d9afb..20c7916acbbb 100644 --- a/lib/libc/gen/utime.3 +++ b/lib/libc/gen/utime.3 @@ -28,7 +28,7 @@ .\" @(#)utime.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd June 9, 2016 .Dt UTIME 3 .Os .Sh NAME @@ -43,7 +43,8 @@ .Sh DESCRIPTION .Bf -symbolic This interface is obsoleted by -.Xr utimes 2 . +.Xr utimensat 2 +because it is not accurate to fractions of a second. .Ef .Pp The @@ -79,6 +80,7 @@ for any of the errors specified for the library function .Xr utimes 2 . .Sh SEE ALSO .Xr stat 2 , +.Xr utimensat 2 , .Xr utimes 2 .Sh STANDARDS The diff --git a/lib/libc/sys/utimes.2 b/lib/libc/sys/utimes.2 index 15db6270407a..30d31d27536a 100644 --- a/lib/libc/sys/utimes.2 +++ b/lib/libc/sys/utimes.2 @@ -30,7 +30,7 @@ .\" @(#)utimes.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd July 3, 2014 +.Dd June 9, 2016 .Dt UTIMES 2 .Os .Sh NAME @@ -52,6 +52,14 @@ .Ft int .Fn futimesat "int fd" "const char *path" "const struct timeval times[2]" .Sh DESCRIPTION +.Bf -symbolic +These interfaces are obsoleted by +.Xr futimens 2 +and +.Xr utimensat 2 +because they are not accurate to nanoseconds. +.Ef +.Pp The access and modification times of the file named by .Fa path or referenced by @@ -223,6 +231,7 @@ nor a file descriptor associated with a directory. .Sh SEE ALSO .Xr chflags 2 , .Xr stat 2 , +.Xr utimensat 2 , .Xr utime 3 .Sh STANDARDS The @@ -231,7 +240,11 @@ function is expected to conform to .St -xpg4.2 . The .Fn futimesat -system call follows The Open Group Extended API Set 2 specification. +system call follows The Open Group Extended API Set 2 specification +but was replaced by +.Fn utimensat +in +.St -p1003.1-2008 . .Sh HISTORY The .Fn utimes