Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPICA: Unix application OSL: Correctly handle control-c (EINTR)

ACPICA commit dfbb87c3a96cfd007375f34a96e6f4a8ee477f97

Handle EINTR from a sem_wait operation. Ignore a control-c.

Link: https://github.com/acpica/acpica/commit/dfbb87c3
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Bob Moore and committed by
Rafael J. Wysocki
fdf8707b b9ef2ab0

+7 -3
+7 -3
tools/power/acpi/os_specific/service_layers/osunixxf.c
··· 750 750 { 751 751 acpi_status status = AE_OK; 752 752 sem_t *sem = (sem_t *) handle; 753 + int ret_val; 753 754 #ifndef ACPI_USE_ALTERNATE_TIMEOUT 754 755 struct timespec time; 755 - int ret_val; 756 756 #endif 757 757 758 758 if (!sem) { ··· 778 778 779 779 case ACPI_WAIT_FOREVER: 780 780 781 - if (sem_wait(sem)) { 781 + while (((ret_val = sem_wait(sem)) == -1) && (errno == EINTR)) { 782 + continue; /* Restart if interrupted */ 783 + } 784 + if (ret_val != 0) { 782 785 status = (AE_TIME); 783 786 } 784 787 break; ··· 834 831 835 832 while (((ret_val = sem_timedwait(sem, &time)) == -1) 836 833 && (errno == EINTR)) { 837 - continue; 834 + continue; /* Restart if interrupted */ 835 + 838 836 } 839 837 840 838 if (ret_val != 0) {