This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [parisc-linux] Re: [PATCH] Fix the atomic compare and swap function on hppa


On Tue, May 22, 2007 at 05:19:30PM +0200, Aurelien Jarno wrote:
> As discussed on IRC, there is actually a bug in the kernel:
> 
>   #define ENABLE_LWS_DEBUG 0
>   ...
>   # ifdef ENABLE_LWS_DEBUG
> 

Patch to switch #ifdef to #if $x == 1 or the #define to #undef welcome.

> ENABLE_LWS_DEBUG is defined as 0, so the debug code is enabled.
> 
> Please find below a patch which fixes the -EAGAIN problem by harcoding
> the value directly into the code. It also adds a workaround for unfixed
> kernels which return -EDEADLOCK.
> 
> +/* The only basic operation needed is compare and exchange.
> +   -11 corresponds to -EAGAIN, and -45 to -EDEADLOCK. The constants
> +   must stay the same to avoid breaking backwards compatibility.
> +
> +   The check for -EDEADLOCK workarounds a kernel bug (debugging code
> +   enabled by default). */

This is stupid. Why not just use the symbol and then #undef it
immediately afterwards? For extra paranoia name it LWS_RET_EAGAIN or
something.

Putting magic numbers in the code is irritating and makes it more
difficult to read it on a glance.

Regards,
	Kyle


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]