8ecc
![]() |
|
|
|
|
|||||||
| Userland Programming & Scripting C, Shell, Perl, Sed & Awk |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I have this code
Code:
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;}
Code:
int main(){
sleep(10);
return 0;}
Last edited by DutchDaemon; May 1st, 2012 at 17:56. |
|
#2
|
|||
|
|||
|
If I understand your question, then the answer is because execl(3) never returns (unless in error, see the man page). The code between the execl(3) and the next case statement is not run, assuming the called program can be executed. Therefore, your call to signal(3) never happens, and, thus, your callback is never registered.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Solved] c++ limit process | xnl96 | Userland Programming & Scripting | 2 | December 22nd, 2011 21:20 |
| Anyone? Gnome terminal: error creating the child process | mdg583 | GNOME | 2 | September 6th, 2009 12:40 |
| max one 'fat' allowed as child of 'whole' | ororo | Installing & Upgrading | 13 | June 3rd, 2009 19:12 |
| bce0 : /usr/src/sys/dev/bce/if_bce.c(1044): No PHY found on Child MII bus | celica013 | Networking | 8 | June 1st, 2009 17:01 |
| [Solved] perl: how to start child process in background? | graudeejs | Userland Programming & Scripting | 4 | March 26th, 2009 11:33 |