Re: flock, FAGAIN, and FWOULDBLOCK

Carlos O'Donell
2009-02-23T03:00:46Z

On Sun, Feb 22, 2009 at 9:54 PM, Kyle McMartin <kyle@infradead.org> wrote:
>> A more robust solution would be?
>>
>> if ((ret == -EAGAIN) || (ret == -EWOULDBLOK))
>> ret = -EWOULDBLOCK
>>
>> This covers our ass since POSIX says that EAGAIN and EWOULDBLOCK *may*
>> be the same.
>>
>
> I have no idea what you're on about here, this is a parisc specific
> file, where we know they aren't. I don't want to pollute generic linux
> code with workarounds for moronic HPUX "let's be different for
> difference sake" crap.

If sys_flock can return one of -EAGAIN or -WOULDBLOCK, perhaps because
the generic code uses them interchangeably, then a more robust
solution is to check for both, and *then* return the expected value to
userspace.

Would this be a possible solution:
1) Make EAGAIN and EWOULDBLOCK the same for the kernel.
2) Leave the values the same for userspace.
3) Add wrappers in the parisc specific kernel code when a syscall need
to return one of EAGAIN or EWOULDBLOCK to userspace?

Cheers,
Carlos.