OSDN Git Service

* fhandler_mailslot.cc (fhandler_mailslot::fstat): Set new stat member
authorcorinna <corinna>
Tue, 6 Mar 2007 14:48:24 +0000 (14:48 +0000)
committercorinna <corinna>
Tue, 6 Mar 2007 14:48:24 +0000 (14:48 +0000)
st_birthtim to useful value.
* fhandler_process.cc (fhandler_process::fstat): Ditto.
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Take
additional parameter for creation time.  Fill st_birthtim with it.
Accomodate additional creation time parameter throughout.
* fhandler_raw.cc (fhandler_dev_raw::fstat): Set new stat member
st_birthtim to useful value.
* fhandler.cc (fhandler_base::fstat): Ditto.
* fhandler_registry.cc (fhandler_registry::fstat): Ditto.
* include/cygwin/version.h: Bump API minor number.
* include/cygwin/stat.h (struct __stat64): Replace st_spare4 with
timestruc_t st_birthtim.
(struct stat): Ditto if __CYGWIN_USE_BIG_TYPES__ is defined.
(st_birthtime): Define if __CYGWIN_USE_BIG_TYPES__ is defined.

winsup/cygwin/ChangeLog
winsup/cygwin/fhandler.cc
winsup/cygwin/fhandler_disk_file.cc
winsup/cygwin/fhandler_mailslot.cc
winsup/cygwin/fhandler_process.cc
winsup/cygwin/fhandler_raw.cc
winsup/cygwin/fhandler_registry.cc
winsup/cygwin/include/cygwin/stat.h
winsup/cygwin/include/cygwin/version.h

index 0d5144b..3072289 100644 (file)
@@ -1,3 +1,21 @@
+2007-03-06  Corinna Vinschen  <corinna@vinschen.de>
+
+       * fhandler_mailslot.cc (fhandler_mailslot::fstat): Set new stat member
+       st_birthtim to useful value.
+       * fhandler_process.cc (fhandler_process::fstat): Ditto.
+       * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Take
+       additional parameter for creation time.  Fill st_birthtim with it.
+       Accomodate additional creation time parameter throughout.
+       * fhandler_raw.cc (fhandler_dev_raw::fstat): Set new stat member
+       st_birthtim to useful value.
+       * fhandler.cc (fhandler_base::fstat): Ditto.
+       * fhandler_registry.cc (fhandler_registry::fstat): Ditto.
+       * include/cygwin/version.h: Bump API minor number.
+       * include/cygwin/stat.h (struct __stat64): Replace st_spare4 with
+       timestruc_t st_birthtim.
+       (struct stat): Ditto if __CYGWIN_USE_BIG_TYPES__ is defined.
+       (st_birthtime): Define if __CYGWIN_USE_BIG_TYPES__ is defined.
+
 2007-03-02  Corinna Vinschen  <corinna@vinschen.de>
 
        * ntdll.h (struct _OBJECT_NAME_INFORMATION): Define.
index 33ef6ae..5f46484 100644 (file)
@@ -1143,7 +1143,7 @@ fhandler_base::fstat (struct __stat64 *buf)
   buf->st_blksize = PREFERRED_IO_BLKSIZE;
   buf->st_ctim.tv_sec = 1164931200L;   /* Arbitrary value: 2006-12-01 */
   buf->st_ctim.tv_nsec = 0L;
-  buf->st_atim = buf->st_mtim = buf->st_ctim;
+  buf->st_atim = buf->st_mtim = buf->st_birthtim = buf->st_ctim;
   return 0;
 }
 
index f40bcb5..d510ff0 100644 (file)
@@ -246,6 +246,7 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
                       *(FILETIME *) &pfai->BasicInformation.LastWriteTime,
                       *(FILETIME *) &pfai->BasicInformation.LastAccessTime,
                       *(FILETIME *) &pfai->BasicInformation.LastWriteTime,
+                      *(FILETIME *) &pfai->BasicInformation.CreationTime,
                       pfvi->VolumeSerialNumber,
                       pfai->StandardInformation.EndOfFile.QuadPart,
                       pfai->StandardInformation.AllocationSize.QuadPart,
@@ -264,7 +265,7 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf)
   lowfs = GetFileSize (get_handle (), &highfs);
   if (lowfs == 0xffffffff && GetLastError ())
     lowfs = highfs = 0;
-  return fstat_helper (buf, ft, ft, ft, 0, (ULONGLONG) highfs << 32 | lowfs,
+  return fstat_helper (buf, ft, ft, ft, ft, 0, (ULONGLONG) highfs << 32 | lowfs,
                       -1LL, 0ULL, 1, DWORD (pc));
 }
 
@@ -291,6 +292,7 @@ fhandler_base::fstat_by_name (struct __stat64 *buf)
                          local.ftLastWriteTime, /* see fstat_helper comment */
                          local.ftLastAccessTime,
                          local.ftLastWriteTime,
+                         local.ftCreationTime,
                          pc.volser (),
                          (ULONGLONG) local.nFileSizeHigh << 32
                                      | local.nFileSizeLow,
