You are not logged in

Currently, there is no way to gracefully reboot the system. The usual thing to do to kill all user tasks gracefully is to kill (-1, SIGTERM), pause a bit, then kill (-1, SIGKILL). This is done for example in sysvinit.

The problem is that currently kill -1 will happily kill essential system processes. init knows about those system services, but there is no way to retrieve the list.

POSIX says that kill 0 and kill -1 can exclude system processes (see below). It is suggested that we find a way to list the system processes that should be excluded by kill 0 and kill -1 and implement exclusion in glibc's kill() implementation.

22154 If pid is 0, sig shall be sent to all processes (excluding an unspecified set of system processes)
22155 whose process group ID is equal to the process group ID of the sender, and for which the
22156 process has permission to send a signal.
22157 If pid is -1, sig shall be sent to all processes (excluding an unspecified set of system processes) for
22158 which the process has permission to send that signal.
22159 If pid is negative, but not -1, sig shall be sent to all processes (excluding an unspecified set of
22160 system processes) whose process group ID is equal to the absolute value of pid, and for which
22161 the process has permission to send a signal.