]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/exception/include/boost/exception/errinfo_errno.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / exception / include / boost / exception / errinfo_errno.hpp
1 //Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
2
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #ifndef UUID_F0EE17BE6C1211DE87FF459155D89593
7 #define UUID_F0EE17BE6C1211DE87FF459155D89593
8 #if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
9 #pragma GCC system_header
10 #endif
11 #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
12 #pragma warning(push,1)
13 #pragma warning(disable:4996)
14 #endif
15
16 #include "boost/exception/info.hpp"
17 #include <errno.h>
18 #include <string.h>
19
20 namespace
21 boost
22 {
23 typedef error_info<struct errinfo_errno_,int> errinfo_errno;
24
25 //Usage hint:
26 //if( c_function(....)!=0 )
27 // BOOST_THROW_EXCEPTION(
28 // failure() <<
29 // errinfo_errno(errno) <<
30 // errinfo_api_function("c_function") );
31 inline
32 std::string
33 to_string( errinfo_errno const & e )
34 {
35 std::ostringstream tmp;
36 int v=e.value();
37 tmp << '[' << error_info_name(e) << "] = " << v << ", \"" << strerror(v) << "\"\n";
38 return tmp.str();
39 }
40 }
41
42 #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
43 #pragma warning(pop)
44 #endif
45 #endif