David Collier-Brown -- Customer Engineering
David.Collier-Brown at Sun.COM
Fri Dec 13 16:12:00 GMT 2002
Derrell.Lipman at UnwiredUniverse.com wrote:
> It appears I've nearly got it solved (unless another big problem turns up
> after I fix this one). Aside from my initialization routine not be called
> early enough, thus providing some null function pointers,
Hmmn, In a different discussion group I once wrote:
The plugin uses a set of NULL pointers and a check
in each interceptor to do initialization, as Linux
lacks #pragma init(name-of-init-function).
This is inefficient (and inelegant).
Today, a free software program called valgrind
was released as a linux LD_PRELOAD program, and
it uses the following assembler option to
declare vgPlain_startup to be the init function
for the program, just as Sun' compiler option does:
This is used with the gnu linker option -z initfirst,
and ensures that the .init section is run first.
Therefor we now know how to simulate #pragma init
for Linux, and can drop the null pointers. This
increases efficiency (by one instruction time, big deal),
and ensures that initialization occurs before the user
programs does **anything**. The latter may make
wget work on all machines, as in the cases where it
failed, it appeared to be starting too late, after
one of the critical application system calls.
Does this help?
David Collier-Brown, | Always do right. This will gratify
Sun Microsystems DCMO | some people and astonish the rest.
Toronto, Ontario |
(905) 415-2849 or x52849 | davecb at canada.sun.com
More information about the samba-technical