Re: errno

From: Linus Torvalds
Date: Mon May 03 2004 - 23:17:05 EST




On Mon, 3 May 2004, Albert Cahalan wrote:
>
> The obvious fix would be to stuff errno into the
> task_struct, hmmm?

No. "errno" is one of those fundamentally broken things that should not
exist. It was wrogn in original UNIX, it's wrong now.

The kernel usage comes not from the kernel wanting to use it per se (the
kernel has always used the "negative error" approach), but from some
misguided kernel modules using the user-space interfaces.

The Linux way of returning negative error numbers is much nicer. It's
inherently thread-safe, and it has no performance downsides. Of course, it
does depend on having enough of a result domain that you can always
separate error returns from good returns, but that's true in practice for
all system calls.

Too bad we can't fix broken calling conventions.

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