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 20:19:29 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-04-02 20:19:29 +0400
commit467e17b9af28a79cf58a8074637bb2c926765dca (patch)
treef6441219b54de4435325ae96e20d332edb49bfde
parentf7c8c4540a86561fc4cc100c0d752740231d7960 (diff)
* fhandler.h (fhandler_base::stat_fixup): Rename from
fhandler_base::set_ino_and_dev. * syscalls.cc (fhandler_base::stat_fixup): Ditto. Accommodate name change throughout. Fixup link count of console devices.
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/fhandler.h2
-rw-r--r--winsup/cygwin/syscalls.cc14
3 files changed, 18 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 339066306..5ef183e0b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,12 @@
2012-04-02 Corinna Vinschen <corinna@vinschen.de>
+ * fhandler.h (fhandler_base::stat_fixup): Rename from
+ fhandler_base::set_ino_and_dev.
+ * syscalls.cc (fhandler_base::stat_fixup): Ditto. Accommodate name
+ change throughout. Fixup link count of console devices.
+
+2012-04-02 Corinna Vinschen <corinna@vinschen.de>
+
* devices.h (FH_CYGDRIVE): Define as DEV_VIRTFS_MAJOR class device.
(DEV_CYGDRIVE_MAJOR): Remove.
(iscygdrive_dev): Define.
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 683c45dbd..cad30189f 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -328,7 +328,7 @@ class fhandler_base
# define archetype_usecount(n) _archetype_usecount (__PRETTY_FUNCTION__, __LINE__, (n))
int close_fs () { return fhandler_base::close (); }
virtual int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
- void set_ino_and_dev (struct __stat64 *buf) __attribute__ ((regparm (2)));
+ void stat_fixup (struct __stat64 *buf) __attribute__ ((regparm (2)));
int __stdcall fstat_fs (struct __stat64 *buf) __attribute__ ((regparm (2)));
private:
int __stdcall fstat_helper (struct __stat64 *buf,
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index fce0d28ee..81a1238dd 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1589,7 +1589,7 @@ static struct __stat64 dev_st;
static bool dev_st_inited;
void
-fhandler_base::set_ino_and_dev (struct __stat64 *buf)
+fhandler_base::stat_fixup (struct __stat64 *buf)
{
if (!buf->st_ino)
buf->st_ino = get_ino ();
@@ -1613,7 +1613,13 @@ fhandler_base::set_ino_and_dev (struct __stat64 *buf)
}
/* Only set st_rdev if it's a device. */
if (!buf->st_rdev && get_major () != DEV_VIRTFS_MAJOR)
- buf->st_rdev = get_device ();
+ {
+ buf->st_rdev = get_device ();
+ /* consX, console, conin, and conout point to the same device.
+ make sure the link count is correct. */
+ if (buf->st_rdev == (dev_t) myself->ctty && iscons_dev (myself->ctty))
+ buf->st_nlink = 4;
+ }
}
extern "C" int
@@ -1629,7 +1635,7 @@ fstat64 (int fd, struct __stat64 *buf)
memset (buf, 0, sizeof (struct __stat64));
res = cfd->fstat (buf);
if (!res)
- cfd->set_ino_and_dev (buf);
+ cfd->stat_fixup (buf);
}
syscall_printf ("%R = fstat(%d, %p)", res, fd, buf);
@@ -1768,7 +1774,7 @@ stat_worker (path_conv &pc, struct __stat64 *buf)
memset (buf, 0, sizeof (*buf));
res = fh->fstat (buf);
if (!res)
- fh->set_ino_and_dev (buf);
+ fh->stat_fixup (buf);
delete fh;
}
else