laziness, impatience, and hubris | |
PerlMonks |
Logging system file calls from any Unix programby aufflick (Deacon) |
on Jul 29, 2007 at 08:18 UTC ( [id://629380]=note: print w/replies, xml ) | Need Help?? |
As almut suggested, there are a number of tools (varying by flavour of Un*x) which let you watch the system calls made by a running program, regardless of what language it may be. For Linux, the program is strace, and you do something like this:
See the open in the first line? That's a call to the system function open. You can find out what all the arguments mean by running man 2 open in your shell. The 3 at the end of that line is the return of that function - it is the file handle for that opened file. You can then follow the write and close functions that relate to that file. You can use strace to watch what a running program is doing with the -p option, but be careful of doing this on a production box as some older versions of the linux kernel have a bug that could cause your program to halt when you exit strace. The equivalent of strace on Solaris is truss. On MacOS X you need a combination of ktrace and kdump (read both man pages).
In Section
Seekers of Perl Wisdom
|
|