On Mon, Aug 12, 2002 at 10:41:18AM +1000, John Ferlito wrote:
> I'm want to write a script to find out what system call a function is
> in.
> 
> I want to basically do something like 
> 
> strace -p  9999 | head -1
> 
This is what I've ended up doing it just feels very wrong though

$SIG{'ALRM'} = sub {
  system("/usr/bin/killall strace");
};

$pid = `ps auxw | grep '/usr/sbin/pptpd' | grep -v grep | awk '{print \$2}'`;
chomp($pid);

alarm(2);
open(STRACE, "/usr/bin/strace -p $pid 2>&1 | head -1 |");
$line = <STRACE>;
close(STRACE);
alarm(0);

print $line;

-- 
John
http://www.inodes.org/
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to