Subject: Re: COMPAT_LINUX and errno: one more bug?
To: Emmanuel Dreyfus <>
From: Jaromír Dolecek <>
List: tech-kern
Date: 02/08/2001 21:40:36
Emmanuel Dreyfus wrote:
> Hence, with all this stuff, don't we send a negative value to the
> userland. Kernel traces show this clearly:
>   4489 simplex  NAMI  "/usr/lib/"
>   4489 simplex  RET   open -1 errno -2 No such file or directory
> But here is my problem: shouldn't be errno positive numbers, in user
> land? This is POSIXized, isn't it? Linux uses negative errno in the

Indeed, errno in userland is positive.

Though, the return value for actual syscall may not be. Linux syscalls
return >= 0 for success, -errno for failure, at least on i386. (g)libc
stubs then translate then map the return code and set C errno appropriately.

The way emulation works is that all emulation code uses NetBSD
positive error values and the value is translated by MD code
upon return from syscall appropriately for emulation.

Jaromir Dolecek <>
@@@@  Wanna a real operating system ? Go and get NetBSD, dammit!  @@@@