Different exported symbols in libc.a and libc.so

Constantin Loizides Constantin.Loizides@isg.de
Tue Oct 16 09:23:00 GMT 2001


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



More information about the Libc-alpha mailing list