[PATCH] D22742: [WIP] Fix `-jobs=<N>` where <N> > 1 on macOS.

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 24 21:43:36 PDT 2016


delcypher created this revision.
delcypher added reviewers: kcc, aizatsky.
delcypher added subscribers: llvm-commits, zaks.anna, dcoughlin, kubabrecka.

[WIP] Fix `-jobs=<N>` where <N> > 1 on macOS.

The original `ExecuteCommand()` called `system()` from the C library.
The C library implementation of this on macOS contains a mutex which
serializes calls to `system()`. This prevented the `-jobs=` flag
from running copies of the fuzzing binary in parallel which is
the opposite of what is intended.

To fix this on macOS an alternative implementation
(`NonLockingSystem()`) is used that doesn't lock. However to avoid being
racey the implementation doesn't block SIGINT and SIGQUIT like
`system()`. Instead code blocking this signal has been added just before
the threads are created and then normal handling of SIGINT is resumed
after the threads have finished. This allows pressing CTRL+C in the
terminal to do the right thing on macOS.

I am not happy with this implementation as it seems like a gross
layering violation but it's a starting point.


https://reviews.llvm.org/D22742

Files:
  lib/Fuzzer/FuzzerDriver.cpp
  lib/Fuzzer/FuzzerUtil.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22742.65294.patch
Type: text/x-patch
Size: 4460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160725/d66764a9/attachment.bin>


More information about the llvm-commits mailing list