@@ -302,8 +304,8 @@ fhandler_base::fstat_by_name (struct __stat64 *buf)
   else if (pc.isdir ())
     {
       FILETIME ft = {};
-      res = fstat_helper (buf, ft, ft, ft, pc.volser (), 0ULL, -1LL, 0ULL, 1,
-                         FILE_ATTRIBUTE_DIRECTORY);
+      res = fstat_helper (buf, ft, ft, ft, ft, pc.volser (), 0ULL, -1LL, 0ULL,
+                         1, FILE_ATTRIBUTE_DIRECTORY);
     }
   else
     {
@@ -379,6 +381,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
                             FILETIME ftChangeTime,
                             FILETIME ftLastAccessTime,
                             FILETIME ftLastWriteTime,
+                            FILETIME ftCreationTime,
                             DWORD dwVolumeSerialNumber,
                             ULONGLONG nFileSize,
                             LONGLONG nAllocSize,
@@ -392,6 +395,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
   to_timestruc_t (&ftLastAccessTime, &buf->st_atim);
   to_timestruc_t (&ftLastWriteTime, &buf->st_mtim);
   to_timestruc_t (&ftChangeTime, &buf->st_ctim);
+  to_timestruc_t (&ftCreationTime, &buf->st_birthtim);
   buf->st_dev = dwVolumeSerialNumber ?: pc.volser ();
   buf->st_size = (_off64_t) nFileSize;
   /* The number of links to a directory includes the
index 0748a48..543c7f8 100644 (file)
@@ -44,7 +44,7 @@ fhandler_mailslot::fstat (struct __stat64 *buf)
       buf->st_nlink = 1;
       buf->st_blksize = PREFERRED_IO_BLKSIZE;
       time_as_timestruc_t (&buf->st_ctim);
-      buf->st_atim = buf->st_mtim = buf->st_ctim;
+      buf->st_atim = buf->st_mtim = buf->st_birthtim = buf->st_ctim;
     }
   return 0;
 }
index 4da413b..1abb99d 100644 (file)
@@ -161,8 +161,9 @@ fhandler_process::fstat (struct __stat64 *buf)
       return -1;
     case 1:
     case 2:
-      buf->st_ctime = buf->st_mtime = p->start_time;
-      buf->st_ctim.tv_nsec = buf->st_mtim.tv_nsec = 0;
+      buf->st_ctime = buf->st_mtime = buf->st_birthtime = p->start_time;
+      buf->st_ctim.tv_nsec = buf->st_mtim.tv_nsec
+       = buf->st_birthtim.tv_nsec = 0;
       time_as_timestruc_t (&buf->st_atim);
       buf->st_uid = p->uid;
       buf->st_gid = p->gid;
index 13c8fa2..e59b404 100644 (file)
@@ -57,7 +57,7 @@ fhandler_dev_raw::fstat (struct __stat64 *buf)
       buf->st_nlink = 1;
       buf->st_blksize = PREFERRED_IO_BLKSIZE;
       time_as_timestruc_t (&buf->st_ctim);
-      buf->st_atim = buf->st_mtim = buf->st_ctim;
+      buf->st_atim = buf->st_mtim = buf->st_birthtim = buf->st_ctim;
     }
   return 0;
 }
index 26e9750..62cd8f4 100644 (file)
@@ -248,7 +248,7 @@ fhandler_registry::fstat (struct __stat64 *buf)
                               &ftLastWriteTime))
            {
              to_timestruc_t (&ftLastWriteTime, &buf->st_mtim);
-             buf->st_ctim = buf->st_mtim;
+             buf->st_ctim = buf->st_birthtim = buf->st_mtim;
              time_as_timestruc_t (&buf->st_atim);
              if (file_type > 0)
                buf->st_nlink = subkey_count + 2;
index 2ae7709..3fb011b 100644 (file)
@@ -1,6 +1,6 @@
 /* cygwin/stat.h
 
-   Copyright 2002 Red Hat Inc.
+   Copyright 2002, 2007 Red Hat Inc.
    Written by Corinna Vinschen <corinna@vinschen.de>
 
 This file is part of Cygwin.
@@ -50,7 +50,7 @@ struct __stat64
   timestruc_t   st_ctim;
   blksize_t     st_blksize;
   __blkcnt64_t  st_blocks;
-  long          st_spare4[2];
+  timestruc_t   st_birthtim;
 };
 
 extern int fstat64 (int fd, struct __stat64 *buf);
@@ -74,12 +74,19 @@ struct stat
   timestruc_t   st_ctim;
   blksize_t     st_blksize;
   blkcnt_t      st_blocks;
+#ifdef __CYGWIN_USE_BIG_TYPES__
+  timestruc_t   st_birthtim;
+#else
   long          st_spare4[2];
+#endif
 };
 
 #define st_atime st_atim.tv_sec
 #define st_mtime st_mtim.tv_sec
 #define st_ctime st_ctim.tv_sec
+#ifdef __CYGWIN_USE_BIG_TYPES__
+#define st_birthtime st_birthtim.tv_sec
+#endif
 
 #ifdef __cplusplus
 }
index 33e5ac9..90f1bce 100644 (file)
@@ -306,12 +306,13 @@ details. */
       165: Export mq_close, mq_getattr, mq_notify, mq_open, mq_receive,
           mq_send, mq_setattr, mq_timedreceive, mq_timedsend, mq_unlink.
       166: Export sem_unlink.
+      167: Add st_birthtim to struct stat.
      */
 
      /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
 
 #define CYGWIN_VERSION_API_MAJOR 0
-#define CYGWIN_VERSION_API_MINOR 166
+#define CYGWIN_VERSION_API_MINOR 167
 
      /* There is also a compatibity version number associated with the
        shared memory regions.  It is incremented when incompatible