Subject: Re: kern/31430: ptyfs isn't getting mtime right
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 10/12/2005 12:54:02
The following reply was made to PR kern/31430; it has been noted by GNATS.

From: christos@zoulas.com (Christos Zoulas)
To: Simon Burge <simonb@wasabisystems.com>
Cc: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/31430: ptyfs isn't getting mtime right
Date: Wed, 12 Oct 2005 08:53:43 -0400

 On Oct 12, 10:23pm, simonb@wasabisystems.com (Simon Burge) wrote:
 -- Subject: Re: kern/31430: ptyfs isn't getting mtime right
 
 | At least in the ptyfs case, I've worked out that a call to ptyfs_write
 | sets the "mtime modified" flag, but the mtime itself isn't modified
 | until ptyfs_itimes is called, usually during a call to ptyfs_getattr.
 | This explains why the mtime is the same as the next call to (say)
 | stat(2) after the pty is modified.
 | 
 | The patch below is a result of a discussion off-line with Christos.
 | The granularity of the mtime doesn't need to be down to the nanosecond
 | - using the kernel "time" variable (which is updated on each
 | hardclock call) saves a potentially relatively expensive call to
 | microtime/nanotime for each write, and is more than accurate enough to
 | track pty idle times.
 | 
 | For the old-style ptys I suspect the mtime is updated when the inode
 | will be synced to disk.
 | 
 | Christos - OK to commit the below patch?
 
 Please do, and thanks for working on this. We should let juan know that
 he might need the same for tmpfs.
 
 christos