We should initialize 'flags' in reboot_system.
The only information we need to get from proc_getprocinfo is the state of the process. 'flags = 0' is very enough to do the job and it can make proc_getprocinfo less likely to fail.
The Mach in my system somehow doesn't support the TASK_EVENTS_INFO type of information. Without the initialization of 'flags', it is possible that proc_getprocinfo returns error, which results in the failure to shut down the subhurd.