日期:2014-05-16 浏览次数:20658 次
#include <stdlib.h> #include <stdio.h> #include <unistd.h> int num = 100; pid_t pid; char cmd_buf[256]; void foo_func() { char foo_buf[1024]; if( num > 0 ) { --num; system( cmd_buf ); foo_func(); } } int main( int argc, char** argv ) { pid = getpid(); sprintf( cmd_buf, "cat /proc/%d/maps | grep stack", pid ); system( cmd_buf ); foo_func(); system( cmd_buf ); return 0; }