This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]