Re: [dev] Local vs global variables

From: Kris Maglione <>
Date: Fri, 6 Nov 2009 15:56:38 -0500

On Fri, Nov 06, 2009 at 09:50:05PM +0100, pancake wrote:
>Looks hard to me to think that plan9 is doing kernel2user memory
>copies to pass a errno string...

Kernel to user memory copies are cheap, especially when the
string is <128b. Syscalls are more expensive (but still cheap on
modern systems). None of this really matters much, though, given
that errors are exceptional condidtions. They happen relatively

>Errno in unix is not for kernel land. But kernel wrappers in libc do
>the task to fill errno corretly. But at te end.. Errno is just a int,
>not a string. Why don't just change a pointer?
>In unix there's errstr for this and perror which is a funny spanish
>word that means dog-r :P
>But the point is.. Why are the negative numbers not used for this?
>Any error for a syscall should return a negative value that should be
>used as an index in an array mapped in the process space by the
>kernel. Like the vdso in Linux.
>That will be a good implemention for errno :)

Because Plan 9 doesn't do error numbers, it does error strings.
Even process exit values are strings rather than numbers. It
has a lot to do with the fact that Plan 9 is a distributed
system that has to work with a lot of heterogeneous servers
which may have any number of unusual error conditions. It also
doesn't do localization, which is another not wholly unrelated

Kris Maglione
Just because the standard provides a cliff in front of you, you are
not necessarily required to jump off it.
	--Norman Diamond
Received on Fri Nov 06 2009 - 20:56:38 UTC

This archive was generated by hypermail 2.2.0 : Fri Nov 06 2009 - 21:00:03 UTC