[PATCH] D45636: Make InterruptHandler non-blocking for Fuchsia

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 19 07:04:59 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT330328: [Fuzzer] Make InterruptHandler non-blocking for Fuchsia (authored by phosek, committed by ).

Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D45636

Files:
  lib/fuzzer/FuzzerUtilFuchsia.cpp


Index: lib/fuzzer/FuzzerUtilFuchsia.cpp
===================================================================
--- lib/fuzzer/FuzzerUtilFuchsia.cpp
+++ lib/fuzzer/FuzzerUtilFuchsia.cpp
@@ -45,8 +45,13 @@
 }
 
 void InterruptHandler() {
+  fd_set readfds;
   // Ctrl-C sends ETX in Zircon.
-  while (getchar() != 0x03);
+  do {
+    FD_ZERO(&readfds);
+    FD_SET(STDIN_FILENO, &readfds);
+    select(STDIN_FILENO + 1, &readfds, nullptr, nullptr, nullptr);
+  } while(!FD_ISSET(STDIN_FILENO, &readfds) || getchar() != 0x03);
   Fuzzer::StaticInterruptCallback();
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45636.143088.patch
Type: text/x-patch
Size: 564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180419/0db69101/attachment.bin>


More information about the llvm-commits mailing list