Skip to content

Commit 7a90ff7

Browse files
[compiler-rt][profile] Use flock shim on Windows even if detection fails (#112695)
1 parent 6c4267f commit 7a90ff7

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
@@ -152,7 +152,8 @@ COMPILER_RT_VISIBILITY int lprofLockFd(int fd) {
152152
}
153153
}
154154
return 0;
155-
#elif defined(COMPILER_RT_HAS_FLOCK)
155+
#elif defined(COMPILER_RT_HAS_FLOCK) || defined(_WIN32)
156+
// Windows doesn't have flock but WindowsMMap.h provides a shim
156157
flock(fd, LOCK_EX);
157158
return 0;
158159
#else
@@ -179,7 +180,8 @@ COMPILER_RT_VISIBILITY int lprofUnlockFd(int fd) {
179180
}
180181
}
181182
return 0;
182-
#elif defined(COMPILER_RT_HAS_FLOCK)
183+
#elif defined(COMPILER_RT_HAS_FLOCK) || defined(_WIN32)
184+
// Windows doesn't have flock but WindowsMMap.h provides a shim
183185
flock(fd, LOCK_UN);
184186
return 0;
185187
#else

0 commit comments

Comments
 (0)