[PATCH 2/2] ntdll: Add support for BSD-style creation ("birth") time.

Charles Davis cdavis5x at gmail.com
Thu Nov 29 22:50:46 CST 2012


---
 configure.ac      |  2 +-
 dlls/ntdll/file.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 5d2b4f4..b9bb4c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2269,7 +2269,7 @@ AC_CHECK_MEMBERS([struct option.name],,,
 #endif])
 
 dnl Check for stat.st_blocks and ns-resolved times
-AC_CHECK_MEMBERS([struct stat.st_blocks,struct stat.st_mtim,struct stat.st_mtimespec,struct stat.st_ctim,struct stat.st_ctimespec,struct stat.st_atim,struct stat.st_atimespec])
+AC_CHECK_MEMBERS([struct stat.st_blocks,struct stat.st_mtim,struct stat.st_mtimespec,struct stat.st_ctim,struct stat.st_ctimespec,struct stat.st_atim,struct stat.st_atimespec,struct stat.st_birthtime,struct stat.st_birthtim,struct stat.st_birthtimespec,struct stat.__st_birthtime,struct stat.__st_birthtim])
 
 dnl Check for sin6_scope_id
 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c
index ccf5933..93695f0 100644
--- a/dlls/ntdll/file.c
+++ b/dlls/ntdll/file.c
@@ -1648,7 +1648,21 @@ static inline void get_file_times( const struct stat *st, LARGE_INTEGER *mtime,
 #elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC)
     atime->QuadPart += st->st_atimespec.tv_nsec / 100;
 #endif
+#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME
+    RtlSecondsSince1970ToTime( st->st_birthtime, creation );
+#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIM
+    creation->QuadPart += st->st_birthtim.tv_nsec / 100;
+#elif defined(HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC)
+    creation->QuadPart += st->st_birthtimespec.tv_nsec / 100;
+#endif
+#elif defined(HAVE_STRUCT_STAT___ST_BIRTHTIME)
+    RtlSecondsSince1970ToTime( st->__st_birthtime, creation );
+#ifdef HAVE_STRUCT_STAT___ST_BIRTHTIM
+    creation->QuadPart += st->__st_birthtim.tv_nsec / 100;
+#endif
+#else
     *creation = *mtime;
+#endif
 }
 
 /* fill in the file information that depends on the stat info */
-- 
1.7.12.4




More information about the wine-patches mailing list