mit-pdos / xv6-riscv

Xv6 for RISC-V
Other
6.58k stars 2.38k forks source link

Update forktest.c #194

Closed rowingdude closed 2 months ago

rowingdude commented 11 months ago
  1. 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.

  2. 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.

  3. 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.