diff options
author | Andy Fiddaman <omnios@citrus-it.co.uk> | 2020-09-05 22:23:36 +0000 |
---|---|---|
committer | Andy Fiddaman <omnios@citrus-it.co.uk> | 2020-09-17 18:19:33 +0000 |
commit | b7a7784945b3504d0b69ea02a08e1cddb5578907 (patch) | |
tree | 68d892b0bea31b71ddf9a217932de4462f852236 /usr/src/lib/libc | |
parent | 260b78324e5b8479cc94f897a36e996f026c3fef (diff) | |
download | illumos-joyent-b7a7784945b3504d0b69ea02a08e1cddb5578907.tar.gz |
13111 Want futimes(), lutimes() and timespec/timeval conversion macros
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Reviewed by: Marco van Wieringen <mvw@planets.elm.net>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/lib/libc')
-rw-r--r-- | usr/src/lib/libc/port/mapfile-vers | 6 | ||||
-rw-r--r-- | usr/src/lib/libc/port/sys/utimesys.c | 28 |
2 files changed, 31 insertions, 3 deletions
diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers index 6a4c274258..be5b7e73bf 100644 --- a/usr/src/lib/libc/port/mapfile-vers +++ b/usr/src/lib/libc/port/mapfile-vers @@ -78,6 +78,12 @@ $if _x86 && _ELF64 $add amd64 $endif +SYMBOL_VERSION ILLUMOS_0.34 { + protected: + futimes; + lutimes; +} ILLUMOS_0.33; + SYMBOL_VERSION ILLUMOS_0.33 { protected: c16rtomb; diff --git a/usr/src/lib/libc/port/sys/utimesys.c b/usr/src/lib/libc/port/sys/utimesys.c index dc917f27ae..55e53dbb53 100644 --- a/usr/src/lib/libc/port/sys/utimesys.c +++ b/usr/src/lib/libc/port/sys/utimesys.c @@ -24,6 +24,10 @@ * Use is subject to license terms. */ +/* + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. + */ + #include "lint.h" #include <string.h> #include <utime.h> @@ -67,8 +71,8 @@ utime(const char *path, const struct utimbuf *times) return (utimensat(AT_FDCWD, path, tsp, 0)); } -int -utimes(const char *path, const struct timeval times[2]) +static int +utimes_impl(const char *path, const struct timeval times[2], int flag) { struct timeval ltimes[2]; timespec_t ts[2]; @@ -86,7 +90,19 @@ utimes(const char *path, const struct timeval times[2]) ts[1].tv_nsec = ltimes[1].tv_usec * 1000; tsp = ts; } - return (utimensat(AT_FDCWD, path, tsp, 0)); + return (utimensat(AT_FDCWD, path, tsp, flag)); +} + +int +utimes(const char *path, const struct timeval times[2]) +{ + return (utimes_impl(path, times, 0)); +} + +int +lutimes(const char *path, const struct timeval times[2]) +{ + return (utimes_impl(path, times, AT_SYMLINK_NOFOLLOW)); } #pragma weak _futimesat = futimesat @@ -115,3 +131,9 @@ futimesat(int fd, const char *path, const struct timeval times[2]) return (utimensat(fd, path, tsp, 0)); } + +int +futimes(int fd, const struct timeval times[2]) +{ + return (futimesat(fd, NULL, times)); +} |