Seldom the test instrprof-gcov-fork.test is failing, so:
- add an O_EXCL when trying to create the file to avoid a race condition;
- add an error message when the locking is failing.
The failure is:
/b/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/test/profile/Posix/../Inputs/instrprof-gcov-fork.c.gcov:10:15: error: CHECK-NEXT: expected string not found in input
// CHECK-NEXT:function func2 called 2 returned 100% blocks executed 100%
^
instrprof-gcov-fork.c.gcov:10:1: note: scanning from here
function func2 called 1 returned 100% blocks executed 100%
^
In this test we call func2 after having forked so it should be called two times (in the parent process and in the cihld process)
Why do we need errnum? Couldn't we always use errno?