diff -rupN boost_1_43_0/boost/asio/basic_socket_iostream.hpp boost_vms_1_43_0/boost/asio/basic_socket_iostream.hpp --- boost_1_43_0/boost/asio/basic_socket_iostream.hpp 2010-01-11 04:34:00.000000000 +0200 +++ boost_vms_1_43_0/boost/asio/basic_socket_iostream.hpp 2010-07-11 16:57:59.000000000 +0300 @@ -34,6 +34,9 @@ #include #include +#include +#include + #if !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY) #define BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY 5 #endif // !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY) diff -rupN boost_1_43_0/boost/asio/detail/buffer_sequence_adapter.hpp boost_vms_1_43_0/boost/asio/detail/buffer_sequence_adapter.hpp --- boost_1_43_0/boost/asio/detail/buffer_sequence_adapter.hpp 2010-03-18 02:58:47.000000000 +0200 +++ boost_vms_1_43_0/boost/asio/detail/buffer_sequence_adapter.hpp 2010-07-13 12:01:47.000000000 +0300 @@ -43,7 +43,11 @@ protected: buf.len = boost::asio::buffer_size(buffer); } #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + #if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 + typedef __iovec64 native_buffer_type; + #else typedef iovec native_buffer_type; + #endif static void init_iov_base(void*& base, void* addr) { @@ -56,14 +60,14 @@ protected: base = static_cast(addr); } - static void init_native_buffer(iovec& iov, + static void init_native_buffer(native_buffer_type& iov, const boost::asio::mutable_buffer& buffer) { init_iov_base(iov.iov_base, boost::asio::buffer_cast(buffer)); iov.iov_len = boost::asio::buffer_size(buffer); } - static void init_native_buffer(iovec& iov, + static void init_native_buffer(native_buffer_type& iov, const boost::asio::const_buffer& buffer) { init_iov_base(iov.iov_base, const_cast( diff -rupN boost_1_43_0/boost/asio/detail/null_signal_blocker.hpp boost_vms_1_43_0/boost/asio/detail/null_signal_blocker.hpp --- boost_1_43_0/boost/asio/detail/null_signal_blocker.hpp 2010-04-07 11:44:41.000000000 +0300 +++ boost_vms_1_43_0/boost/asio/detail/null_signal_blocker.hpp 2010-07-11 15:52:32.000000000 +0300 @@ -21,7 +21,7 @@ #include #include -#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) +#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) || defined(__VMS) #include diff -rupN boost_1_43_0/boost/asio/detail/posix_thread.hpp boost_vms_1_43_0/boost/asio/detail/posix_thread.hpp --- boost_1_43_0/boost/asio/detail/posix_thread.hpp 2010-01-04 13:55:09.000000000 +0200 +++ boost_vms_1_43_0/boost/asio/detail/posix_thread.hpp 2010-07-08 18:17:25.000000000 +0300 @@ -37,7 +37,8 @@ namespace boost { namespace asio { namespace detail { -extern "C" void* boost_asio_detail_posix_thread_function(void* arg); +// Make identifier shorter as VMS compiler complain on on +extern "C" void* boost_asio_detail_pthread_func(void* arg); class posix_thread : private noncopyable @@ -50,7 +51,7 @@ public: { std::auto_ptr arg(new func(f)); int error = ::pthread_create(&thread_, 0, - boost_asio_detail_posix_thread_function, arg.get()); + boost_asio_detail_pthread_func, arg.get()); if (error != 0) { boost::system::system_error e( @@ -80,7 +81,7 @@ public: } private: - friend void* boost_asio_detail_posix_thread_function(void* arg); + friend void* boost_asio_detail_pthread_func(void* arg); class func_base { @@ -112,7 +113,7 @@ private: bool joined_; }; -inline void* boost_asio_detail_posix_thread_function(void* arg) +inline void* boost_asio_detail_pthread_func(void* arg) { std::auto_ptr f( static_cast(arg)); diff -rupN boost_1_43_0/boost/asio/detail/select_interrupter.hpp boost_vms_1_43_0/boost/asio/detail/select_interrupter.hpp --- boost_1_43_0/boost/asio/detail/select_interrupter.hpp 2010-01-04 13:55:09.000000000 +0200 +++ boost_vms_1_43_0/boost/asio/detail/select_interrupter.hpp 2010-07-08 18:13:42.000000000 +0300 @@ -21,7 +21,7 @@ #include #include -#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) || defined(__VMS) # include #else # include @@ -32,7 +32,7 @@ namespace boost { namespace asio { namespace detail { -#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) || defined(__VMS) typedef socket_select_interrupter select_interrupter; #elif defined(BOOST_ASIO_HAS_EVENTFD) typedef eventfd_select_interrupter select_interrupter; diff -rupN boost_1_43_0/boost/asio/detail/signal_blocker.hpp boost_vms_1_43_0/boost/asio/detail/signal_blocker.hpp --- boost_1_43_0/boost/asio/detail/signal_blocker.hpp 2010-04-07 11:44:41.000000000 +0300 +++ boost_vms_1_43_0/boost/asio/detail/signal_blocker.hpp 2010-07-08 18:15:26.000000000 +0300 @@ -21,7 +21,8 @@ #include #include -#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) +#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) || defined(__VMS) +// vms does not have pthread_sigmask # include #elif defined(BOOST_WINDOWS) || defined(__CYGWIN__) # include @@ -35,7 +36,7 @@ namespace boost { namespace asio { namespace detail { -#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) +#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) || defined(__VMS) typedef null_signal_blocker signal_blocker; #elif defined(BOOST_WINDOWS) || defined(__CYGWIN__) typedef win_signal_blocker signal_blocker; diff -rupN boost_1_43_0/boost/asio/detail/socket_ops.hpp boost_vms_1_43_0/boost/asio/detail/socket_ops.hpp --- boost_1_43_0/boost/asio/detail/socket_ops.hpp 2010-01-04 13:55:09.000000000 +0200 +++ boost_vms_1_43_0/boost/asio/detail/socket_ops.hpp 2010-07-13 12:25:52.000000000 +0300 @@ -31,6 +31,10 @@ #include #include +#ifdef __VMS +#include +#endif + namespace boost { namespace asio { namespace detail { @@ -38,6 +42,10 @@ namespace socket_ops { #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) struct msghdr { int msg_namelen; }; +#elif defined(__VMS) +# if __INITIAL_POINTER_SIZE == 64 + typedef struct __msghdr64 msghdr; +# endif // pointer size #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) #if defined(__hpux) @@ -75,7 +83,11 @@ template inline socket_type call_accept(SockLenType msghdr::*, socket_type s, socket_addr_type* addr, std::size_t* addrlen) { +#ifdef __VMS + size_t tmp_addrlen = addrlen ? *addrlen : 0; +#else SockLenType tmp_addrlen = addrlen ? (SockLenType)*addrlen : 0; +#endif socket_type result = ::accept(s, addr, addrlen ? &tmp_addrlen : 0); if (addrlen) *addrlen = (std::size_t)tmp_addrlen; @@ -206,7 +218,9 @@ inline void init_buf_iov_base(T& base, v #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) typedef WSABUF buf; -#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) +#elif defined(__VMS) && __INITIAL_POINTER_SIZE == 64 +typedef __iovec64 buf; +#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) || defined(__VMS) typedef iovec buf; #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) @@ -226,6 +240,9 @@ inline void init_buf(buf& b, const void* #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) b.buf = static_cast(const_cast(data)); b.len = static_cast(size); +#elif defined(__VMS) + b.iov_base = reinterpret_cast(const_cast(data)); + b.iov_len = static_cast(size); #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) init_buf_iov_base(b.iov_base, const_cast(data)); b.iov_len = size; @@ -469,7 +486,11 @@ inline int call_getsockopt(SockLenType m socket_type s, int level, int optname, void* optval, std::size_t* optlen) { +#ifdef __VMS + size_t tmp_optlen = *optlen; +#else SockLenType tmp_optlen = (SockLenType)*optlen; +#endif int result = ::getsockopt(s, level, optname, (char*)optval, &tmp_optlen); *optlen = (std::size_t)tmp_optlen; return result; @@ -558,7 +579,11 @@ template inline int call_getpeername(SockLenType msghdr::*, socket_type s, socket_addr_type* addr, std::size_t* addrlen) { +#ifdef __VMS + size_t tmp_addrlen = addrlen ? *addrlen : 0; +#else SockLenType tmp_addrlen = (SockLenType)*addrlen; +#endif int result = ::getpeername(s, addr, &tmp_addrlen); *addrlen = (std::size_t)tmp_addrlen; return result; @@ -579,7 +604,11 @@ template inline int call_getsockname(SockLenType msghdr::*, socket_type s, socket_addr_type* addr, std::size_t* addrlen) { +#ifdef __VMS + size_t tmp_addrlen = addrlen ? *addrlen : 0; +#else SockLenType tmp_addrlen = (SockLenType)*addrlen; +#endif int result = ::getsockname(s, addr, &tmp_addrlen); *addrlen = (std::size_t)tmp_addrlen; return result; @@ -596,14 +625,41 @@ inline int getsockname(socket_type s, so return result; } -inline int ioctl(socket_type s, long cmd, ioctl_arg_type* arg, +#ifdef __VMS + #pragma __required_pointer_size __save + #pragma __required_pointer_size __short + typedef char *short_char_ptr; + typedef ioctl_arg_type *short_ioctl_arg_type_ptr; + #pragma __required_pointer_size __restore +#else +#endif + +inline int ioctl(socket_type s, long cmd, ioctl_arg_type *arg, boost::system::error_code& ec) { clear_error(ec); #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) int result = error_wrapper(::ioctlsocket(s, cmd, arg), ec); #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + #if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 + // + // Under OpenVMS ioctl can be used with 32 bit pointer only + // so we place the value on stack (which is promissed to be 32 bit) + // and call ioctl and then update value if changed. + // + // All asio ioctl use ioctl_arg_type and not something bigger + // (at least in OpenVMS) + // + ioctl_arg_type tmp = arg ? * arg : 0; + short_ioctl_arg_type_ptr short_arg = 0; + if(arg) + short_arg = &tmp; + int result = error_wrapper(::ioctl(s, cmd, short_arg ), ec); + if(arg && tmp!=*arg) + *arg=tmp; + #else int result = error_wrapper(::ioctl(s, cmd, arg), ec); + #endif #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) if (result >= 0) clear_error(ec); @@ -791,7 +847,12 @@ inline const char* inet_ntop(int af, con if (result != 0 && af == AF_INET6 && scope_id != 0) { using namespace std; // For strcat and sprintf. + #if !defined(__VMS) || (defined(__INITIAL_POINTER_SIZE) && __INITIAL_POINTER_SIZE != 64) char if_name[IF_NAMESIZE + 1] = "%"; + #else // __VMS + char if_name_buf[IF_NAMESIZE + 1] = "%"; + short_char_ptr if_name = (short_char_ptr)if_name_buf; + #endif const in6_addr_type* ipv6_address = static_cast(src); bool is_link_local = IN6_IS_ADDR_LINKLOCAL(ipv6_address); if (!is_link_local || if_indextoname(scope_id, if_name + 1) == 0) @@ -878,8 +939,17 @@ inline int inet_pton(int af, const char* { in6_addr_type* ipv6_address = static_cast(dest); bool is_link_local = IN6_IS_ADDR_LINKLOCAL(ipv6_address); - if (is_link_local) + if (is_link_local) { + #if !defined(__VMS) || (defined(__INITIAL_POINTER_SIZE) && __INITIAL_POINTER_SIZE != 64) *scope_id = if_nametoindex(if_name + 1); + #else + short_char_ptr tmp = (short_char_ptr)_malloc32(strlen(if_name + 1)+1); + if(!tmp) throw std::bad_alloc(); + strcpy(tmp,(if_name + 1)); + *scope_id = if_nametoindex(tmp); + free(tmp); + #endif + } if (*scope_id == 0) *scope_id = atoi(if_name + 1); } @@ -1777,6 +1847,10 @@ inline boost::system::error_code transla } } +#if defined(__VMS) && defined(getaddrinfo) +# undef getaddrinfo +#endif + inline boost::system::error_code getaddrinfo(const char* host, const char* service, const addrinfo_type* hints, addrinfo_type** result, boost::system::error_code& ec) @@ -1805,6 +1879,14 @@ inline boost::system::error_code getaddr #elif defined(__MACH__) && defined(__APPLE__) int error = getaddrinfo_emulation(host, service, hints, result); return ec = translate_addrinfo_error(error); +#elif defined(__VMS) + #if __INITIAL_POINTER_SIZE == 64 + int error = ::__getaddrinfo64(host, service, hints, result); + #else + #undef getaddrinfo + int error = ::getaddrinfo(host, service, hints, result); + #endif + return ec = translate_addrinfo_error(error); #else int error = ::getaddrinfo(host, service, hints, result); return ec = translate_addrinfo_error(error); diff -rupN boost_1_43_0/boost/asio/detail/socket_types.hpp boost_vms_1_43_0/boost/asio/detail/socket_types.hpp --- boost_1_43_0/boost/asio/detail/socket_types.hpp 2010-03-21 11:39:26.000000000 +0200 +++ boost_vms_1_43_0/boost/asio/detail/socket_types.hpp 2010-07-11 14:59:27.000000000 +0300 @@ -98,14 +98,16 @@ # include # include # include -# if defined(__hpux) && !defined(__HP_aCC) +# if defined(__hpux) && !defined(__HP_aCC) || defined(__VMS) # include # else # include # endif # include # include +# ifndef __VMS # include +# endif # include # include # include @@ -187,8 +189,14 @@ typedef in6_addr in6_addr_type; typedef ipv6_mreq in6_mreq_type; typedef sockaddr_in6 sockaddr_in6_type; typedef sockaddr_storage sockaddr_storage_type; +#ifndef __VMS typedef sockaddr_un sockaddr_un_type; -typedef addrinfo addrinfo_type; +#endif +#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 + typedef __addrinfo64 addrinfo_type; +#else + typedef addrinfo addrinfo_type; +#endif typedef int ioctl_arg_type; typedef uint32_t u_long_type; typedef uint16_t u_short_type; diff -rupN boost_1_43_0/boost/asio/local/basic_endpoint.hpp boost_vms_1_43_0/boost/asio/local/basic_endpoint.hpp --- boost_1_43_0/boost/asio/local/basic_endpoint.hpp 2010-01-04 11:36:00.000000000 +0200 +++ boost_vms_1_43_0/boost/asio/local/basic_endpoint.hpp 2010-07-15 11:42:25.000000000 +0300 @@ -32,7 +32,7 @@ #include #if !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS) -# if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +# if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) && !defined(__VMS) # define BOOST_ASIO_HAS_LOCAL_SOCKETS 1 # endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) #endif // !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS) diff -rupN boost_1_43_0/boost/asio/posix/stream_descriptor_service.hpp boost_vms_1_43_0/boost/asio/posix/stream_descriptor_service.hpp --- boost_1_43_0/boost/asio/posix/stream_descriptor_service.hpp 2010-03-18 02:58:47.000000000 +0200 +++ boost_vms_1_43_0/boost/asio/posix/stream_descriptor_service.hpp 2010-07-15 11:44:05.000000000 +0300 @@ -27,7 +27,7 @@ #include #if !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR) -# if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +# if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) && !defined(__VMS) # define BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR 1 # endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) #endif // !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR) diff -rupN boost_1_43_0/boost/asio/serial_port_base.hpp boost_vms_1_43_0/boost/asio/serial_port_base.hpp --- boost_1_43_0/boost/asio/serial_port_base.hpp 2010-01-04 11:36:00.000000000 +0200 +++ boost_vms_1_43_0/boost/asio/serial_port_base.hpp 2010-07-15 10:27:40.000000000 +0300 @@ -27,7 +27,7 @@ #if !defined(BOOST_ASIO_DISABLE_SERIAL_PORT) # if defined(BOOST_ASIO_HAS_IOCP) \ - || !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + || !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) && !defined(__VMS) # define BOOST_ASIO_HAS_SERIAL_PORT 1 # endif // defined(BOOST_ASIO_HAS_IOCP) #endif // !defined(BOOST_ASIO_DISABLE_STREAM_HANDLE) diff -rupN boost_1_43_0/libs/asio/test/buffered_read_stream.cpp boost_vms_1_43_0/libs/asio/test/buffered_read_stream.cpp --- boost_1_43_0/libs/asio/test/buffered_read_stream.cpp 2010-01-04 13:55:09.000000000 +0200 +++ boost_vms_1_43_0/libs/asio/test/buffered_read_stream.cpp 2010-07-13 17:17:32.000000000 +0300 @@ -93,7 +93,12 @@ void test_sync_operations() boost::asio::buffer(read_buf), error); BOOST_CHECK(bytes_read == 0); +#ifdef __VMS + // OS bug + BOOST_CHECK(error == boost::asio::error::eof || error == boost::system::errc::broken_pipe); +#else BOOST_CHECK(error == boost::asio::error::eof); +#endif client_socket.close(error); } @@ -126,7 +131,12 @@ void handle_read(const boost::system::er void handle_read_eof(const boost::system::error_code& e, std::size_t bytes_transferred) { +#ifdef __VMS + // OS bug + BOOST_CHECK(e == boost::asio::error::eof || e == boost::system::errc::broken_pipe); +#else BOOST_CHECK(e == boost::asio::error::eof); +#endif BOOST_CHECK(bytes_transferred == 0); } diff -rupN boost_1_43_0/libs/asio/test/buffered_stream.cpp boost_vms_1_43_0/libs/asio/test/buffered_stream.cpp --- boost_1_43_0/libs/asio/test/buffered_stream.cpp 2010-01-04 13:55:09.000000000 +0200 +++ boost_vms_1_43_0/libs/asio/test/buffered_stream.cpp 2010-07-13 17:21:05.000000000 +0300 @@ -95,8 +95,12 @@ void test_sync_operations() boost::asio::buffer(read_buf), error); BOOST_CHECK(bytes_read == 0); +#ifdef __VMS + // OS bug + BOOST_CHECK(error == boost::asio::error::eof || error == boost::system::errc::broken_pipe); +#else BOOST_CHECK(error == boost::asio::error::eof); - +#endif client_socket.close(error); } @@ -133,7 +137,12 @@ void handle_read(const boost::system::er void handle_read_eof(const boost::system::error_code& e, std::size_t bytes_transferred) { +#ifdef __VMS + // OS bug + BOOST_CHECK(e == boost::asio::error::eof || e == boost::system::errc::broken_pipe); +#else BOOST_CHECK(e == boost::asio::error::eof); +#endif BOOST_CHECK(bytes_transferred == 0); } diff -rupN boost_1_43_0/libs/asio/test/buffered_write_stream.cpp boost_vms_1_43_0/libs/asio/test/buffered_write_stream.cpp --- boost_1_43_0/libs/asio/test/buffered_write_stream.cpp 2010-01-04 13:55:09.000000000 +0200 +++ boost_vms_1_43_0/libs/asio/test/buffered_write_stream.cpp 2010-07-13 17:19:15.000000000 +0300 @@ -95,7 +95,12 @@ void test_sync_operations() boost::asio::buffer(read_buf), error); BOOST_CHECK(bytes_read == 0); +#ifdef __VMS + // OS bug + BOOST_CHECK(error == boost::asio::error::eof || error == boost::system::errc::broken_pipe); +#else BOOST_CHECK(error == boost::asio::error::eof); +#endif client_socket.close(error); } @@ -133,7 +138,12 @@ void handle_read(const boost::system::er void handle_read_eof(const boost::system::error_code& e, std::size_t bytes_transferred) { +#ifdef __VMS + // OS bug + BOOST_CHECK(e == boost::asio::error::eof || e == boost::system::errc::broken_pipe); +#else BOOST_CHECK(e == boost::asio::error::eof); +#endif BOOST_CHECK(bytes_transferred == 0); } diff -rupN boost_1_43_0/libs/asio/test/ip/tcp.cpp boost_vms_1_43_0/libs/asio/test/ip/tcp.cpp --- boost_1_43_0/libs/asio/test/ip/tcp.cpp 2010-03-21 11:39:26.000000000 +0200 +++ boost_vms_1_43_0/libs/asio/test/ip/tcp.cpp 2010-07-13 15:22:32.000000000 +0300 @@ -359,7 +359,13 @@ void handle_read_eof(const boost::system size_t bytes_transferred, bool* called) { *called = true; + #ifdef __VMS + // OpenVMS recvmsg / sendmsg repots sometimes broken_pipe + // instead of eof... Bad but this is OS's bug + BOOST_CHECK(err == boost::asio::error::eof || err == boost::system::errc::broken_pipe); + #else BOOST_CHECK(err == boost::asio::error::eof); + #endif BOOST_CHECK(bytes_transferred == 0); }