Re: IS_ERR Threshold Value

From: Randy.Dunlap
Date: Sat Jul 01 2006 - 14:39:53 EST


On Thu, 29 Jun 2006 19:10:13 +0100 Ralf Baechle wrote:

> On Wed, Jun 28, 2006 at 02:08:25PM -0700, Randy.Dunlap wrote:
>
> > Hi,
> > Peter Anvin mentioned just a few days ago that this threshold value
> > should be 4095 for all arches. I think we need to get that patch
> > done & submitted to Andrew for -mm.
>
> So here the patch is:
>
> o Raise the maximum error number in IS_ERR_VALUE to 4095.
> o Make that number available as a new constant MAX_ERRNO.
>
> Signed-off-by: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
>
> diff --git a/include/linux/err.h b/include/linux/err.h
> index ff71d2a..cd3b367 100644
> --- a/include/linux/err.h
> +++ b/include/linux/err.h
> @@ -13,7 +13,9 @@ #include <asm/errno.h>
> * This should be a per-architecture thing, to allow different
> * error and pointer decisions.
> */
> -#define IS_ERR_VALUE(x) unlikely((x) > (unsigned long)-1000L)
> +#define MAX_ERRNO 4095
> +
> +#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
>
> static inline void *ERR_PTR(long error)
> {

Are changes also needed in asm-*/unistd.h::syscall_return() macros?
or is syscall_return() just not used?

e.g.,
arm26 uses -125 to detect error
arm uses -129 to detect error
frv uses -4095 to detect error
i386 uses -129
h8300, m32r, s390, sh64, v850 use -125
m68k[nommu] uses -125
sh uses -124
x86_64 uses -127


---
~Randy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/