From: Michele Andreoli (m.andreoli@tin.it)
Date: Thu Dec 14 2000 - 20:22:13 CET
On Thu, Dec 14, 2000 at 02:53:48PM +0100, Dumas Patrice nicely wrote:
> Always on the same subject, has anyone ever heard about a way to
> complement libraries, that is you have a library loaded in the system,
> and than you add some more code to the library, dynamically (a
> dynamically growing dynamic library....).
>
I know only a trick based on the /etc/ld.so.preload file.
If you put a library reference in this file, it will be
loaded FIRTS of all other. So, If you develope, for example,
a rustic math library and pre-load it in this way, your simbols
take precedence.
Anyway, the your is a not-problem: if you develope new functions,
you can just put the new library in /lib.
But my feel about the libc is a little different. In theory, a
kernel module can access directly to the kernel resource.
In other words, the kernel itself can act like a big library.
A kernel module can easily take input from a file in /proc; the
same, it can return output in a file in /proc. I saw
more example of that in the never-too-praised A. Rubini's book.
So, one can develope a sort of /proc/gateway-in and
/proc/gateway-out. You put with a script a command on the "in"
file and the module put its answer on the "out" file.
Example are routing table manipulation: in theory, it is possible
to remove command like "ifconfig" and "route" from muLinux.
You can replace ifconfig with a script which echo its command-line
parameter on the "in" file. The kernel-module listen to
the gateway-in and execute the relevant kernel code.
No mistery in that: libc is only a C gateway to the kernel
internals, isnt true? With this trick, a lot of system command
can be replaced with script 1-2 lines long!
The "hostname" command in muLinux works exactly in this way:
it simply echo the hostname on the kernel gateway
/proc/sys/kernel/hostname.
This is also the mechanism used by the asmutils, but using
assembler.
Michele
-- In summing up, I wish I had some kind of affirmative message to leave you with, I don't. Would you take two negative messages? - Woody Allen --------------------------------------------------------------------- To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk For additional commands, e-mail: mulinux-help@sunsite.auc.dk
This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:17 CET