Driver API anyone?
Posted Jun 21, 2007 13:13 UTC (Thu) by
davecb (subscriber, #1574)
In reply to:
Driver API anyone? by michaeljt
Parent article:
Long-term support and backport risk
There is a middle ground: versioned APIs. Multics did this
long before Unix even existed, and the big commercial vendors
are doing a subset of it for kernel->userland APIs.
Assume a function setvbuf(FILE *fp, char *buf, int type, size_t size)
where the size_t is about to becomes a 64-bit variable. The user
writes a call to setvbuf and at link time it's mapped internally
to setvbuf'SYSVABI_1.3 where the SYSVABI_1.3 is only visible to
tools likle (Solaris) pvs.
Imagine that in SVABI_1.4, the int and pointer sizes bcome 64 bits,
but our program doesn't call it: it calls the 32-bit one
from SYSVABI_1.3. Updated systems have two copies of setvbuf,
one for each version, and the elf loader uses the labelled ones
to disambiguate calls from old versus new binaries.
New programs compiled after SVABI_1.4 came out use the new version,
and if a program or driver is recompiled, it uses the newest ones.
This is a blatant oversimplification (Multics did it better), but
you get the flavor...
--dave
(
Log in to post comments)