DragonFly kernel List (threaded) for 2005-05
Re: The time has come for a kernel interfacing library layer
:Do you mean kernel will directly write errno into userland memory?
No, what I'm working on is a system call 'library' layer which is
intended to be part of libc without actually being part of libc.
The way it will work is that libc will declare a special code section
(whether dynamic or statically linked) which the kernel will recognize
and remap/override. In the best case libc's code section will simply
be a BSS section (not take up any space in the filesystem).
This section will contain function entry points for system calls at
fixed offsets. I'm trying to make this layer completely independant
of everything else, which means that I would prefer that the kernel
simply map the appropriate system call library into it without doing
any further relocations. So the question becomes... how to deal
with errno ? The kernel itself doesn't set it, so the syscall library
has to. The easiest way to do that is to either store a pointer to
errno in the TCB or to store errno itself in the TCB.
The kernel would select which layer file to map based on the ABI
version of the program (based on the section name) verses the ABI
version of the kernel. Theoretically this means that we can then
change system calls in the kernel, like the stat structure, and still
provide compatibility functions for programs expecting older ABIs.
And, theoretically, we can also run programs expecting newer ABIs
on older systems by providing the appropriate syscall layer to
translate the ABIs.