OSDN Git Service

Recommit "[Support] Add RetryAfterSignal helper function"
authorPavel Labath <labath@google.com>
Thu, 29 Jun 2017 13:15:31 +0000 (13:15 +0000)
committerPavel Labath <labath@google.com>
Thu, 29 Jun 2017 13:15:31 +0000 (13:15 +0000)
commitd04333d38b8fd9914389c21267fa3859b9ebe0b7
tree31b098de8d60d6ed4c77d7659450de67f13d5da3
parent6b54220c086db1e88f1ae5003cf6cbb8a1fb3199
Recommit "[Support] Add RetryAfterSignal helper function"

The difference from the previous version is the use of decltype, as the
implementation of std::result_of in libc++ did not work correctly for
variadic function like open(2).

Original summary:
This function retries an operation if it was interrupted by a signal
(failed with EINTR). It's inspired by the TEMP_FAILURE_RETRY macro in
glibc, but I've turned that into a template function. I've also added a
fail-value argument, to enable the function to be used with e.g.
fopen(3), which is documented to fail for any reason that open(2) can
fail (which includes EINTR).

The main user of this function will be lldb, but there were also a
couple of uses within llvm that I could simplify using this function.

Reviewers: zturner, silvas, joerg

Subscribers: mgorny, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306671 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/Errno.h
lib/Support/MemoryBuffer.cpp
lib/Support/Unix/Path.inc
lib/Support/Unix/Process.inc
unittests/Support/CMakeLists.txt
unittests/Support/ErrnoTest.cpp [new file with mode: 0644]