Added new signal handler for SIGUSR2. When init receives SIGUSR2

it closes (and leaves closed) the named pipe /run/initctl. This
can be used to make sure init does not have any files open. However,
it also means we cannot switch run levels or bring down the system.
The pipe can be re-opened by sending init the SIGUSR1 signal.

Updated the man pages for initctl and init to include this information.
This commit is contained in:
Jesse Smith
2018-04-17 19:44:50 -03:00
parent f09da9cb55
commit 272f112c98
4 changed files with 43 additions and 4 deletions

View File

@@ -128,6 +128,18 @@ The commands passed through the /run/initctl pipe must be sent in a specific
binary format and be of a specific length. Larger data structures or ones
not using the proper format will be ignored. Typically, only root has the
ability to write to the initctl pipe for security reasons.
.PP
The /run/initctl pipe can be closed by sending init (PID 1) the SIGUSR2
signal. This closes the pipe and leaves it closed. This may be useful
for making sure init is not keeping any files open. However, when the
pipe is closed, init no longer receives signals, such as those sent by
shutdown or telinit. In other words if we close the pipe, init cannot
change its runlevel directly. The pipe may be re-opened by sending init (PID 1)
the SIGUSR1 signal.
.PP
If the /run/initctl pipe is closed then it may still be possible to bring
down the system using the shutdown command's -n flag, but this is not
always clean and not recommended.
.RE
.SH FILES
/run/initctl