[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ProgSoc] Shared Libraries
At 8:50 05 May 2000 +1000, Shaun Clowes wrote:
> I'm writing a shared library to be LD_PRELOADed and wrap around a glibc
> routine (in this case connect()). The wrapper library must read a
> configuration file in order to perform its function and since its
> preloaded for all processes I'm attempting to prevent doing any
> initialization till the first intercepted connect() occurs. Basically, my
> problem is how to show error messages in a library like this. Showing them
> on stderr could be a problem if its being redirected, putting them in
> syslog might be ok, but I'd rather not interfere with process global stuff
> like opening syslog, choosing a facility etc. Any ideas/thoughts?
The Way Of Least Interference might be just to write to your own log file
somewhere. Our product here at work that does the same thing just writes to
stderr, we found that this kind of behaviour didn't interfere with anything we
ran against.
Depending upon what you wanted to do, I'd also consider failing the library
call. ;) I'm sure people will have strong opinions about the horrible
incorrectness of that, but for connect(), at least, you know that the client
program is handling the failure. ;) Of course, it depends a lot on what you're
trying to do. LD_PRELOAD is cool.
Paul
--
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.
This list is archived at <http://www.progsoc.uts.edu.au/lists/progsoc/>