Re: [PATCH] fix for idiocy in mount_root cleanups.

From: Alexander Viro (viro@math.psu.edu)
Date: Sat Dec 08 2001 - 15:42:18 EST


On Sat, 8 Dec 2001, Linus Torvalds wrote:

> "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
> compatibility.
>
> (If you care why "errno" is stupid, just think about threading and
> performance)

Oh, I know why errno is stupid and normally my reaction would be the
same. However, in this case I would prefer to add

static int errno;

to do_mounts.c and be done with that. Reasons:

a) eventually it's going to userland, at which point the issue becomes moot
(we won't share memory with anybody and don't do signal handlers).

b) within this file we have at most two threads of execution (do_linuxrc()
and the rest). mount_root() is called only while do_linuxrc() is either
not started yet or had already exited. IOW, even in kernel it's safe.

c) when it's in userland we will be really better off with _syscall5 for
mount() - we can rewrite it by hands to return the value in sane manner,
but that means bringing a _lot_ of arch-specific inline assmebler into
the file. Which we might have to do anyway, OTOH...

Dunno. At this stage I'd prefer the patch I've posted + static int errno;
in do_mounts.c. Alternatively, we can replace mount() with sys_mount() in
that place (everything else simply doesn't give a damn for errno) and deal
with that when we move code to userland.

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



This archive was generated by hypermail 2b29 : Sat Dec 15 2001 - 21:00:13 EST