This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
LD_PRELOAD called multiple times for a single system call
- To: <libc-alpha at sources dot redhat dot com>
- Subject: LD_PRELOAD called multiple times for a single system call
- From: "Stephen Done at home" <stephen dot done at cw dot com>
- Date: Wed, 30 May 2001 00:35:20 +0100
- Cc: "Stephen Done" <stephen dot done at cwcom dot net>
- Reply-To: <stephen dot done at cw dot com>
Again, this is related to an LD_PRELOAD library that I wrote and must now
port from Solaris to Linux.
I have noticed that if you define certain functions within a library, when a
'preloaded' binary makes a single system call, multiple functions within the
library may get called.
Here are a couple of examples:
1
=
If a binary calls syslog(), the preload library will be called for syslog()
and fclose() (among others perhaps). One problems this causes is that you
can't syslog debug information inside your overidden fclose() call, since it
causes a seg fault due to the unending recursion.
2
=
If a binary calls execvp, then the preload library will receive calls to
execvp() and execv().
Since I am trying to create a cross platform preload library, I am trying to
find some consistency in this.
With Solaris, you only get one hook for each call, which makes life nice and
straightforward. It also works consistently between Solaris 2.6 & 2.8.
Is there any way to get this functionality under Linux ?
Alternatively, is there a way I can determine which calls made by a binary
trigger which multiple calls in the preload library under Linux ?
Is this interface subject to change between glibc versions ?
Thanks in advance for any help
Steve