[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 18/42] checkpatch: should not use signal except for S
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 18/42] checkpatch: should not use signal except for SIG_DFL or SIG_IGN |
Date: |
Wed, 5 Jul 2017 09:14:21 +0200 |
Using signal to establish a signal handler is not portable; on
SysV systems, the signal handler would be reset to SIG_DFL after
delivery, while BSD preserves the signal handler. Daniel Berrange
reported that (to complicate matters further) the signal system call
has SysV behavior, but glibc signal() actually calls the sigaction
system call to provide BSD behavior.
However, using signal() to set a signal's disposition to SIG_DFL
or SIG_IGN is portable and is a relatively common occurrence in
QEMU source code, so allow that.
Reviewed-by: Daniel P. Berrange <address@hidden>
Reviewed-by: Richard W.M. Jones <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
scripts/checkpatch.pl | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 45027b9..73efc92 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2473,6 +2473,10 @@ sub process {
if ($line =~ /\b(strto[^kd].*?)\s*\(/) {
ERROR("consider using qemu_$1 in preference to $1\n" .
$herecurr);
}
+# recommend sigaction over signal for portability, when establishing a handler
+ if ($line =~ /\bsignal\s*\(/ && !($line =~ /SIG_(?:IGN|DFL)/)) {
+ ERROR("use sigaction to establish signal handlers;
signal is not portable\n" . $herecurr);
+ }
# check for module_init(), use category-specific init macros explicitly please
if ($line =~ /^module_init\s*\(/) {
ERROR("please use block_init(), type_init() etc.
instead of module_init()\n" . $herecurr);
--
1.8.3.1
- [Qemu-devel] [PULL 01/42] vcpu_dirty: share the same field in CPUState for all accelerators, (continued)
- [Qemu-devel] [PULL 01/42] vcpu_dirty: share the same field in CPUState for all accelerators, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 08/42] include/exec/poison: Mark CONFIG_KVM as poisoned, too, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 07/42] Move CONFIG_KVM related definitions to kvm_i386.h, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 09/42] cpu: Introduce a wrapper for tlb_flush() that can be used in common code, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 15/42] util/oslib-win32: Remove if conditional, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 13/42] sockets: avoid formatting buffer that may not be NUL terminated, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 11/42] Makefile: Move bootdevice.o to common-obj-y, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 12/42] hw/misc/edu: Compile the edu device as common object, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 17/42] main_loop: Make main_loop_wait() return void, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 10/42] include/exec/poison: Mark CONFIG_SOFTMMU as poisoned, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 18/42] checkpatch: should not use signal except for SIG_DFL or SIG_IGN,
Paolo Bonzini <=
- [Qemu-devel] [PULL 14/42] xsave_helper: pull xsave and xrstor out of kvm.c into helper function, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 16/42] tests/test-char.c: Don't use main_loop_wait()'s return value, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 19/42] virtio-scsi: finalize IOMMU support, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 22/42] configure: factor out list of supported Xen/KVM/HAX targets, Paolo Bonzini, 2017/07/05
- Re: [Qemu-devel] [PULL 22/42] configure: factor out list of supported Xen/KVM/HAX targets, Peter Maydell, 2017/07/10
- Re: [Qemu-devel] [PULL 22/42] configure: factor out list of supported Xen/KVM/HAX targets, Paolo Bonzini, 2017/07/10
- Re: [Qemu-devel] [PULL 22/42] configure: factor out list of supported Xen/KVM/HAX targets, Peter Maydell, 2017/07/10
- Re: [Qemu-devel] [PULL 22/42] configure: factor out list of supported Xen/KVM/HAX targets, Paolo Bonzini, 2017/07/10
- Re: [Qemu-devel] [PULL 22/42] configure: factor out list of supported Xen/KVM/HAX targets, Philippe Mathieu-Daudé, 2017/07/14
- Re: [Qemu-devel] [PULL 22/42] configure: factor out list of supported Xen/KVM/HAX targets, Paolo Bonzini, 2017/07/14