summaryrefslogtreecommitdiff
path: root/lib/profile/GCDAProfiling.c
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-12-14 19:01:04 +0000
committerVedant Kumar <vsk@apple.com>2017-12-14 19:01:04 +0000
commitccb69d9a1231219ec7e7962743b3ab1ee3122b65 (patch)
tree0643c7b2d3de82ac7423cefe53921e7d622f1fdc /lib/profile/GCDAProfiling.c
parent12e90365ed9cce1179df68586af3ec9d83bb0316 (diff)
[profile] Port the runtime to Solaris (retry)
This includes a few nice bits of refactoring (e.g splitting out the exclusive locking code into a common utility). Hopefully the Windows support is fixed now. Patch by Rainer Orth! Differential Revision: https://reviews.llvm.org/D40944 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320731 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/GCDAProfiling.c')
-rw-r--r--lib/profile/GCDAProfiling.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/profile/GCDAProfiling.c b/lib/profile/GCDAProfiling.c
index 8c92546bd..ef299f002 100644
--- a/lib/profile/GCDAProfiling.c
+++ b/lib/profile/GCDAProfiling.c
@@ -20,9 +20,6 @@
|*
\*===----------------------------------------------------------------------===*/
-#include "InstrProfilingPort.h"
-#include "InstrProfilingUtil.h"
-
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
@@ -34,12 +31,6 @@
#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__)
@@ -65,6 +56,9 @@ typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
#endif
+#include "InstrProfiling.h"
+#include "InstrProfilingUtil.h"
+
/* #define DEBUG_GCDAPROFILING */
/*
@@ -266,7 +260,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.
*/
- flock(fd, LOCK_EX);
+ lprofLockFd(fd);
output_file = fdopen(fd, mode);
/* Initialize the write buffer. */
@@ -465,7 +459,7 @@ void llvm_gcda_end_file() {
unmap_file();
}
- flock(fd, LOCK_UN);
+ lprofUnlockFd(fd);
fclose(output_file);
output_file = NULL;
write_buffer = NULL;