Re: flock, FAGAIN, and FWOULDBLOCK

Helge Deller
2009-02-23T17:49:32Z

Matthew Wilcox wrote:
> On Sun, Feb 22, 2009 at 09:43:36PM -0500, Carlos O'Donell wrote:
>>> ...
>>> but somehow I suspect this interchangeable use of EAGAIN and EWOULDBLOCK
>>> is going to reveal latent problems in this part of the kernel I would
>>> rather not delve into...
>> The ABI is fixed, so all we can do is cleanup the uses in the kernel,
>> and make sure we adhere to the documented APIs.
>
> We actually can do better than this ...
>
> #ifdef __KERNEL__
> #define EWOULDBLOCK EAGAIN
> #else
> #define EWOULDBLOCK /* whatever the fuck HPUX uses */
> #endif

Wouldn't this hurt us if we at some point in time want to finish
the HPUX/Linux compat code in the parisc kernel?

Helge

> Now our kernel never returns -EWOULDBLOCK, only -EAGAIN. Correct
> applications must check for both. Incorrect applications tend to only
> check for AGAIN, not WOULDBLOCK. Problem solved.