2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

Make fatal signals cause an exit more promptly in special cases.

The fatal-signal library notices and records fatal signals (e.g. SIGTERM)
and terminates the process on the next trip through poll_block().  But
some special utilities do not always invoke poll_block() promptly, e.g.
"ovs-ofctl monitor" does not call poll_block() as long as OpenFlow messages
are available.  But these special cases seem like they are all likely to
call into functions that themselves block (those with "_block" in their
names).  So make a new rule that such functions should always call
fatal_signal_run(), either directly or through poll_block().  This commit
implements and documents that rule.

Bug #2625.
This commit is contained in:
Ben Pfaff
2010-04-13 09:28:13 -07:00
parent 9888b1b43b
commit b302749b70
5 changed files with 30 additions and 0 deletions

View File

@@ -134,6 +134,17 @@ fatal_signal_handler(int sig_nr)
stored_sig_nr = sig_nr;
}
/* Check whether a fatal signal has occurred and, if so, call the fatal signal
* hooks and exit.
*
* This function is called automatically by poll_block(), but specialized
* programs that may not always call poll_block() on a regular basis should
* also call it periodically. (Therefore, any function with "block" in its
* name should call fatal_signal_run() each time it is called, either directly
* or through poll_block(), because such functions can only used by specialized
* programs that can afford to block outside their main loop around
* poll_block().)
*/
void
fatal_signal_run(void)
{