Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-04-02 23:25:58 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-04-02 23:25:58 +0400
commiteb7729eb36da9c27121d17d088860079d4c64625 (patch)
tree7be5585a4e40df2570cc601c7c2f83e9d81dfa00 /winsup/cygwin/syscalls.cc
parent467e17b9af28a79cf58a8074637bb2c926765dca (diff)
* devices.h (device::get_device): New method.
* fhandler_dev.cc (fhandler_dev::readdir): Set st_ino to device number. * syscalls.cc (fhandler_base::stat_fixup): Ditto. Fix link count for CD-ROM devices. Fix typo in comment.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 81a1238dd..e70bb9772 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1591,8 +1591,10 @@ static bool dev_st_inited;
void
fhandler_base::stat_fixup (struct __stat64 *buf)
{
+ /* Set inode number to device number. This gives us a valid, unique
+ inode number and we especially don't have to call hash_path_name. */
if (!buf->st_ino)
- buf->st_ino = get_ino ();
+ buf->st_ino = get_device ();
/* For /dev-based devices, st_dev must be set to the device number of /dev,
not it's own device major/minor numbers. What we do here to speed up
the process is to fetch the device number of /dev only once, liberally
@@ -1616,9 +1618,12 @@ fhandler_base::stat_fixup (struct __stat64 *buf)
{
buf->st_rdev = get_device ();
/* consX, console, conin, and conout point to the same device.
- make sure the link count is correct. */
+ Make sure the link count is correct. */
if (buf->st_rdev == (dev_t) myself->ctty && iscons_dev (myself->ctty))
buf->st_nlink = 4;
+ /* CD-ROM drives have two links, /dev/srX and /dev/scdX. */
+ else if (gnu_dev_major (buf->st_rdev) == DEV_CDROM_MAJOR)
+ buf->st_nlink = 2;
}
}