There are other ways to get this effect, as the command table is nothing else as a jump-table modifying a pointer in the table will let you ececute different code and 'exchange' a command on the fly. To load the new code you have the option of using rld (see man rld) which will dynamically load code into your program and link it (like with ld to undefined symbols of your code. However this option just works once as the symbols are no longer undefined after runntime linking. As I've seen rld doesn't exist on Suns, hmmm. Well, however the idea is to load an objectfile, scan the undefined symbols and get their start addresses, match their symbols against the command in the command table (e.g: by strcmp("junk","do_junk"+3)==0 ) and replace the old address with the new ones in the commandtable. This is done by most interpreter style programming languages also capable of loading compiled code. But compatibility is very very bad. Usually each system needs its own source-file to implement this. If someone still wants to implement that he might wish to take a look at gcl2.x (gnu Common Lisp) and check out the files unixfasl.c, sfaslelf.c, fasldlsym.c, ... Cat.
This archive was generated by hypermail 2b30 : 12/07/00 PST