]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/dll/include/boost/dll/detail/system_error.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / dll / include / boost / dll / detail / system_error.hpp
1 // Copyright 2014 Renato Tegon Forti, Antony Polukhin.
2 //
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7 #ifndef BOOST_DLL_SYSTEM_ERROR_HPP
8 #define BOOST_DLL_SYSTEM_ERROR_HPP
9
10 #include <boost/config.hpp>
11 #include <boost/predef/os.h>
12 #include <boost/system/error_code.hpp>
13 #include <boost/system/system_error.hpp>
14 #include <boost/throw_exception.hpp>
15
16 #if !BOOST_OS_WINDOWS
17 # include <dlfcn.h>
18 #endif
19
20 #ifdef BOOST_HAS_PRAGMA_ONCE
21 # pragma once
22 #endif
23
24 namespace boost { namespace dll { namespace detail {
25
26 inline void reset_dlerror() BOOST_NOEXCEPT {
27 #if !BOOST_OS_WINDOWS
28 const char* const error_txt = dlerror();
29 (void)error_txt;
30 #endif
31 }
32
33 inline void report_error(const boost::system::error_code& ec, const char* message) {
34 #if !BOOST_OS_WINDOWS
35 const char* const error_txt = dlerror();
36 if (error_txt) {
37 boost::throw_exception(
38 boost::system::system_error(
39 ec,
40 message + std::string(" (dlerror system message: ") + error_txt + std::string(")")
41 )
42 );
43 }
44 #endif
45
46 boost::throw_exception(
47 boost::system::system_error(
48 ec, message
49 )
50 );
51 }
52
53 }}} // boost::dll::detail
54
55 #endif // BOOST_DLL_SYSTEM_ERROR_HPP
56