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

Aaron Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 16 17:11:21 PDT 2018


aarongreen updated this revision to Diff 142723.
aarongreen added a comment.

Yeah, I mistakenly thought select might grab the iolock on stdio in musl.  Using a null timeout works fine and simplifies things.


https://reviews.llvm.org/D45636

Files:
  lib/fuzzer/FuzzerUtilFuchsia.cpp


Index: lib/fuzzer/FuzzerUtilFuchsia.cpp
===================================================================
--- lib/fuzzer/FuzzerUtilFuchsia.cpp
+++ lib/fuzzer/FuzzerUtilFuchsia.cpp
@@ -45,15 +45,12 @@
 }
 
 void InterruptHandler() {
-  struct timeval timeout;
-  timeout.tv_sec= 1;
-  timeout.tv_usec= 0;
   fd_set readfds;
   // Ctrl-C sends ETX in Zircon.
   do {
     FD_ZERO(&readfds);
     FD_SET(STDIN_FILENO, &readfds);
-    select(STDIN_FILENO + 1, &readfds, nullptr, nullptr, &timeout);
+    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.142723.patch
Type: text/x-patch
Size: 674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180417/9fe55988/attachment.bin>


More information about the llvm-commits mailing list