return 1;
}
- switch( argv[i][0] )
+ switch( argv[i][1] )
{
case 'f':
gbForkBomb = 1;
for(;;) clone(CLONE_VM, 0);
}
else {
- for(;;) clone(0, malloc(512-16)+512-16);
+ for(;;)
+ {
+ const int stackSize = 512-16;
+ const int stackOffset = 65;
+ char *stack = calloc(1, stackSize);
+ int tid;
+ if( !stack ) {
+ printf("Outta heap space!\n");
+ return 0;
+ }
+ tid = clone(0, stack+stackSize-stackOffset);
+ //_SysDebug("tid = %i", tid);
+ if( tid == 0 )
+ {
+ // Sleep forever (TODO: Fix up the stack so it can nuke)
+ for(;;) sleep();
+ }
+ if( tid < 0 ) {
+ printf("Clone failed\n");
+ return 0;
+ }
+ }
}
+ printf("RETURN!?\n");
return 0;
}