Re: [PATCH] getsockname() always fails with EFAULT in 2.1.127pre7

Philip Blundell (philb@gnu.org)
Sat, 07 Nov 1998 09:18:48 +0100


>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/