Subject: Re: kern/31430: ptyfs isn't getting mtime right
To: Simon Burge <simonb@wasabisystems.com>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 10/12/2005 08:53:43
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