Posix and Single Unix -- atime and mtime changes

Trever Adams (highlander@teleteam.net)
Sun, 13 Dec 1998 19:39:49 -0600


Below is a message that has a partial correspondence between myself and
the current maintainer of leafnode. He and I have found some
strangeness in the latest version. As the message explains, if you read
the quotes, it seems it is due to Linux not modifying atime and mtime
when it is opened but not written as shown in the code snippet below. I
am not familiar enough with Posix and Single Unix Spec. to say for sure
if what Linux does is correct or not, though, as my comments in the
quotes show, I do not believe it is correct.

Trever Adams
highlander@teleteam.net

> Cornelius Krasel wrote:
> > Arnt Gulbrandsen and I were under the impression that opening a file would
> > necessarily change its atime and mtime (this is how it is described in
> > Stevens). It appears that this is not the case under Linux (I did some
> > testing). Therefore the next version of leafnode will set the atime and
> > mtime of these files by calling utime() instead.
>
> Hmm, I believe that would be a violation of POSIX and the Single Unix
> Specification. Do you mind if I post your message to the linux kernel
> mailing list?

Maybe you check the code first. Here it is:

void markinterest( void ) {
int f;

if ( !justaftergroup )
return;
sprintf( s, "%s/interesting.groups/%s", spooldir, group->name );
if ( (f=open( s, O_WRONLY|O_CREAT|O_APPEND, 0644)) >= 0 )
close(f);
justaftergroup = FALSE;
}

Maybe it is the O_APPEND ?

--Cornelius (clueless).

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