From f6d0ce49a30c2b40d69369cd799f76f95c052b0e Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Thu, 14 Dec 2017 18:43:14 +0000 Subject: [profile] Port the runtime to Solaris This includes a few nice bits of refactoring (e.g splitting out the exclusive locking code into a common utility). Patch by Rainer Orth! Differential Revision: https://reviews.llvm.org/D40944 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320726 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/profile/GCDAProfiling.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'lib/profile/GCDAProfiling.c') 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 #include #include @@ -34,12 +31,6 @@ #else #include #include -#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; -- cgit v1.2.3