[Openmp-commits] [PATCH] D142175: [OpenMP] Create a temp file in /tmp if /dev/shm is not accessible

Samuel Thibault via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Feb 22 14:21:30 PST 2023


sthibaul added inline comments.


================
Comment at: openmp/runtime/src/kmp_runtime.cpp:6920
+    KMP_DEBUG_ASSERT(temp_reg_status_file_name);
+    FILE *tf = fopen(temp_reg_status_file_name, O_RDONLY);
+    if (!tf) {
----------------
This is very obviously wrong (mixing `fopen` and `O_RDONLY`), and doesn't build:

```
/<<PKGBUILDDIR>>/openmp/runtime/src/kmp_runtime.cpp:6920:16: error: no matching function for call to 'fopen'
    FILE *tf = fopen(temp_reg_status_file_name, O_RDONLY);
               ^~~~~
/usr/include/stdio.h:270:26: note: candidate function not viable: no known conversion from 'int' to 'const char *__restrict' for 2nd argumen
extern FILE *__REDIRECT (fopen, (const char *__restrict __filename,
```

Actually, why using fopen at all? Rather use 

```
fd1 = open(temp_reg_status_file_name, O_RDONLY);
if (fd1 == -1) {
  // give it up now
  return;
}
```

?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142175/new/

https://reviews.llvm.org/D142175



More information about the Openmp-commits mailing list