#include #include "subcmd-util.h" #include "sigchain.h" #define SIGCHAIN_MAX_SIGNALS 32 struct sigchain_signal { sigchain_fun *old; int n; int alloc; }; static struct sigchain_signal signals[SIGCHAIN_MAX_SIGNALS]; static void check_signum(int sig) { if (sig < 1 || sig >= SIGCHAIN_MAX_SIGNALS) die("BUG: signal out of range: %d", sig); } static int sigchain_push(int sig, sigchain_fun f) { struct sigchain_signal *s = signals + sig; check_signum(sig); ALLOC_GROW(s->old, s->n + 1, s->alloc); s->old[s->n] = signal(sig, f); if (s->old[s->n] == SIG_ERR) return -1; s->n++; return 0; } int sigchain_pop(int sig) { struct sigchain_signal *s = signals + sig; check_signum(sig); if (s->n < 1) return 0; if (signal(sig, s->old[s->n - 1]) == SIG_ERR) return -1; s->n--; return 0; } void sigchain_push_common(sigchain_fun f) { sigchain_push(SIGINT, f); sigchain_push(SIGHUP, f); sigchain_push(SIGTERM, f); sigchain_push(SIGQUIT, f); sigchain_push(SIGPIPE, f); } f7be0b726fec1a'/> net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
path: root/drivers/usb/misc/ldusb.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-02-02 13:20:23 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-02 13:20:23 -0800
commitc67b42f3a3f03e68bf915f32c8f7be0b726fec1a (patch)
tree9abf8c8a276cd5e8119e5c50f53afc220648008e /drivers/usb/misc/ldusb.c
parent027eb72cbcf81561867a764074964e2ce9828398 (diff)
parentc8f325a59cfc718d13a50fbc746ed9b415c25e92 (diff)
Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull EFI fixes from Ingo Molnar: "Two EFI boot fixes, one for arm64 and one for x86 systems with certain firmware versions" * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: efi/fdt: Avoid FDT manipulation after ExitBootServices() x86/efi: Always map the first physical page into the EFI pagetables
Diffstat (limited to 'drivers/usb/misc/ldusb.c')