Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:38

0001 //
0002 // detail/descriptor_ops.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_DETAIL_DESCRIPTOR_OPS_HPP
0012 #define BOOST_ASIO_DETAIL_DESCRIPTOR_OPS_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 
0020 #if !defined(BOOST_ASIO_WINDOWS) \
0021   && !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
0022   && !defined(__CYGWIN__)
0023 
0024 #include <cstddef>
0025 #include <boost/asio/error.hpp>
0026 #include <boost/system/error_code.hpp>
0027 #include <boost/asio/detail/cstdint.hpp>
0028 #include <boost/asio/detail/socket_types.hpp>
0029 
0030 #include <boost/asio/detail/push_options.hpp>
0031 
0032 namespace boost {
0033 namespace asio {
0034 namespace detail {
0035 namespace descriptor_ops {
0036 
0037 // Descriptor state bits.
0038 enum
0039 {
0040   // The user wants a non-blocking descriptor.
0041   user_set_non_blocking = 1,
0042 
0043   // The descriptor has been set non-blocking.
0044   internal_non_blocking = 2,
0045 
0046   // Helper "state" used to determine whether the descriptor is non-blocking.
0047   non_blocking = user_set_non_blocking | internal_non_blocking,
0048 
0049   // The descriptor may have been dup()-ed.
0050   possible_dup = 4
0051 };
0052 
0053 typedef unsigned char state_type;
0054 
0055 inline void get_last_error(
0056     boost::system::error_code& ec, bool is_error_condition)
0057 {
0058   if (!is_error_condition)
0059   {
0060     boost::asio::error::clear(ec);
0061   }
0062   else
0063   {
0064     ec = boost::system::error_code(errno,
0065         boost::asio::error::get_system_category());
0066   }
0067 }
0068 
0069 BOOST_ASIO_DECL int open(const char* path, int flags,
0070     boost::system::error_code& ec);
0071 
0072 BOOST_ASIO_DECL int open(const char* path, int flags, unsigned mode,
0073     boost::system::error_code& ec);
0074 
0075 BOOST_ASIO_DECL int close(int d, state_type& state,
0076     boost::system::error_code& ec);
0077 
0078 BOOST_ASIO_DECL bool set_user_non_blocking(int d,
0079     state_type& state, bool value, boost::system::error_code& ec);
0080 
0081 BOOST_ASIO_DECL bool set_internal_non_blocking(int d,
0082     state_type& state, bool value, boost::system::error_code& ec);
0083 
0084 typedef iovec buf;
0085 
0086 BOOST_ASIO_DECL std::size_t sync_read(int d, state_type state, buf* bufs,
0087     std::size_t count, bool all_empty, boost::system::error_code& ec);
0088 
0089 BOOST_ASIO_DECL std::size_t sync_read1(int d, state_type state, void* data,
0090     std::size_t size, boost::system::error_code& ec);
0091 
0092 BOOST_ASIO_DECL bool non_blocking_read(int d, buf* bufs, std::size_t count,
0093     boost::system::error_code& ec, std::size_t& bytes_transferred);
0094 
0095 BOOST_ASIO_DECL bool non_blocking_read1(int d, void* data, std::size_t size,
0096     boost::system::error_code& ec, std::size_t& bytes_transferred);
0097 
0098 BOOST_ASIO_DECL std::size_t sync_write(int d, state_type state,
0099     const buf* bufs, std::size_t count, bool all_empty,
0100     boost::system::error_code& ec);
0101 
0102 BOOST_ASIO_DECL std::size_t sync_write1(int d, state_type state,
0103     const void* data, std::size_t size, boost::system::error_code& ec);
0104 
0105 BOOST_ASIO_DECL bool non_blocking_write(int d,
0106     const buf* bufs, std::size_t count,
0107     boost::system::error_code& ec, std::size_t& bytes_transferred);
0108 
0109 BOOST_ASIO_DECL bool non_blocking_write1(int d,
0110     const void* data, std::size_t size,
0111     boost::system::error_code& ec, std::size_t& bytes_transferred);
0112 
0113 #if defined(BOOST_ASIO_HAS_FILE)
0114 
0115 BOOST_ASIO_DECL std::size_t sync_read_at(int d, state_type state,
0116     uint64_t offset, buf* bufs, std::size_t count, bool all_empty,
0117     boost::system::error_code& ec);
0118 
0119 BOOST_ASIO_DECL std::size_t sync_read_at1(int d, state_type state,
0120     uint64_t offset, void* data, std::size_t size,
0121     boost::system::error_code& ec);
0122 
0123 BOOST_ASIO_DECL bool non_blocking_read_at(int d, uint64_t offset,
0124     buf* bufs, std::size_t count, boost::system::error_code& ec,
0125     std::size_t& bytes_transferred);
0126 
0127 BOOST_ASIO_DECL bool non_blocking_read_at1(int d, uint64_t offset,
0128     void* data, std::size_t size, boost::system::error_code& ec,
0129     std::size_t& bytes_transferred);
0130 
0131 BOOST_ASIO_DECL std::size_t sync_write_at(int d, state_type state,
0132     uint64_t offset, const buf* bufs, std::size_t count, bool all_empty,
0133     boost::system::error_code& ec);
0134 
0135 BOOST_ASIO_DECL std::size_t sync_write_at1(int d, state_type state,
0136     uint64_t offset, const void* data, std::size_t size,
0137     boost::system::error_code& ec);
0138 
0139 BOOST_ASIO_DECL bool non_blocking_write_at(int d,
0140     uint64_t offset, const buf* bufs, std::size_t count,
0141     boost::system::error_code& ec, std::size_t& bytes_transferred);
0142 
0143 BOOST_ASIO_DECL bool non_blocking_write_at1(int d,
0144     uint64_t offset, const void* data, std::size_t size,
0145     boost::system::error_code& ec, std::size_t& bytes_transferred);
0146 
0147 #endif // defined(BOOST_ASIO_HAS_FILE)
0148 
0149 BOOST_ASIO_DECL int ioctl(int d, state_type& state, long cmd,
0150     ioctl_arg_type* arg, boost::system::error_code& ec);
0151 
0152 BOOST_ASIO_DECL int fcntl(int d, int cmd, boost::system::error_code& ec);
0153 
0154 BOOST_ASIO_DECL int fcntl(int d, int cmd,
0155     long arg, boost::system::error_code& ec);
0156 
0157 BOOST_ASIO_DECL int poll_read(int d,
0158     state_type state, boost::system::error_code& ec);
0159 
0160 BOOST_ASIO_DECL int poll_write(int d,
0161     state_type state, boost::system::error_code& ec);
0162 
0163 BOOST_ASIO_DECL int poll_error(int d,
0164     state_type state, boost::system::error_code& ec);
0165 
0166 } // namespace descriptor_ops
0167 } // namespace detail
0168 } // namespace asio
0169 } // namespace boost
0170 
0171 #include <boost/asio/detail/pop_options.hpp>
0172 
0173 #if defined(BOOST_ASIO_HEADER_ONLY)
0174 # include <boost/asio/detail/impl/descriptor_ops.ipp>
0175 #endif // defined(BOOST_ASIO_HEADER_ONLY)
0176 
0177 #endif // !defined(BOOST_ASIO_WINDOWS)
0178        //   && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
0179        //   && !defined(__CYGWIN__)
0180 
0181 #endif // BOOST_ASIO_DETAIL_DESCRIPTOR_OPS_HPP