User-space interrupts
User-space interrupts
Posted Oct 12, 2021 22:54 UTC (Tue) by mpr22 (subscriber, #60784)In reply to: User-space interrupts by anton
Parent article: User-space interrupts
Imagine further that you send that daemon SIGHUP, telling it to reload its configuration files.
Do you really want it to wait until it receives its next packet before reloading its configuration files? After all, your config change might mean it needs to close one or more of the sockets it's currently waiting on and/or open new sockets.
I don't.
I'd much rather that its signal handler for SIGHUP just sets a flag saying "config must be reloaded", and that the system call wrapper then returns -1 and sets errno to EINTR, so that my daemon can check its config-reload flag and go "oh hey I've been reconfigured".
Posted Oct 13, 2021 5:51 UTC (Wed)
by anton (subscriber, #25547)
[Link]
In this scenario the signal will be handled right after the system call (not the wrapper) returns, i.e., immediately. The default for SIGHUP is to terminate the process, so the parent process can reread the configuration file and restart the process (just one example on how to deal with that).
User-space interrupts