lkml.org 
[lkml]   [1998]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] getsockname() always fails with EFAULT in 2.1.127pre7
Date
From
>And just a purely stupid question here.  Why would a kernel function set a
>return value to something like -EFAULT or -EBADF when a user program would
>check against that value with EFAULT or EBADF? Does the - not negate the
>value? I'm not saying it's wrong LOL, because it works. But what does it
>do why is it done that way?

It's set to a -ve value to say that it's an error. The glibc system call
wrappers flip it back to a positive value that the user sees. Return codes
outside the range (-4095..0) are successful result codes.

p.



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

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:0.183 / U:0.176 seconds]
©2003-2011 Jasper Spaans. Advertise on this site