Subject: Re: kernel stack traceback
To: Bill Studenmund <>
From: Andrew Brown <>
List: tech-kern
Date: 03/19/1999 16:35:20
>> >So the fmode is O_RDWR | O_NONBLOCK | O_APPEND | O_CREAT | O_TRUNC.
>> >all writes naturally append?
>> No.
>append. But if you open with O_TRUNC, isn't the current file position set
>possition, and update that possition. ??

if you have only one writer, then


is the same as:


but if you add more writers, it's not.  each write() will only update
that single writer's file pointer, not append the data.  likewise, if
you are alternately seeking and writing in an attempt to write to the
end of the file, you're in a race condition where you can get messed
up by someone else doing the same thing.

O_TRUNC is presumably there to empty the file.  O_APPEND is there to
make sure that all writes go to the end of the file, regardless of any
seek()s and read()s (it is opened O_RDRW) that have been done.
