#include <sys/prctl.h>
int main(char argc[],int argv)
{
unsigned int i = 0;
unsigned int pid1,pid2;
if(0 == fork()){
prctl(PR_SET_NAME,"Child",NULL,NULL,NULL);
for(;;){
for(i=0;i<100000;i++);
pid1= getpid;
printf("This is the child process,process id is %d",pid1);
}
}else{
prctl(PR_SET_NAME,"Child",NULL,NULL,NULL);
for(;;){
for(i=0;i<100000;i++);
pid1= getpid;
printf("This is the child process,process id is %d",pid1);
}
}
return 0;
}
修改通过fork生成的进程名
最新推荐文章于 2022-07-25 17:29:44 发布