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.

descriptor_ops.hpp 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. //
  2. // detail/descriptor_ops.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 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.hpp"
  21. #include "asio/error_code.hpp"
  22. #include "asio/detail/socket_types.hpp"
  23. #include "asio/detail/push_options.hpp"
  24. namespace asio {
  25. namespace detail {
  26. namespace descriptor_ops {
  27. // Descriptor state bits.
  28. enum
  29. {
  30. // The user wants a non-blocking descriptor.
  31. user_set_non_blocking = 1,
  32. // The descriptor has been set non-blocking.
  33. internal_non_blocking = 2,
  34. // Helper "state" used to determine whether the descriptor is non-blocking.
  35. non_blocking = user_set_non_blocking | internal_non_blocking,
  36. // The descriptor may have been dup()-ed.
  37. possible_dup = 4
  38. };
  39. typedef unsigned char state_type;
  40. template <typename ReturnType>
  41. inline ReturnType error_wrapper(ReturnType return_value,
  42. asio::error_code& ec)
  43. {
  44. ec = asio::error_code(errno,
  45. asio::error::get_system_category());
  46. return return_value;
  47. }
  48. ASIO_DECL int open(const char* path, int flags,
  49. asio::error_code& ec);
  50. ASIO_DECL int close(int d, state_type& state,
  51. asio::error_code& ec);
  52. ASIO_DECL bool set_user_non_blocking(int d,
  53. state_type& state, bool value, asio::error_code& ec);
  54. ASIO_DECL bool set_internal_non_blocking(int d,
  55. state_type& state, bool value, asio::error_code& ec);
  56. typedef iovec buf;
  57. ASIO_DECL std::size_t sync_read(int d, state_type state, buf* bufs,
  58. std::size_t count, bool all_empty, asio::error_code& ec);
  59. ASIO_DECL bool non_blocking_read(int d, buf* bufs, std::size_t count,
  60. asio::error_code& ec, std::size_t& bytes_transferred);
  61. ASIO_DECL std::size_t sync_write(int d, state_type state,
  62. const buf* bufs, std::size_t count, bool all_empty,
  63. asio::error_code& ec);
  64. ASIO_DECL bool non_blocking_write(int d,
  65. const buf* bufs, std::size_t count,
  66. asio::error_code& ec, std::size_t& bytes_transferred);
  67. ASIO_DECL int ioctl(int d, state_type& state, long cmd,
  68. ioctl_arg_type* arg, asio::error_code& ec);
  69. ASIO_DECL int fcntl(int d, int cmd, asio::error_code& ec);
  70. ASIO_DECL int fcntl(int d, int cmd,
  71. long arg, asio::error_code& ec);
  72. ASIO_DECL int poll_read(int d,
  73. state_type state, asio::error_code& ec);
  74. ASIO_DECL int poll_write(int d,
  75. state_type state, asio::error_code& ec);
  76. ASIO_DECL int poll_error(int d,
  77. state_type state, asio::error_code& ec);
  78. } // namespace descriptor_ops
  79. } // namespace detail
  80. } // namespace asio
  81. #include "asio/detail/pop_options.hpp"
  82. #if defined(ASIO_HEADER_ONLY)
  83. # include "asio/detail/impl/descriptor_ops.ipp"
  84. #endif // defined(ASIO_HEADER_ONLY)
  85. #endif // !defined(ASIO_WINDOWS)
  86. // && !defined(ASIO_WINDOWS_RUNTIME)
  87. // && !defined(__CYGWIN__)
  88. #endif // ASIO_DETAIL_DESCRIPTOR_OPS_HPP