Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
3.2KB

  1. //
  2. // detail/descriptor_ops.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef ASIO_DETAIL_DESCRIPTOR_OPS_HPP
  11. #define ASIO_DETAIL_DESCRIPTOR_OPS_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/config.hpp"
  16. #if !defined(ASIO_WINDOWS) \
  17. && !defined(ASIO_WINDOWS_RUNTIME) \
  18. && !defined(__CYGWIN__)
  19. #include <cstddef>
  20. #include "asio/error_code.hpp"
  21. #include "asio/detail/socket_types.hpp"
  22. #include "asio/detail/push_options.hpp"
  23. namespace asio {
  24. namespace detail {
  25. namespace descriptor_ops {
  26. // Descriptor state bits.
  27. enum
  28. {
  29. // The user wants a non-blocking descriptor.
  30. user_set_non_blocking = 1,
  31. // The descriptor has been set non-blocking.
  32. internal_non_blocking = 2,
  33. // Helper "state" used to determine whether the descriptor is non-blocking.
  34. non_blocking = user_set_non_blocking | internal_non_blocking,
  35. // The descriptor may have been dup()-ed.
  36. possible_dup = 4
  37. };
  38. typedef unsigned char state_type;
  39. template <typename ReturnType>
  40. inline ReturnType error_wrapper(ReturnType return_value,
  41. asio::error_code& ec)
  42. {
  43. ec = asio::error_code(errno,
  44. asio::error::get_system_category());
  45. return return_value;
  46. }
  47. ASIO_DECL int open(const char* path, int flags,
  48. asio::error_code& ec);
  49. ASIO_DECL int close(int d, state_type& state,
  50. asio::error_code& ec);
  51. ASIO_DECL bool set_user_non_blocking(int d,
  52. state_type& state, bool value, asio::error_code& ec);
  53. ASIO_DECL bool set_internal_non_blocking(int d,
  54. state_type& state, bool value, asio::error_code& ec);
  55. typedef iovec buf;
  56. ASIO_DECL std::size_t sync_read(int d, state_type state, buf* bufs,
  57. std::size_t count, bool all_empty, asio::error_code& ec);
  58. ASIO_DECL bool non_blocking_read(int d, buf* bufs, std::size_t count,
  59. asio::error_code& ec, std::size_t& bytes_transferred);
  60. ASIO_DECL std::size_t sync_write(int d, state_type state,
  61. const buf* bufs, std::size_t count, bool all_empty,
  62. asio::error_code& ec);
  63. ASIO_DECL bool non_blocking_write(int d,
  64. const buf* bufs, std::size_t count,
  65. asio::error_code& ec, std::size_t& bytes_transferred);
  66. ASIO_DECL int ioctl(int d, state_type& state, long cmd,
  67. ioctl_arg_type* arg, asio::error_code& ec);
  68. ASIO_DECL int fcntl(int d, int cmd, asio::error_code& ec);
  69. ASIO_DECL int fcntl(int d, int cmd,
  70. long arg, asio::error_code& ec);
  71. ASIO_DECL int poll_read(int d,
  72. state_type state, asio::error_code& ec);
  73. ASIO_DECL int poll_write(int d,
  74. state_type state, asio::error_code& ec);
  75. ASIO_DECL int poll_error(int d,
  76. state_type state, asio::error_code& ec);
  77. } // namespace descriptor_ops
  78. } // namespace detail
  79. } // namespace asio
  80. #include "asio/detail/pop_options.hpp"
  81. #if defined(ASIO_HEADER_ONLY)
  82. # include "asio/detail/impl/descriptor_ops.ipp"
  83. #endif // defined(ASIO_HEADER_ONLY)
  84. #endif // !defined(ASIO_WINDOWS)
  85. // && !defined(ASIO_WINDOWS_RUNTIME)
  86. // && !defined(__CYGWIN__)
  87. #endif // ASIO_DETAIL_DESCRIPTOR_OPS_HPP