* syscalls.cc (fhandler_base::stat_fixup): Generate unique inode number
for /dev/tty under all circumstances. Add to comment.
This commit is contained in:
parent
22d65acb9c
commit
d260e92859
|
@ -1,3 +1,8 @@
|
||||||
|
2015-02-10 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* syscalls.cc (fhandler_base::stat_fixup): Generate unique inode number
|
||||||
|
for /dev/tty under all circumstances. Add to comment.
|
||||||
|
|
||||||
2015-02-06 Corinna Vinschen <corinna@vinschen.de>
|
2015-02-06 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* common.din: Export cabsl, cimagl, creall, finitel, hypotl, sqrtl.
|
* common.din: Export cabsl, cimagl, creall, finitel, hypotl, sqrtl.
|
||||||
|
|
|
@ -1720,10 +1720,21 @@ void
|
||||||
fhandler_base::stat_fixup (struct stat *buf)
|
fhandler_base::stat_fixup (struct stat *buf)
|
||||||
{
|
{
|
||||||
/* For devices, set inode number to device number. This gives us a valid,
|
/* For devices, set inode number to device number. This gives us a valid,
|
||||||
unique inode number without having to call hash_path_name. */
|
unique inode number without having to call hash_path_name. /dev/tty needs
|
||||||
|
a bit of persuasion to get the same st_ino value in stat and fstat. */
|
||||||
if (!buf->st_ino)
|
if (!buf->st_ino)
|
||||||
buf->st_ino = (get_major () == DEV_VIRTFS_MAJOR) ? get_ino ()
|
{
|
||||||
: get_device ();
|
if (get_major () == DEV_VIRTFS_MAJOR)
|
||||||
|
buf->st_ino = get_ino ();
|
||||||
|
else if (dev () == FH_TTY ||
|
||||||
|
((get_major () == DEV_PTYS_MAJOR
|
||||||
|
|| get_major () == DEV_CONS_MAJOR)
|
||||||
|
&& !strcmp (get_name (), "/dev/tty")))
|
||||||
|
buf->st_ino = FH_TTY;
|
||||||
|
else
|
||||||
|
buf->st_ino = get_device ();
|
||||||
|
|
||||||
|
}
|
||||||
/* For /dev-based devices, st_dev must be set to the device number of /dev,
|
/* 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
|
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
|
the process is to fetch the device number of /dev only once, liberally
|
||||||
|
|
Loading…
Reference in New Issue