[all-commits] [llvm/llvm-project] 536736: [Support] Add file lock/unlock functions

Serge Pavlov via All-commits all-commits at lists.llvm.org
Tue Jul 28 02:45:29 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 536736995bf5d073853c7e884968c9847b4ae64d
      https://github.com/llvm/llvm-project/commit/536736995bf5d073853c7e884968c9847b4ae64d
  Author: Serge Pavlov <sepavloff at gmail.com>
  Date:   2020-07-28 (Tue, 28 Jul 2020)

  Changed paths:
    M llvm/include/llvm/Support/FileSystem.h
    M llvm/lib/Support/Unix/Path.inc
    M llvm/lib/Support/Windows/Path.inc
    M llvm/unittests/Support/ProgramTest.cpp

  Log Message:
  -----------
  [Support] Add file lock/unlock functions

This is recommit of f51bc4fb60fb, reverted in 8577595e03fa, because
the function `flock` is not available on Solaris. In this variant
`flock` was replaced with `fcntl`, which is a POSIX function.

New functions `lockFile`, `tryLockFile` and `unlockFile` implement
simple file locking. They lock or unlock entire file. This must be
enough to support simulataneous writes to log files in parallel builds.

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




More information about the All-commits mailing list