Re: tty idle time and hooking inode_ops from a chardev

From: Phillip Susi
Date: Fri Dec 16 2011 - 14:09:17 EST


On 12/16/2011 1:36 PM, Greg KH wrote:
But you said that your userspace programs are opening the wrong tty
device for what you are trying to look at, right?

They are opening /dev/tty, which is supposed to be an alias for the process's controlling tty, but it isn't quite so. It routes read/write calls to the correct tty, but is a separate inode, so has its own timestamps.

That's not "fixing" it at all, adding an ioctl is the same as adding a
new system call, do you really think that is ok here?

I would prefer not to, which is why I'm trying to figure out how to make the atime correct no matter how you opened the tty.

As you are opening the tty node once, that's when atime is set, right?
The fact that you keep it open still keeps the atime to the original
open time, you aren't supposed to check for every single read/write of
the node once it was opened.

tty_io.c updates the atime of the inode on every successful read(), and the mtime on every successful write(). The problem is that several different inodes can all point to the same tty, so which inode gets updated depends on which process is doing the IO.

But to be sure, what does POSIX say about this?

No clue.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/