From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Viro To: 9fans@cse.psu.edu Subject: Re: [9fans] 9fs/9auth for FreeBSD In-Reply-To: <200103281926.f2SJQnl94482@orthanc.ab.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Date: Wed, 28 Mar 2001 14:35:00 -0500 Topicbox-Message-UUID: 761b62e4-eac9-11e9-9e20-41e7f4b1d025 On Wed, 28 Mar 2001, Lyndon Nerenberg wrote: > Russ> the biggest shortcoming > Russ> is the lack of a portable way to implement append-only > Russ> files. freebsd (and presumably the other unix clones) take > Russ> append-only to mean "only appends succeed" rather than "all > Russ> writes are treated as appends", and there's no standard way > Russ> to enable even this. > On 4.4BSD-derived systems you should be able to get the behaviour you > want with chflags(path, UF_APPEND) after creating the file. During > subsequent opens you would have to check for this flag, and open with > O_APPEND if it is present (to force the writes to always be treated as > appends). Did you try this? (I realize it's not very portable.) > Without chflags() you would have to hijack on of the mode bits, which > is downright evil. In case of Linux append-only is "all writes are treated as appends" (see mm/filemap.c::generic_file_write()), so no wanking with O_APPEND on subsequent open() is needed, but marking file append-only _is_ downright evil - ioctl(fd, EXT2_IOC_SETFLAGS, EXT2_APPEND_FL). chflags() had been discussed many times, there are several patches of varying age that implement it, but nobody cared enough to get them into the tree.