use LD_PRELOAD with Java VM
ronghuazhang_at_gmail.com
Date: 03/30/05
- Next message: Minti: "Question on SIGSTOP"
- Previous message: Måns Rullgård: "Re: Hash tables"
- Next in thread: Paul Pluzhnikov: "Re: use LD_PRELOAD with Java VM"
- Reply: Paul Pluzhnikov: "Re: use LD_PRELOAD with Java VM"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Mar 2005 21:06:37 -0800
I need to monitor (and potentially change) some system calls made by a
java program. I tried to use LD_PRELOAD to substitute my own version
for the libc system call wrappers. I wrote a braindead mylib.so which
simply prints out the system call name when a system call is made and a
LOAD message when it's loaded. The process id is also printed along
with the messages. A couple of strange things happened when I tested
it.
When I executed LD_PRELOAD=mylib.so java helloWorld, to my surprise,
the LOAD message was printed *twice* with the same process id. How come
the library was loaded twice? But the write system call was correctly
caught.
I then run LD_PRELOAD=mylib.so java echo. The echo program is a
classical echo server. I was expecting the LISTEN and ACCEPT system
call would be intercepted. But neither one of them was caught. The
command "strace java echo" showed that it indeed called listen and
accept.
Anybody can shed some light on these peculiarities? Please cc to me so
that I won't miss your post. Thanks!
Ronghua
- Next message: Minti: "Question on SIGSTOP"
- Previous message: Måns Rullgård: "Re: Hash tables"
- Next in thread: Paul Pluzhnikov: "Re: use LD_PRELOAD with Java VM"
- Reply: Paul Pluzhnikov: "Re: use LD_PRELOAD with Java VM"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|