[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: flock, FAGAIN, and FWOULDBLOCK



On 2/23/09, Kyle McMartin <kyle@infradead.org> wrote:
> On Mon, Feb 23, 2009 at 04:20:53PM +1300, Michael Kerrisk wrote:
>> * POSIX has no specification of flock() (only fcntl() locking is
>> specified by POSIX.1).
>>
>
> *nod* My mistake.
>
>> * My understanding is that EAGAIN originated on System V, and was the
>> error returned instead of blocking for system calls performing I/O,
>> semaphore operations, message queue operations, and (fcntl()) file
>> locking.  EWOULDBLOCK originated on BSD, and was returned by (flock())
>> file locking and socket-related system calls.
>>
>> * flock() is a BSDism, and the associated error was EWOULDBLOCK.
>>
>> * Generally POSIX requires that each error name must have  distinct
>> associated value.  EAGAIN and EWOULDBLOCK are one of the few
>> exceptions: POSIX permits, but does not require, that these error
>> constants have the same value.  On most systems they of course do have
>> the same value.  HP-UX is the most notable exception.
>>
>
> You appear to be be quite correct, I would imagine this is 'hysterical
> raisins.'

I suspect it comes from HP-UX's history of trying to ride two horses
(BSD and System V) in the days before standards had something to say
about it all, but that's just a guess on my part.

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git
man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html


Reply to: