* 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.
This commit is contained in:
Corinna Vinschen 2007-03-06 14:48:25 +00:00
parent 4e747c10dc
commit 70de8290c8
9 changed files with 43 additions and 12 deletions

View 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.

View 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;
}

View 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

View 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;
}

View 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;

View 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;
}

View 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;

View 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
}

View 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