[PATCH] D53988: Close file mapping handle on Windows, so flushed gcda files can be removed while the process is in execution

David Major via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 2 12:59:07 PDT 2018


dmajor added inline comments.


================
Comment at: lib/profile/GCDAProfiling.c:279
+  mmap_handle = CreateFileMapping(mmap_fd, NULL, PAGE_READWRITE, DWORD_HI(file_size), DWORD_LO(file_size), NULL);
+  if (mmap_handle == INVALID_HANDLE_VALUE) {
+    fprintf(stderr, "profiling: %s: cannot create file mapping: %d\n", filename,
----------------
When `CreateFileMapping` fails, it returns `NULL` rather than `INVALID_HANDLE_VALUE`. For consistency, the sentinel value for `mmap_handle` should probably be `NULL` throughout (e.g. in the initializer and `unmap_file` assignment).


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53988





More information about the llvm-commits mailing list