Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Kernel Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11th November 2006, 12: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
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:28.


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