Subject: Re: /dev/stdout wierdness
To: Jarommr Dolecek <>
From: Bill Studenmund <>
List: tech-userlevel
Date: 03/01/2001 12:54:31
On Thu, 1 Mar 2001, Jarommr Dolecek wrote:

> I think that the right fix to the problem is if fdesc would remove
> the O_TRUNC flag. For this to work properly, VOP_OPEN() has to be called
> before anything depending on O_TRUNC being set is executed.

How would that work? VOP_OPEN is passed the mode (with O_TRUNC in it) by
value. It can clear it all it wants, but the caller will still have a mode
value with O_TRUNC in it.

The real thing we need to do is prevent the VOP_SETATTR call from
truncating the file. If we do that, it doesn't matter if we re-arrange
vn_open or not (and I'd rather not re-arrange it since it's known to work
and we might tickle bugs in other places otherwise).

This shouldn't be hard to do. We have the file descriptor, which has a
pointer to the file, which has the flags the original open was passed.
So the fdesc code, specifically fdesc_setattr(), can know if it's an
append-only file descriptor, and block the truncate.

Take care,