[libFuzzer][Windows] Port fork mode to Windows

Summary:
Port libFuzzer's fork mode to Windows.
Implement Windows versions of MkDir, RmDir, and IterateDirRecursive to do this.
Don't print error messages under new normal uses of FileSize (on a non-existent file).
Implement portable way of piping output to /dev/null.
Fix test for Windows and comment fork-sigusr.test on why it won't be ported to Win.

Reviewers: zturner

Reviewed By: zturner

Subscribers: kcc, zturner, jdoerfert, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D58513

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/fuzzer@355019 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/FuzzerFork.cpp b/FuzzerFork.cpp
index 1f7fe9b..52a233f 100644
--- a/FuzzerFork.cpp
+++ b/FuzzerFork.cpp
@@ -304,13 +304,13 @@
   }
   Stop = true;
 
-  // The workers have already finished doing useful work, or
-  // we were interrupted. Either way, cleanup up now.
-  RmDirRecursive(Env.TempDir);
-
   for (auto &T : Threads)
     T.join();
 
+  // The workers have terminated. Don't try to remove the directory before they
+  // terminate to avoid a race condition preventing cleanup on Windows.
+  RmDirRecursive(Env.TempDir);
+
   // Use the exit code from the last child process.
   Printf("INFO: exiting: %d time: %zds\n", ExitCode,
          Env.secondsSinceProcessStartUp());
@@ -318,4 +318,3 @@
 }
 
 } // namespace fuzzer
-