* 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.
This commit is contained in:
Corinna Vinschen 2012-04-02 16:19:29 +00:00
parent f7c8c4540a
commit 467e17b9af
3 changed files with 18 additions and 5 deletions

View File

@ -1,3 +1,10 @@
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.

View File

@ -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,

View File

@ -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