diff options
author | Eric Christopher <echristo@gmail.com> | 2013-07-04 00:47:09 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2013-07-04 00:47:09 +0000 |
commit | aaf58cc3c47ea4d765ff1f74649a5850565c88da (patch) | |
tree | 8a0910092991c335bfd95e42eace2ef6ea670f6c /llvm/lib/Support/Unix/Path.inc | |
parent | a1f5b901a58c40d57c8d68d9baf81447be95f965 (diff) | |
download | bcm5719-llvm-aaf58cc3c47ea4d765ff1f74649a5850565c88da.tar.gz bcm5719-llvm-aaf58cc3c47ea4d765ff1f74649a5850565c88da.zip |
Add support for futimens for platforms that don't support futimes.
Patch by pashev.igor.
llvm-svn: 185601
Diffstat (limited to 'llvm/lib/Support/Unix/Path.inc')
-rw-r--r-- | llvm/lib/Support/Unix/Path.inc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc index 1cbdbf5429b..c7cfec9ebcf 100644 --- a/llvm/lib/Support/Unix/Path.inc +++ b/llvm/lib/Support/Unix/Path.inc @@ -626,11 +626,21 @@ error_code permissions(const Twine &path, perms prms) { } error_code setLastModificationAndAccessTime(int FD, TimeValue Time) { +#if HAVE_FUTIMENS + timespec Times[2]; + Times[0].tv_sec = Time.toPosixTime(); + Times[0].tv_nsec = 0; + Times[1] = Times[0]; + if (::futimens(FD, Times)) +#elif HAVE_FUTIMES timeval Times[2]; Times[0].tv_sec = Time.toPosixTime(); Times[0].tv_usec = 0; Times[1] = Times[0]; if (::futimes(FD, Times)) +#else +#error Missing futimes() and futimens() +#endif return error_code(errno, system_category()); return error_code::success(); } |