[all-commits] [llvm/llvm-project] dafebd: [OpenMP] Create a temp file in /tmp if /dev/shm is...

Shilei Tian via All-commits all-commits at lists.llvm.org
Tue Jan 24 18:45:51 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: dafebd5b5a08dde25f5f52f65cac54bd6ec0ecde
      https://github.com/llvm/llvm-project/commit/dafebd5b5a08dde25f5f52f65cac54bd6ec0ecde
  Author: Shilei Tian <i at tianshilei.me>
  Date:   2023-01-24 (Tue, 24 Jan 2023)

  Changed paths:
    M openmp/runtime/src/kmp_runtime.cpp

  Log Message:
  -----------
  [OpenMP] Create a temp file in /tmp if /dev/shm is not accessible

When `libomp` is initialized, it creates a temp file in `/dev/shm` to store
registration flag. Some systems, like Android, don't have `/dev/shm`, then this
feature is disabled by the macro `KMP_USE_SHM`, though most Linux distributions
have that. However, some customized distribution, such as the one reported in
https://github.com/llvm/llvm-project/issues/53955, doesn't support it either.
It causes a core dump. In this patch, if it is the case, we will try to create a
temporary file in `/tmp`, and if it still doesn't make it, then we error out.
Note that we don't consider in this patch if the temporary directory has been
set to `TMPDIR` in this patch. If `/tmp` is not accessible, we error out.

Fix #53955.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D142175




More information about the All-commits mailing list