• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: intercepting system calls works on tiger(10.4.5) but not on panther(10.3.9)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: intercepting system calls works on tiger(10.4.5) but not on panther(10.3.9)


  • Subject: Re: intercepting system calls works on tiger(10.4.5) but not on panther(10.3.9)
  • From: "Puthali H.B" <email@hidden>
  • Date: Wed, 17 May 2006 22:50:51 -0600

I essentially do the same thing. Only different thing is, I call the
system connect call from my connect.

I'm attaching the source file, which I compile it as
gcc -dynamiclib -o test_connect.dylib -fPIC test_connect.c

Then in the terminal, I do -
export DYLD_INSERT_LIBRARIES=test_connect.dylib
export DYLD_FORCE_FLAT_NAMESPACE=YES

and then I run -  ftp ftp.gnu.org

On tiger, the control first comes into my over-ridden connect, and then
the system connect call gets called without any hitch, and FTP goes
through.

But on panther, I face two kinds of problems, depending on whether I
use dlopen or syscall to call the underlying system connect.

If I use dlopen, followed by dlsym, then it loops in the over-ridden
connect, which is very weird.

where as, if I use syscall, then it throws up the following-

dyld: FTP multiple definitions of symbol _connect
test_connect.dylib(ccyRQhrn.o) definition of _connect
/usr/lib/libSystem.B.dylib(connect.So) definition of _connect
Trace/BPT trap

Any idea on how I can over-come this?

- Puthali

>>> Peter O'Gorman <email@hidden> 5/17/2006 7:48:00 pm >>>
On Tue, 2006-05-16 at 23:01 -0600, Puthali H.B wrote:

> Actually I've a dynamic library which over-rides system calls,
namely
> connect,recv,send,sendto,accept...
> and when I preload this on Tiger, using DYLD_INSERT_LIBRARIES AND
> DYLD_FORCE_FLAT_NAMESPACE, everything works fine.
>
> When I pre-loaded this library in terminal and ran FTP got the
> following error-
>
> dyld: FTP multiple definitions of symbol _connect
> test_connect.dylib(ccyRQhrn.o) definition of _connect
> /usr/lib/libSystem.B.dylib(connect.So) definition of _connect
> Trace/BPT trap

Works for me on panther (10.3.9):

peter$ cc -dynamiclib -o test_connect.dylib connect.c
peter$ env DYLD_INSERT_LIBRARIES=./test_connect.dylib
DYLD_FORCE_FLAT_NAMESPACE=1 ftp ftp.pogma.com
Connect Called
ftp: connect: Unknown error: 0
ftp> quit
peter$ cat connect.c
#include <stdio.h>
int connect() {

fprintf(stderr,"Connect Called\n");
return 1;
}

I assume that you're doing something different?

Peter

Attachment: test_connect.c
Description: Binary data

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: intercepting system calls works on tiger(10.4.5) but not on panther(10.3.9)
      • From: "Peter O'Gorman" <email@hidden>
References: 
 >hi, (From: "Puthali H.B" <email@hidden>)
 >intercepting system calls works on tiger(10.4.5) but not on panther(10.3.9) (From: "Puthali H.B" <email@hidden>)
 >Re: intercepting system calls works on tiger(10.4.5) but not on panther(10.3.9) (From: "Peter O'Gorman" <email@hidden>)

  • Prev by Date: Re: MacCentral Post
  • Next by Date: Re: intercepting system calls works on tiger(10.4.5) but not on panther(10.3.9)
  • Previous by thread: Re: intercepting system calls works on tiger(10.4.5) but not on panther(10.3.9)
  • Next by thread: Re: intercepting system calls works on tiger(10.4.5) but not on panther(10.3.9)
  • Index(es):
    • Date
    • Thread