On Sunday 26 March 2006 9:31 am, Eric Piel wrote:Well, that's half true. Indeed, in general, having two separate definitions invites version skew. However, in this particular case, it's slightly different: because the principle of the ABI is to be stable, or more exactly _compatible_. This means that if one definition was right at some point in the time, it should always still be true ten years later. At worse, the ABI can be extended, but never changed. If the specification (KABI) and the implementation (Linux) are not compatible it means the kernel developers screwed up, not that the KABI maintainers haven't updated in time.I completely agree with rules 1, 2 and 5. However, IMHO rule 4 should
just be the inverse of rule 5: The stuff in include/linux should always
be independent from KABI (and userspace of course). Simply because the
way we _implement_ things in the kernel has to be different from the
things that we _specify_ in the kernel ABI.
You know all the stuff that's marked __user? It's all kernel ABI. Having it defined in two places invites version skew, and the kernel needs it too because the kernel is parsing the stuff sent in by userspace and filling it out to send back to userspace.
Lots of syscalls and ioctls and such pass a structure back and forth from userspace to the kernel and back, right? Doing a stat() fills out a structure, doing an losetup fills out a structure, and so on.
Userspace needs to know what's in this structure. It may be wrapped in a libc function that fills out a different structure from the kernel structure, but the data that goes back and forth between the program and the kernel has to be defined in a header somewhere so the libc knows what the kernel's sending and the kernel knows what the libc is sending. (And for those functions with no libc wrapper, the user program needs to know the structure directly, somehow.)
Having a data-marshalling ABI structure defined in two places invites version skew. Userspace needs access to this (at least to build a libc), and the kernel needs access to this, because it's a _communication_mechanism_. You can't have a communication mechanism that's only defined at one end.