diff options
author | Ben Pfaff <blp@nicira.com> | 2010-01-15 15:28:14 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2010-01-15 15:28:14 -0800 |
commit | e3830e909d210145cbe52a1da66058ebf2581fd6 (patch) | |
tree | c82e02c5f101f38df1c6f12b46cc5345c9db433d /extras/ezio/tty.c | |
parent | 4d12270a618bead742d4cabc50601e86fde83f64 (diff) |
fatal-signal: After fork, clear hooks instead of disabling them.
Until now, fatal_signal_fork() has simply disabled all the fatal signal
callback hooks. This worked fine, because a daemon process forked only
once and the parent didn't do much before it exited.
But upcoming commits will introduce a --monitor option, which requires
processes to fork multiple times. Sometimes the parent process will fork,
then run for a while, then fork again. It's not good to disable the
hooks in the child process in such a case, because that prevents e.g.
pidfiles from being removed at the child's exit.
So this commit changes the semantics of fatal_signal_fork() to just
clearing out hooks. After hooks are cleared, new hooks can be added and
will be executed on process termination in the usual way.
This commit also introduces a cancellation callback function so that a
canceled hook can free resources.
Diffstat (limited to 'extras/ezio/tty.c')
-rw-r--r-- | extras/ezio/tty.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/extras/ezio/tty.c b/extras/ezio/tty.c index 709b8028..9b05480a 100644 --- a/extras/ezio/tty.c +++ b/extras/ezio/tty.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2009 Nicira Networks, Inc. +/* Copyright (c) 2008, 2009, 2010 Nicira Networks, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -263,7 +263,7 @@ tty_set_raw_mode(int fd, speed_t speed) return errno; } s->tios = tios; - fatal_signal_add_hook(restore_termios, s, true); + fatal_signal_add_hook(restore_termios, NULL, s, true); tios.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); |