This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Problem with library preloading plus procps
- From: "H . J . Lu" <hjl at lucon dot org>
- To: Manuel Arriaga <m dot arriaga at ip dot pt>
- Cc: GNU C Library <libc-alpha at sourceware dot cygnus dot com>,Ross Skaliotis <ross at student dot andover dot edu>
- Date: Sat, 29 Dec 2001 10:31:35 -0800
- Subject: Re: Problem with library preloading plus procps
- References: <EXCH01SMTP01fGdMNFm0000018f@smtp.netcabo.pt>
On Fri, Dec 28, 2001 at 04:01:35PM +0000, Manuel Arriaga wrote:
> Hello,
>
> I am using binutils-2.11.90.0.19, and procps-2.0.7 on GNU/Linux.
>
> When I set LD_PRELOAD and run a program, I expect _init() (defined in the
> preloaded object) to be called before any code in the program is executed.
>
> However, if you compile the code in the attached tarball, preload it and then
> run one of the commands in the procps package (ps, top, free) you might
> notice that the open() function is called before _init() is run.
>
> Can you offer any hints as to why this might be happening? As far as I know,
> this has occurred under Slackware 7.1, Slackware 8.0 and RedHat 7.1.
>
> Best regards,
>
> Manuel Arriaga
>
> PS: This isn't happening only on my machine; several users of libtrash
> (http://www.m-arriaga.net/software/libtrash) have described the same problem.
It is not a binutils issue. It is controlled by glibc. If you do,
# LD_DEBUG=files free
you will see the order of init being called. I don't know what the
right order is for calling init when LD_PRELOAD is used. Does anyone
know?
H.J.