#include <apue.h>
int main( int argc, char *argv[] )
{
int n;
printf("pid:%d\n",getpid());
//if(fork())
printf("n=fork:%d\n",n=fork());
printf("pid:%d,fork:%d\n",getpid(),n);
return 0;
}
/*
[root@localhost linux_c]# ./getpid
pid:14465
n=fork:0
pid:14466,fork:0
n=fork:14466
pid:14465,fork:14466
*/
n=fork()); printf("pid:%d,fork:%d\n",getpid(),n);
最新推荐文章于 2021-05-04 12:12:23 发布