This is the mail archive of the
mailing list for the glibc project.
Re: LD_PRELOAD called multiple times for a single system call
- To: <stephen dot done at cw dot com>
- Subject: Re: LD_PRELOAD called multiple times for a single system call
- From: Andreas Jaeger <aj at suse dot de>
- Date: 30 May 2001 07:03:32 +0200
- Cc: <libc-alpha at sources dot redhat dot com>, "Stephen Done" <stephen dot done at cwcom dot net>
- References: <MOEKKPNMHCABCHMFENMECEKPCDAA.firstname.lastname@example.org>
"Stephen Done at home" <email@example.com> writes:
> 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:
> 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.
You can call the libc syscall routine directly.
> 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 ?
You have the source, just check it.
> Is this interface subject to change between glibc versions ?
SuSE Labs firstname.lastname@example.org