A check is added to make sure that the system has enough memory to fork N times. If the system does not have enough memory, the fork() system call will fail and the test will not be able to fork N times.
A check is added to make sure that the child process has not already exited before calling wait(). If the child process has already exited, the wait() system call will return an error and the test will fail.
A handler is added for the SIGINT signal. The SIGINT signal is sent to a process when the user presses Ctrl-C. The handler for the SIGINT signal ignores the signal, so the forktest() function will not continue to fork child processes if the user presses Ctrl-C.
A check is added to make sure that the system has enough memory to fork N times. If the system does not have enough memory, the fork() system call will fail and the test will not be able to fork N times.
A check is added to make sure that the child process has not already exited before calling wait(). If the child process has already exited, the wait() system call will return an error and the test will fail.
A handler is added for the SIGINT signal. The SIGINT signal is sent to a process when the user presses Ctrl-C. The handler for the SIGINT signal ignores the signal, so the forktest() function will not continue to fork child processes if the user presses Ctrl-C.