summaryrefslogtreecommitdiff
path: root/lib/profile/GCDAProfiling.c
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-12-14 18:50:13 +0000
committerVedant Kumar <vsk@apple.com>2017-12-14 18:50:13 +0000
commit12e90365ed9cce1179df68586af3ec9d83bb0316 (patch)
tree0d0b59670b0515cd5f4bbe80c7753f6ef1f85305 /lib/profile/GCDAProfiling.c
parentf6d0ce49a30c2b40d69369cd799f76f95c052b0e (diff)
Revert "(HEAD -> master, origin/master, origin/HEAD) [profile] Port the runtime to Solaris"
This reverts commit r320726. It looks like flock isn't available on Windows: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/21317/steps/build%20compiler-rt/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320728 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/GCDAProfiling.c')
-rw-r--r--lib/profile/GCDAProfiling.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/profile/GCDAProfiling.c b/lib/profile/GCDAProfiling.c
index ef299f002..8c92546bd 100644
--- a/lib/profile/GCDAProfiling.c
+++ b/lib/profile/GCDAProfiling.c
@@ -20,6 +20,9 @@
|*
\*===----------------------------------------------------------------------===*/
+#include "InstrProfilingPort.h"
+#include "InstrProfilingUtil.h"
+
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
@@ -31,6 +34,12 @@
#else
#include <sys/mman.h>
#include <sys/file.h>
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
#endif
#if defined(__FreeBSD__) && defined(__i386__)
@@ -56,9 +65,6 @@ typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
#endif
-#include "InstrProfiling.h"
-#include "InstrProfilingUtil.h"
-
/* #define DEBUG_GCDAPROFILING */
/*
@@ -260,7 +266,7 @@ void llvm_gcda_start_file(const char *orig_filename, const char version[4],
* same GCDA. This can fail if the filesystem doesn't support it, but in that
* case we'll just carry on with the old racy behaviour and hope for the best.
*/
- lprofLockFd(fd);
+ flock(fd, LOCK_EX);
output_file = fdopen(fd, mode);
/* Initialize the write buffer. */
@@ -459,7 +465,7 @@ void llvm_gcda_end_file() {
unmap_file();
}
- lprofUnlockFd(fd);
+ flock(fd, LOCK_UN);
fclose(output_file);
output_file = NULL;
write_buffer = NULL;