Re: LD_PRELOAD odities / Documentation?

2000-08-04 Thread John Polstra
In article <[EMAIL PROTECTED]>, Karl Pielorz <[EMAIL PROTECTED]> wrote: > One of the ways I've tried implementing syscalls is to dlopen() the > correct library, and fetch the routines address from there (using > dlsym) - and calling the routine that way... > > This doesn't seem to help though :(

Re: LD_PRELOAD odities / Documentation?

2000-08-04 Thread Karl Pielorz
Bjoern Fischer wrote: > To wrap libc functions you have to use dlsym() with the special > handle RTLD_NEXT to get the next incarnation of your function. > E.g. you want to wrap fchmod(), so write your own fchmod() and > after you `corrected' the params you may have to call the `real' > fchmod().

Re: LD_PRELOAD odities / Documentation?

2000-08-04 Thread Mikko Tyolajarvi
In local.freebsd-hackers you write: >Hi All, >I'm working on some code that runs fine on Linux, but not under FreeBSD... >Trying to port the code is proving to be a pain... >The code is a 'wrapper' / 'shim' that's meant to be LD_PRELOAD'ed before an >executable... I've gotten everything to comp

Re: LD_PRELOAD odities / Documentation?

2000-08-03 Thread Tony Finch
Karl Pielorz <[EMAIL PROTECTED]> wrote: > >One of the ways I've tried implementing syscalls is to dlopen() the correct >library, and fetch the routines address from there (using dlsym) - and calling >the routine that way... > >This doesn't seem to help though :( I've made this work across Solaris

Re: LD_PRELOAD odities / Documentation?

2000-08-03 Thread Bjoern Fischer
On Thu, Aug 03, 2000 at 11:25:27AM +0100, Karl Pielorz wrote: > The code is a 'wrapper' / 'shim' that's meant to be LD_PRELOAD'ed before an > executable... I've gotten everything to compile, and the LD_PRELOAD works, but > a lot of syscall's from the wrapper library fail either with bizare message

Re: LD_PRELOAD odities / Documentation?

2000-08-03 Thread Karl Pielorz
Daniel O'Connor wrote: > > On 03-Aug-00 Karl Pielorz wrote: > > Any pointers would be greatefuly received, unfortunately this all works > > under > > Linux (I'm not bashing anyone on the head with that, I'm far more interested > > in getting it working under FreeBSD)... > > I think the pro

RE: LD_PRELOAD odities / Documentation?

2000-08-03 Thread Daniel O'Connor
On 03-Aug-00 Karl Pielorz wrote: > Any pointers would be greatefuly received, unfortunately this all works > under > Linux (I'm not bashing anyone on the head with that, I'm far more interested > in getting it working under FreeBSD)... I think the problem is that your calls are being resolve

Re: LD_PRELOAD

2000-01-22 Thread Tony Finch
John Polstra <[EMAIL PROTECTED]> wrote: >Tony Finch <[EMAIL PROTECTED]> wrote: >>John Polstra <[EMAIL PROTECTED]> wrote: >>> >>> The names "_init" and "_fini" are "reserved for the implementation" >>> in ANSI/ISO-speak. You shouldn't use them. >> >> I don't have any choice on Solaris, unfortuna

Re: LD_PRELOAD

2000-01-22 Thread John Polstra
In article <[EMAIL PROTECTED]>, Tony Finch <[EMAIL PROTECTED]> wrote: > John Polstra <[EMAIL PROTECTED]> wrote: > >The right way to do it on FreeBSD is like this: > >gcc -fpic -c *.c > >gcc -shared -o libshim.so *.o > > That works fine, thanks! Any idea why my clumsy success worked and

Re: LD_PRELOAD

2000-01-21 Thread Tony Finch
John Polstra <[EMAIL PROTECTED]> wrote: >Tony Finch <[EMAIL PROTECTED]> wrote: >> >> I'm experimenting with using LD_PRELOAD to implement "shim" >> wrappers around functions in libc. The first problem I had was >> compiling my shim library so that the rtld would accept it. > >The right way to do

Re: LD_PRELOAD

2000-01-21 Thread John Polstra
In article <[EMAIL PROTECTED]>, Tony Finch <[EMAIL PROTECTED]> wrote: > I'm experimenting with using LD_PRELOAD to implement "shim" wrappers > around functions in libc. It's really easy to do on Solaris but I'm > having some difficulty on FreeBSD. > > The first problem I had was compiling my shi

Re: LD_PRELOAD

2000-01-21 Thread Tony Finch
Tony Finch <[EMAIL PROTECTED]> wrote: > > This brings me on to the second problem. I want to do some > initialization of my library before the real action starts. On Solaris > the linker calls a function in the object called _init() when it is > loaded; it's easy to make this work. I can see simi