__syscall_return macro in unistd.h

Discussion in 'Kernel Questions' started by havokdrums, Nov 11, 2006.

  1. havokdrums

    havokdrums New Member

    I have a question about the __syscall_return macro, in include/asm-i386/unistd.h :

    /*
    * user-visible error numbers are in the range -1 - -128: see
    * <asm-i386/errno.h>
    */

    #define __syscall_return(type, res) \
    do { \
    if ((unsigned long)(res) >= (unsigned long)(-(128 + 1)) {\
    errno = -(res); \
    res = -1; \
    } \
    return (type) (res); \
    } while (0)


    My question is: if the system call returned -129, errno will be set to 129, which, as the commment says, is not a legal value (i.e. the value 129 is not defined for errno in errno.h).
    Can someone please explain me why the test is >= -(128+1) instead of >= -128 ?
    Thank you.
     

Share This Page