我有这个代码
static void sigXCPU(int pTmp){
cout<<" .... ";
}
.....
pid_t vPid=fork();
int vStat;
switch(vPid){
case -1: perror("fork");
exit(1);
case 0:
//limit on data
struct rlimit vLimD;
vLimD.rlim_cur = 100000;
vLimD.rlim_max = 1000000;
setrlimit(RLIMIT_DATA, &vLimD);
//limit on cpu time
struct rlimit vLimCPU;
vLimCPU.rlim_cur = 1;
vLimCPU.rlim_max = 1;
execl("./p1","",NULL);
if(signal(SIGXCPU,sigXCPU)==SIG_ERR);
break;
default:
while(wait(&vStat)!=vPid);
break;}
p1 的代码是
int main(){
sleep(10);
return 0;}
为什么孩子忽略SIGXCPU?代码是在FreeBsd 8.0 amd64下用gcc编译的。