HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Kernel Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=6)
-   -   __syscall_return macro in unistd.h (http://www.howtoforge.com/forums/showthread.php?t=8097)

havokdrums 11th November 2006 12:49

__syscall_return macro in unistd.h
 
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.


All times are GMT +2. The time now is 22:14.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.