#include<stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
static int Check_pid_alive( pid_t pid )
{
struct stat buf;
char path[32];
/* Check the existance of the pid command line file */
sprintf( path, "/proc/%d", pid );
if( stat(path, &buf) )
return 0;
return 1;
}
int main(int argc, char **argv)
{
printf("%d\n",Check_pid_alive(atoi(argv[1])));
}
2016年7月26日 星期二
訂閱:
張貼留言 (Atom)
0 意見:
張貼留言