|
|
|||
File indexing completed on 2026-05-10 08:44:29
0001 //===- llvm/Support/Errno.h - Portable+convenient errno handling -*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // This file declares some portable and convenient functions to deal with errno. 0010 // 0011 //===----------------------------------------------------------------------===// 0012 0013 #ifndef LLVM_SUPPORT_ERRNO_H 0014 #define LLVM_SUPPORT_ERRNO_H 0015 0016 #include <cerrno> 0017 #include <string> 0018 0019 namespace llvm { 0020 namespace sys { 0021 0022 /// Returns a string representation of the errno value, using whatever 0023 /// thread-safe variant of strerror() is available. Be sure to call this 0024 /// immediately after the function that set errno, or errno may have been 0025 /// overwritten by an intervening call. 0026 std::string StrError(); 0027 0028 /// Like the no-argument version above, but uses \p errnum instead of errno. 0029 std::string StrError(int errnum); 0030 0031 template <typename FailT, typename Fun, typename... Args> 0032 inline decltype(auto) RetryAfterSignal(const FailT &Fail, const Fun &F, 0033 const Args &... As) { 0034 decltype(F(As...)) Res; 0035 do { 0036 errno = 0; 0037 Res = F(As...); 0038 } while (Res == Fail && errno == EINTR); 0039 return Res; 0040 } 0041 0042 } // namespace sys 0043 } // namespace llvm 0044 0045 #endif // LLVM_SUPPORT_ERRNO_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|