void signal_handle(Event event) { int signum = event.data.signum; switch (signum) { case SIGINT: got_int = true; break; #ifdef SIGPWR case SIGPWR: // Signal of a power failure(eg batteries low), flush the swap files to // be safe ml_sync_all(false, false); break; #endif case SIGPIPE: // Ignore break; case SIGWINCH: shell_resized(); break; case SIGTERM: case SIGQUIT: case SIGHUP: if (!rejecting_deadly) { deadly_signal(signum); } break; default: fprintf(stderr, "Invalid signal %d", signum); break; } }
static void on_signal(SignalWatcher *handle, int signum, void *data) { assert(signum >= 0); switch (signum) { #ifdef SIGPWR case SIGPWR: // Signal of a power failure(eg batteries low), flush the swap files to // be safe ml_sync_all(false, false); break; #endif case SIGPIPE: // Ignore break; case SIGTERM: case SIGQUIT: case SIGHUP: if (!rejecting_deadly) { deadly_signal(signum); } break; default: fprintf(stderr, "Invalid signal %d", signum); break; } }