Re: intercepting system calls works on tiger(10.4.5) but not on panther(10.3.9)
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On Wed, 2006-05-17 at 22:50 -0600, Puthali H.B wrote:
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.
Not really, on panther dlsym(RTLD_NEXT,"connect") is always going to give you the first connect function it finds when force flat namespace is in effect. So you get into an infinite loop, exhaust stack and crash. This is fixed in tiger.
where as, if I use syscall, then it throws up the following-
Again, works for me: peter$ cat connect.c #include <stdio.h> #include <sys/syscall.h> int connect(int s, const struct sockaddr *name, int namelen) { fprintf(stderr,"Connect Called\n"); return syscall(SYS_connect,s,name,namelen); } 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 Connected to ftp.pogma.com. I think you probably want to avoid dlsym RTLD_NEXT et.al. on panther and just use the syscalls. Peter _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com signature.asc
participants (1)
-
Peter O'Gorman