bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Different exported symbols in libc.a and libc.so


From: Constantin Loizides
Subject: Re: Different exported symbols in libc.a and libc.so
Date: Tue, 16 Oct 2001 18:23:25 +0200

Hi,

> You shouldn't rely on the chdir/__chdir relationship when you're
> trying to write a chdir wrapper.  Instead, you should simply wrap
> chdir, without worrying about __chdir.
> 
> With dynamic shared objects, you should be able to do this with dlsym
> and RTLD_NEXT.
> 
> This stuff isn't in the glibc 2.2.4 documentation, so it's no wonder
> you're not familiar with it.  But you have the source.
Thanx for your tip! I managed to understand how to use
dlsym with RTLD_NEXT to wrap simple calls.

But now suppose that I also want to catch calls from inside
the glibc :
eg. I define my own open which makes use of the glibc open
via the dlsym and RTLD_NEXT, then my application
uses fopen. This fopen I will not catch as it uses
__open with is a weak symbol of __libc_open. 
How do you suggest to catch that without relaying on it!

Up to now I do:
int __open (const char *file,int oflag,...) __attribute__ ((alias
("myopen")));


Constantin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]