Skip to content

Commit 5fe29a8

Browse files
[compiler-rt][profile] Use flock shim on Windows even if detection fails (llvm#112695)
1 parent 5dbf8f3 commit 5fe29a8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler-rt/lib/profile/InstrProfilingUtil.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ COMPILER_RT_VISIBILITY int lprofLockFd(int fd) {
155155
}
156156
}
157157
return 0;
158-
#elif defined(COMPILER_RT_HAS_FLOCK)
158+
#elif defined(COMPILER_RT_HAS_FLOCK) || defined(_WIN32)
159+
// Windows doesn't have flock but WindowsMMap.h provides a shim
159160
flock(fd, LOCK_EX);
160161
return 0;
161162
#else
@@ -182,7 +183,8 @@ COMPILER_RT_VISIBILITY int lprofUnlockFd(int fd) {
182183
}
183184
}
184185
return 0;
185-
#elif defined(COMPILER_RT_HAS_FLOCK)
186+
#elif defined(COMPILER_RT_HAS_FLOCK) || defined(_WIN32)
187+
// Windows doesn't have flock but WindowsMMap.h provides a shim
186188
flock(fd, LOCK_UN);
187189
return 0;
188190
#else

0 commit comments

Comments
 (0)