--- boost/asio/detail/io_control.hpp.orig 2011-06-06 03:21:43.000000000 +0400 +++ boost/asio/detail/io_control.hpp 2012-07-10 13:24:45.000000000 +0400 @@ -44,9 +44,9 @@ } // Get the name of the IO control command. - int name() const + ioctl_cmd_type name() const { - return static_cast(FIONBIO); + return static_cast(FIONBIO); } // Set the value of the I/O control command. @@ -94,9 +94,9 @@ } // Get the name of the IO control command. - int name() const + ioctl_cmd_type name() const { - return static_cast(FIONREAD); + return static_cast(FIONREAD); } // Set the value of the I/O control command. --- boost/asio/detail/descriptor_ops.hpp.orig 2010-12-06 01:55:08.000000000 +0300 +++ boost/asio/detail/descriptor_ops.hpp 2010-12-06 01:55:39.000000000 +0300 @@ -79,7 +79,7 @@ const buf* bufs, std::size_t count, boost::system::error_code& ec, std::size_t& bytes_transferred); -BOOST_ASIO_DECL int ioctl(int d, state_type& state, long cmd, +BOOST_ASIO_DECL int ioctl(int d, state_type& state, ioctl_cmd_type cmd, ioctl_arg_type* arg, boost::system::error_code& ec); BOOST_ASIO_DECL int fcntl(int d, long cmd, boost::system::error_code& ec); --- boost/asio/detail/socket_ops.hpp.orig 2010-12-06 01:58:36.000000000 +0300 +++ boost/asio/detail/socket_ops.hpp 2010-12-06 01:59:42.000000000 +0300 @@ -222,7 +222,7 @@ std::size_t* addrlen, boost::system::error_code& ec); BOOST_ASIO_DECL int ioctl(socket_type s, state_type& state, - int cmd, ioctl_arg_type* arg, boost::system::error_code& ec); + ioctl_cmd_type cmd, ioctl_arg_type* arg, boost::system::error_code& ec); BOOST_ASIO_DECL int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timeval* timeout, boost::system::error_code& ec); --- boost/asio/detail/impl/descriptor_ops.ipp.orig 2010-12-06 01:44:38.000000000 +0300 +++ boost/asio/detail/impl/descriptor_ops.ipp 2010-12-06 01:41:33.000000000 +0300 @@ -251,7 +251,7 @@ } } -int ioctl(int d, state_type& state, long cmd, +int ioctl(int d, state_type& state, ioctl_cmd_type cmd, ioctl_arg_type* arg, boost::system::error_code& ec) { if (d == -1) @@ -273,7 +273,7 @@ // descriptor is put into the state that has been requested by the user. If // the ioctl syscall was successful then we need to update the flags to // match. - if (cmd == static_cast(FIONBIO)) + if (cmd == static_cast(FIONBIO)) { if (*arg) { --- boost/asio/detail/impl/socket_ops.ipp.orig 2010-12-06 01:46:05.000000000 +0300 +++ boost/asio/detail/impl/socket_ops.ipp 2010-12-06 01:49:39.000000000 +0300 @@ -1414,7 +1414,7 @@ return result; } -int ioctl(socket_type s, state_type& state, int cmd, +int ioctl(socket_type s, state_type& state, ioctl_cmd_type cmd, ioctl_arg_type* arg, boost::system::error_code& ec) { if (s == invalid_socket) @@ -1424,15 +1424,10 @@ } clear_last_error(); -#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) - int result = error_wrapper(::ioctlsocket(s, cmd, arg), ec); -#elif defined(__MACH__) && defined(__APPLE__) \ - || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) + int result = error_wrapper(::ioctl(s, - static_cast(cmd), arg), ec); -#else - int result = error_wrapper(::ioctl(s, cmd, arg), ec); -#endif + static_cast(cmd), arg), ec); + if (result >= 0) { ec = boost::system::error_code(); @@ -1442,7 +1437,7 @@ // the correct state. This ensures that the underlying socket is put into // the state that has been requested by the user. If the ioctl syscall was // successful then we need to update the flags to match. - if (cmd == static_cast(FIONBIO)) + if (cmd == static_cast(FIONBIO)) { if (*arg) { --- boost/asio/detail/socket_types.hpp.orig 2010-12-06 01:35:39.000000000 +0300 +++ boost/asio/detail/socket_types.hpp 2010-12-06 01:36:05.000000000 +0300 @@ -147,6 +147,12 @@ typedef sockaddr_storage sockaddr_storage_type; typedef sockaddr_un sockaddr_un_type; typedef addrinfo addrinfo_type; +#if (defined(__MACH__) && defined(__APPLE__)) || defined(__DragonFly__) || \ + defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +typedef unsigned long ioctl_cmd_type; +#else +typedef int ioctl_cmd_type; +#endif typedef int ioctl_arg_type; typedef uint32_t u_long_type; typedef uint16_t u_short_type;