public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Phillip Susi <psusi@cfl.rr.com>
To: Greg KH <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: tty idle time and hooking inode_ops from a chardev
Date: Fri, 16 Dec 2011 14:09:05 -0500	[thread overview]
Message-ID: <4EEB9751.7030000@cfl.rr.com> (raw)
In-Reply-To: <20111216183613.GA3612@suse.de>

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.


  reply	other threads:[~2011-12-16 19:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-16 16:52 tty idle time and hooking inode_ops from a chardev Phillip Susi
2011-12-16 17:57 ` Greg KH
2011-12-16 18:22   ` Phillip Susi
2011-12-16 18:36     ` Greg KH
2011-12-16 19:09       ` Phillip Susi [this message]
2011-12-16 19:49       ` Phillip Susi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EEB9751.7030000@cfl.rr.com \
    --to=psusi@cfl.rr.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox