Date: Sat, 8 Dec 2001 10:00:00 -0800 (PST)
From: Linus Torvalds <email@example.com>
Subject: Re: [PATCH] fix for idiocy in mount_root cleanups.
On Sat, 8 Dec 2001, Alexander Viro wrote:
> Change in question was s/do_mount/mount/. Which is almost
> the same thing, except for one little detail: mount(2) in case of
> error returns -1 and stores the error in errno. do_mount(9), OTOH...
Don't use errno in the kernel. EVER. This is a bug, we should get rid of
Please fix "mount()" instead.
"errno" is one of those few _really_ bad stupidities in UNIX. Linux has
fixed it, and doesn't use it internally, and never shall. Too bad that
user space has to fix up the _correct_ error code returning that the
kernel does, and turn it into the "errno" stupidity for backwards
(If you care why "errno" is stupid, just think about threading and
From: Linus Torvalds <firstname.lastname@example.org>
Subject: Re: errno
Date: Tue, 4 May 2004 04:17:10 GMT
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 wrong 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.