Code:
function exit()
{
while(1)
{
sys_exit(null);
wait(1);
}
}



This comment is not related to your problem, however, this piece of code is totally senseless, as the content of your loop will be executed only once. The loop is superfluous.


Always learn from history, to be sure you make the same mistakes again...