diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2002-06-03 21:44:09 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2002-06-03 21:44:09 +0400 |
commit | b3c297314238dad32354d819bce0e6b94f632a65 (patch) | |
tree | 86d1100668ed5550dc6d788c3039de78ae9c7a4b /winsup/cygwin/syscalls.cc | |
parent | 656c31920bcccd705d53e15f0184fc0e5e769a6a (diff) |
* syscalls.cc (stat64_to_stat32): Transform st_dev correctly.
(fstat64): Add evaluating st_ino and st_dev.
(stat_worker): Evaluate st_dev as 32 bit value.
* include/cygwin/stat.h: Use new dev_t definition throughout.
* include/cygwin/types.h: Define __dev16_t and __dev32_t. Define
dev_t according to __CYGWIN_USE_BIG_TYPES__ setting.
* include/sys/sysmacros.h: Define major, minor and makedev
according to __CYGWIN_USE_BIG_TYPES__ setting.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r-- | winsup/cygwin/syscalls.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 54418c0a9..0c003dba6 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -985,7 +985,7 @@ fchmod (int fd, mode_t mode) static void stat64_to_stat32 (struct __stat64 *src, struct __stat32 *dst) { - dst->st_dev = src->st_dev; + dst->st_dev = ((src->st_dev >> 8) & 0xff00) | (src->st_dev & 0xff); dst->st_ino = src->st_ino; dst->st_mode = src->st_mode; dst->st_nlink = src->st_nlink; @@ -1014,6 +1014,13 @@ fstat64 (int fd, struct __stat64 *buf) path_conv pc (cfd->get_win32_name ()); memset (buf, 0, sizeof (struct __stat64)); res = cfd->fstat (buf, &pc); + if (!res) + { + if (!buf->st_ino) + buf->st_ino = hash_path_name (0, cfd->get_win32_name ()); + if (!buf->st_dev) + buf->st_dev = (cfd->get_device () << 16) | cfd->get_unit (); + } } syscall_printf ("%d = fstat (%d, %p)", res, fd, buf); @@ -1100,7 +1107,7 @@ stat_worker (const char *name, struct __stat64 *buf, int nofollow, if (!buf->st_ino) buf->st_ino = hash_path_name (0, fh->get_win32_name ()); if (!buf->st_dev) - buf->st_dev = FHDEVN (fh->get_device ()) << 8 | (fh->get_unit () & 0xff); + buf->st_dev = (fh->get_device () << 16) | fh->get_unit (); } } |