Usermode/libc - Fix strchr and strrchr behavior
[tpg/acess2.git] / Usermode / Applications / bomb_src / main.c
index d792322..b5cac3c 100644 (file)
@@ -43,11 +43,33 @@ int main(int argc, char *argv[])
 
        if( gbForkBomb )
        {
-               for(;;) clone(CLONE_VM, 0);
+               for(;;) _SysClone(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 = _SysClone(0, stack+stackSize-stackOffset);
+                       //_SysDebug("tid = %i", tid);
+                       if( tid == 0 )
+                       {
+                               // Sleep forever (TODO: Fix up the stack so it can nuke)
+                               for(;;) _SysWaitEvent(THREAD_EVENT_SIGNAL);
+                       }
+                       if( tid < 0 ) {
+                               printf("Clone failed\n");
+                               return 0;
+                       }
+               }
        }
 
+       printf("RETURN!?\n");
        return 0;
 }

UCC git Repository :: git.ucc.asn.au