9fans archive / 2001 / 03 / 285 / prev next
From: Alexander Viro <viro@mat...>
Subject: Re: [9fans] 9fs/9auth for FreeBSD
Date: Wed, 28 Mar 2001 18:35:34 -0500 (EST)
On Wed, 28 Mar 2001, Lyndon Nerenberg wrote:
> >>>>> "Alexander" == Alexander Viro <viro@mat...> writes:
>
> Alexander> PS: POSIX says nothing, since append-only is BSDism and
> Alexander> POSIX is a codification of Missed'em'V bugs, so
> Alexander> append-only is out of scope.
>
> Let's make sure we're talking about the same thing here. The chflags()
> behaviour is 4.4BSD-specific. The O_APPEND behaviour has been around
> since the dawn of time (or at least SVR1). My copy of POSIX is at
> home, however SuS V2 states explicitly (both open(2) and write(2))
> that O_APPEND causes all writes to set the file pointer to the end of
> the file prior to performing the write I/O, and that the combination
> of the implicit seek and the associated write are atomic.
Wait a second. The question being: what happens if you open append-only
file with fd = open("foo", O_RDWR), then lseek(fd, 0, SEEK_SET), then
write(fd, buf, len)?
Plan9: append to EOF.
Linux: -EPERM on open()
FreeBSD: -EPERM on write() (open() succeeds).