[llvm] 7294ca3 - [SystemZ/ZOS] Implement setLastAccessAndModificationTime()

Kai Nacke via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 03:37:46 PDT 2020


Author: Kai Nacke
Date: 2020-07-28T06:36:15-04:00
New Revision: 7294ca3f6ecacd05a197bbf0637e10afcb99b6d6

URL: https://github.com/llvm/llvm-project/commit/7294ca3f6ecacd05a197bbf0637e10afcb99b6d6
DIFF: https://github.com/llvm/llvm-project/commit/7294ca3f6ecacd05a197bbf0637e10afcb99b6d6.diff

LOG: [SystemZ/ZOS] Implement setLastAccessAndModificationTime()

The function setLastAccessAndModificationTime() uses function
futimens() or futimes() by default. Both functions are not
available in z/OS, therefore functionality is implemented using
__fchattr() on z/OS.

Reviews by: abhina.sreeskantharajan

Differential Revision: https://reviews.llvm.org/D83945

Added: 
    

Modified: 
    llvm/lib/Support/Unix/Path.inc

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index fa4682dd33d2..01903ea10e81 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -792,6 +792,16 @@ std::error_code setLastAccessAndModificationTime(int FD, TimePoint<> AccessTime,
   if (::futimes(FD, Times))
     return std::error_code(errno, std::generic_category());
   return std::error_code();
+#elif defined(__MVS__)
+  attrib_t Attr;
+  memset(&Attr, 0, sizeof(Attr));
+  Attr.att_atimechg = 1;
+  Attr.att_atime = sys::toTimeT(AccessTime);
+  Attr.att_mtimechg = 1;
+  Attr.att_mtime = sys::toTimeT(ModificationTime);
+  if (::__fchattr(FD, &Attr, sizeof(Attr)) != 0)
+    return std::error_code(errno, std::generic_category());
+  return std::error_code();
 #else
 #warning Missing futimes() and futimens()
   return make_error_code(errc::function_not_supported);


        


More information about the llvm-commits mailing list