View Single Post
  #1  
Old 11th November 2006, 13:49
havokdrums havokdrums is offline
Junior Member
 
Join Date: Nov 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default __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.
Reply With Quote
Sponsored Links