diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2002-06-03 17:44:09 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2002-06-03 17:44:09 +0000 |
commit | b3c297314238dad32354d819bce0e6b94f632a65 (patch) | |
tree | 86d1100668ed5550dc6d788c3039de78ae9c7a4b | |
parent | 656c31920bcccd705d53e15f0184fc0e5e769a6a (diff) | |
download | newlib-b3c297314238dad32354d819bce0e6b94f632a65.zip newlib-b3c297314238dad32354d819bce0e6b94f632a65.tar.gz newlib-b3c297314238dad32354d819bce0e6b94f632a65.tar.bz2 |
* 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.
-rw-r--r-- | winsup/cygwin/ChangeLog | 11 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/stat.h | 8 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/types.h | 8 | ||||
-rw-r--r-- | winsup/cygwin/include/sys/sysmacros.h | 8 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 11 |
5 files changed, 39 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 654b167..99477ef 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2002-06-03 Corinna Vinschen <corinna@vinschen.de> + + * 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. + 2002-06-03 Pierre Humblet <pierre.humblet@ieee.org> * syscalls.cc (setegid32): Verify the correctness of the gid diff --git a/winsup/cygwin/include/cygwin/stat.h b/winsup/cygwin/include/cygwin/stat.h index 90abc39..0ac22a6 100644 --- a/winsup/cygwin/include/cygwin/stat.h +++ b/winsup/cygwin/include/cygwin/stat.h @@ -19,13 +19,13 @@ extern "C" { #ifdef __INSIDE_CYGWIN__ struct __stat32 { - dev_t st_dev; + __dev16_t st_dev; ino_t st_ino; mode_t st_mode; nlink_t st_nlink; __uid16_t st_uid; __gid16_t st_gid; - dev_t st_rdev; + __dev16_t st_rdev; __off32_t st_size; time_t st_atime; long st_spare1; @@ -40,13 +40,13 @@ struct __stat32 struct __stat64 { - dev_t st_dev; + __dev32_t st_dev; ino_t st_ino; mode_t st_mode; nlink_t st_nlink; __uid32_t st_uid; __gid32_t st_gid; - dev_t st_rdev; + __dev32_t st_rdev; __off64_t st_size; time_t st_atime; long st_spare1; diff --git a/winsup/cygwin/include/cygwin/types.h b/winsup/cygwin/include/cygwin/types.h index 92b60b7..8f9f161 100644 --- a/winsup/cygwin/include/cygwin/types.h +++ b/winsup/cygwin/include/cygwin/types.h @@ -27,6 +27,14 @@ typedef __off64_t off_t; typedef __off32_t off_t; #endif +typedef short __dev16_t; +typedef unsigned long __dev32_t; +#ifdef __CYGWIN_USE_BIG_TYPES__ +typedef __dev32_t dev_t; +#else +typedef __dev16_t dev_t; +#endif + typedef long blksize_t; typedef long __blkcnt32_t; diff --git a/winsup/cygwin/include/sys/sysmacros.h b/winsup/cygwin/include/sys/sysmacros.h index cc3a691..2c9c699 100644 --- a/winsup/cygwin/include/sys/sysmacros.h +++ b/winsup/cygwin/include/sys/sysmacros.h @@ -11,8 +11,14 @@ details. */ #ifndef _SYS_SYSMACROS_H #define _SYS_SYSMACROS_H +#ifdef __CYGWIN_USE_BIG_TYPES__ +#define major(dev) ((int)(((dev) >> 16) & 0xffff)) +#define minor(dev) ((int)((dev) & 0xffff)) +#define makedev(major, minor) (((major) << 16) | ((minor) & 0xffff)) +#else #define major(dev) ((int)(((dev) >> 8) & 0xff)) #define minor(dev) ((int)((dev) & 0xff)) -#define makedev(major, minor) (((major) << 8) | (minor)) +#define makedev(major, minor) (((major) << 8) | ((minor) & 0xff)) +#endif #endif /* _SYS_SYSMACROS_H */ diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 54418c0..0c003db 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 (); } } |