Ticket #4473: asio.patch

File asio.patch, 19.9 KB (added by anonymous, 12 years ago)
  • boost/asio/basic_socket_iostream.hpp

    diff -rupN boost_1_43_0/boost/asio/basic_socket_iostream.hpp boost_vms_1_43_0/boost/asio/basic_socket_iostream.hpp
    old new  
    3434#include <boost/asio/basic_socket_streambuf.hpp>
    3535#include <boost/asio/stream_socket_service.hpp>
    3636
     37#include <istream>
     38#include <ostream>
     39
    3740#if !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY)
    3841#define BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY 5
    3942#endif // !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY)
  • boost/asio/detail/buffer_sequence_adapter.hpp

    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
    old new protected:  
    4343    buf.len = boost::asio::buffer_size(buffer);
    4444  }
    4545#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
     46  #if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
     47  typedef __iovec64 native_buffer_type;
     48  #else
    4649  typedef iovec native_buffer_type;
     50  #endif
    4751
    4852  static void init_iov_base(void*& base, void* addr)
    4953  {
    protected:  
    5660    base = static_cast<T>(addr);
    5761  }
    5862
    59   static void init_native_buffer(iovec& iov,
     63  static void init_native_buffer(native_buffer_type& iov,
    6064      const boost::asio::mutable_buffer& buffer)
    6165  {
    6266    init_iov_base(iov.iov_base, boost::asio::buffer_cast<void*>(buffer));
    6367    iov.iov_len = boost::asio::buffer_size(buffer);
    6468  }
    6569
    66   static void init_native_buffer(iovec& iov,
     70  static void init_native_buffer(native_buffer_type& iov,
    6771      const boost::asio::const_buffer& buffer)
    6872  {
    6973    init_iov_base(iov.iov_base, const_cast<void*>(
  • boost/asio/detail/null_signal_blocker.hpp

    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
    old new  
    2121#include <boost/config.hpp>
    2222#include <boost/asio/detail/pop_options.hpp>
    2323
    24 #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS)
     24#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) || defined(__VMS)
    2525
    2626#include <boost/asio/detail/noncopyable.hpp>
    2727
  • boost/asio/detail/posix_thread.hpp

    diff -rupN boost_1_43_0/boost/asio/detail/posix_thread.hpp boost_vms_1_43_0/boost/asio/detail/posix_thread.hpp
    old new namespace boost {  
    3737namespace asio {
    3838namespace detail {
    3939
    40 extern "C" void* boost_asio_detail_posix_thread_function(void* arg);
     40// Make identifier shorter as VMS compiler complain on on
     41extern "C" void* boost_asio_detail_pthread_func(void* arg);
    4142
    4243class posix_thread
    4344  : private noncopyable
    public:  
    5051  {
    5152    std::auto_ptr<func_base> arg(new func<Function>(f));
    5253    int error = ::pthread_create(&thread_, 0,
    53           boost_asio_detail_posix_thread_function, arg.get());
     54          boost_asio_detail_pthread_func, arg.get());
    5455    if (error != 0)
    5556    {
    5657      boost::system::system_error e(
    public:  
    8081  }
    8182
    8283private:
    83   friend void* boost_asio_detail_posix_thread_function(void* arg);
     84  friend void* boost_asio_detail_pthread_func(void* arg);
    8485
    8586  class func_base
    8687  {
    private:  
    112113  bool joined_;
    113114};
    114115
    115 inline void* boost_asio_detail_posix_thread_function(void* arg)
     116inline void* boost_asio_detail_pthread_func(void* arg)
    116117{
    117118  std::auto_ptr<posix_thread::func_base> f(
    118119      static_cast<posix_thread::func_base*>(arg));
  • boost/asio/detail/select_interrupter.hpp

    diff -rupN boost_1_43_0/boost/asio/detail/select_interrupter.hpp boost_vms_1_43_0/boost/asio/detail/select_interrupter.hpp
    old new  
    2121#include <boost/config.hpp>
    2222#include <boost/asio/detail/pop_options.hpp>
    2323
    24 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
     24#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) || defined(__VMS)
    2525# include <boost/asio/detail/socket_select_interrupter.hpp>
    2626#else
    2727# include <boost/asio/detail/eventfd_select_interrupter.hpp>
    namespace boost {  
    3232namespace asio {
    3333namespace detail {
    3434
    35 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
     35#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) || defined(__VMS)
    3636typedef socket_select_interrupter select_interrupter;
    3737#elif defined(BOOST_ASIO_HAS_EVENTFD)
    3838typedef eventfd_select_interrupter select_interrupter;
  • boost/asio/detail/signal_blocker.hpp

    diff -rupN boost_1_43_0/boost/asio/detail/signal_blocker.hpp boost_vms_1_43_0/boost/asio/detail/signal_blocker.hpp
    old new  
    2121#include <boost/config.hpp>
    2222#include <boost/asio/detail/pop_options.hpp>
    2323
    24 #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS)
     24#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) || defined(__VMS)
     25// vms does not have pthread_sigmask
    2526# include <boost/asio/detail/null_signal_blocker.hpp>
    2627#elif defined(BOOST_WINDOWS) || defined(__CYGWIN__)
    2728# include <boost/asio/detail/win_signal_blocker.hpp>
    namespace boost {  
    3536namespace asio {
    3637namespace detail {
    3738
    38 #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS)
     39#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) || defined(__VMS)
    3940typedef null_signal_blocker signal_blocker;
    4041#elif defined(BOOST_WINDOWS) || defined(__CYGWIN__)
    4142typedef win_signal_blocker signal_blocker;
  • boost/asio/detail/socket_ops.hpp

    diff -rupN boost_1_43_0/boost/asio/detail/socket_ops.hpp boost_vms_1_43_0/boost/asio/detail/socket_ops.hpp
    old new  
    3131#include <boost/asio/error.hpp>
    3232#include <boost/asio/detail/socket_types.hpp>
    3333
     34#ifdef __VMS
     35#include <unistd.h>
     36#endif
     37
    3438namespace boost {
    3539namespace asio {
    3640namespace detail {
    namespace socket_ops {  
    3842
    3943#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
    4044struct msghdr { int msg_namelen; };
     45#elif defined(__VMS)
     46# if __INITIAL_POINTER_SIZE == 64
     47   typedef struct __msghdr64 msghdr;
     48# endif // pointer size
    4149#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
    4250
    4351#if defined(__hpux)
    template <typename SockLenType>  
    7583inline socket_type call_accept(SockLenType msghdr::*,
    7684    socket_type s, socket_addr_type* addr, std::size_t* addrlen)
    7785{
     86#ifdef __VMS
     87  size_t tmp_addrlen = addrlen ? *addrlen : 0;
     88#else
    7889  SockLenType tmp_addrlen = addrlen ? (SockLenType)*addrlen : 0;
     90#endif
    7991  socket_type result = ::accept(s, addr, addrlen ? &tmp_addrlen : 0);
    8092  if (addrlen)
    8193    *addrlen = (std::size_t)tmp_addrlen;
    inline void init_buf_iov_base(T& base, v  
    206218
    207219#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
    208220typedef WSABUF buf;
    209 #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
     221#elif defined(__VMS) && __INITIAL_POINTER_SIZE == 64
     222typedef __iovec64 buf;
     223#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) || defined(__VMS)
    210224typedef iovec buf;
    211225#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
    212226
    inline void init_buf(buf& b, const void*  
    226240#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
    227241  b.buf = static_cast<char*>(const_cast<void*>(data));
    228242  b.len = static_cast<u_long>(size);
     243#elif defined(__VMS)
     244  b.iov_base = reinterpret_cast<char *>(const_cast<void *>(data));
     245  b.iov_len = static_cast<u_long>(size);
    229246#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
    230247  init_buf_iov_base(b.iov_base, const_cast<void*>(data));
    231248  b.iov_len = size;
    inline int call_getsockopt(SockLenType m  
    469486    socket_type s, int level, int optname,
    470487    void* optval, std::size_t* optlen)
    471488{
     489#ifdef __VMS
     490  size_t tmp_optlen = *optlen;
     491#else
    472492  SockLenType tmp_optlen = (SockLenType)*optlen;
     493#endif
    473494  int result = ::getsockopt(s, level, optname, (char*)optval, &tmp_optlen);
    474495  *optlen = (std::size_t)tmp_optlen;
    475496  return result;
    template <typename SockLenType>  
    558579inline int call_getpeername(SockLenType msghdr::*,
    559580    socket_type s, socket_addr_type* addr, std::size_t* addrlen)
    560581{
     582#ifdef __VMS
     583  size_t tmp_addrlen = addrlen ? *addrlen : 0;
     584#else
    561585  SockLenType tmp_addrlen = (SockLenType)*addrlen;
     586#endif
    562587  int result = ::getpeername(s, addr, &tmp_addrlen);
    563588  *addrlen = (std::size_t)tmp_addrlen;
    564589  return result;
    template <typename SockLenType>  
    579604inline int call_getsockname(SockLenType msghdr::*,
    580605    socket_type s, socket_addr_type* addr, std::size_t* addrlen)
    581606{
     607#ifdef __VMS
     608  size_t tmp_addrlen = addrlen ? *addrlen : 0;
     609#else
    582610  SockLenType tmp_addrlen = (SockLenType)*addrlen;
     611#endif
    583612  int result = ::getsockname(s, addr, &tmp_addrlen);
    584613  *addrlen = (std::size_t)tmp_addrlen;
    585614  return result;
    inline int getsockname(socket_type s, so  
    596625  return result;
    597626}
    598627
    599 inline int ioctl(socket_type s, long cmd, ioctl_arg_type* arg,
     628#ifdef __VMS
     629  #pragma __required_pointer_size __save
     630  #pragma __required_pointer_size __short
     631  typedef char *short_char_ptr;
     632  typedef ioctl_arg_type *short_ioctl_arg_type_ptr;
     633  #pragma __required_pointer_size __restore
     634#else
     635#endif
     636
     637inline int ioctl(socket_type s, long cmd, ioctl_arg_type *arg,
    600638    boost::system::error_code& ec)
    601639{
    602640  clear_error(ec);
    603641#if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
    604642  int result = error_wrapper(::ioctlsocket(s, cmd, arg), ec);
    605643#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
     644  #if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
     645  //
     646  // Under OpenVMS ioctl can be used with 32 bit pointer only
     647  // so we place the value on stack (which is promissed to be 32 bit)
     648  // and call ioctl and then update value if changed.
     649  //
     650  // All asio ioctl use ioctl_arg_type and not something bigger
     651  // (at least in OpenVMS)
     652  //
     653  ioctl_arg_type tmp = arg ? * arg : 0;
     654  short_ioctl_arg_type_ptr short_arg = 0;
     655  if(arg)
     656     short_arg = &tmp;
     657  int result = error_wrapper(::ioctl(s, cmd, short_arg ), ec);
     658  if(arg && tmp!=*arg)
     659    *arg=tmp;
     660  #else
    606661  int result = error_wrapper(::ioctl(s, cmd, arg), ec);
     662  #endif
    607663#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
    608664  if (result >= 0)
    609665    clear_error(ec);
    inline const char* inet_ntop(int af, con  
    791847  if (result != 0 && af == AF_INET6 && scope_id != 0)
    792848  {
    793849    using namespace std; // For strcat and sprintf.
     850    #if !defined(__VMS) || (defined(__INITIAL_POINTER_SIZE) && __INITIAL_POINTER_SIZE != 64)
    794851    char if_name[IF_NAMESIZE + 1] = "%";
     852    #else // __VMS
     853    char if_name_buf[IF_NAMESIZE + 1] = "%";
     854    short_char_ptr if_name = (short_char_ptr)if_name_buf;
     855    #endif
    795856    const in6_addr_type* ipv6_address = static_cast<const in6_addr_type*>(src);
    796857    bool is_link_local = IN6_IS_ADDR_LINKLOCAL(ipv6_address);
    797858    if (!is_link_local || if_indextoname(scope_id, if_name + 1) == 0)
    inline int inet_pton(int af, const char*  
    878939    {
    879940      in6_addr_type* ipv6_address = static_cast<in6_addr_type*>(dest);
    880941      bool is_link_local = IN6_IS_ADDR_LINKLOCAL(ipv6_address);
    881       if (is_link_local)
     942      if (is_link_local) {
     943        #if !defined(__VMS) || (defined(__INITIAL_POINTER_SIZE) && __INITIAL_POINTER_SIZE != 64)
    882944        *scope_id = if_nametoindex(if_name + 1);
     945        #else
     946        short_char_ptr tmp = (short_char_ptr)_malloc32(strlen(if_name + 1)+1);
     947        if(!tmp) throw std::bad_alloc();
     948        strcpy(tmp,(if_name + 1));
     949        *scope_id = if_nametoindex(tmp);
     950        free(tmp);
     951        #endif
     952      }
    883953      if (*scope_id == 0)
    884954        *scope_id = atoi(if_name + 1);
    885955    }
    inline boost::system::error_code transla  
    17771847  }
    17781848}
    17791849
     1850#if defined(__VMS) && defined(getaddrinfo)
     1851# undef getaddrinfo
     1852#endif
     1853
    17801854inline boost::system::error_code getaddrinfo(const char* host,
    17811855    const char* service, const addrinfo_type* hints, addrinfo_type** result,
    17821856    boost::system::error_code& ec)
    inline boost::system::error_code getaddr  
    18051879#elif defined(__MACH__) && defined(__APPLE__)
    18061880  int error = getaddrinfo_emulation(host, service, hints, result);
    18071881  return ec = translate_addrinfo_error(error);
     1882#elif defined(__VMS)
     1883  #if __INITIAL_POINTER_SIZE == 64
     1884    int error = ::__getaddrinfo64(host, service, hints, result);
     1885  #else
     1886    #undef getaddrinfo
     1887    int error = ::getaddrinfo(host, service, hints, result);
     1888  #endif
     1889  return ec = translate_addrinfo_error(error);
    18081890#else
    18091891  int error = ::getaddrinfo(host, service, hints, result);
    18101892  return ec = translate_addrinfo_error(error);
  • boost/asio/detail/socket_types.hpp

    diff -rupN boost_1_43_0/boost/asio/detail/socket_types.hpp boost_vms_1_43_0/boost/asio/detail/socket_types.hpp
    old new  
    9898# include <sys/ioctl.h>
    9999# include <sys/poll.h>
    100100# include <sys/types.h>
    101 # if defined(__hpux) && !defined(__HP_aCC)
     101# if defined(__hpux) && !defined(__HP_aCC) || defined(__VMS)
    102102#  include <sys/time.h>
    103103# else
    104104#  include <sys/select.h>
    105105# endif
    106106# include <sys/socket.h>
    107107# include <sys/uio.h>
     108# ifndef __VMS
    108109# include <sys/un.h>
     110# endif
    109111# include <netinet/in.h>
    110112# include <netinet/tcp.h>
    111113# include <arpa/inet.h>
    typedef in6_addr in6_addr_type;  
    187189typedef ipv6_mreq in6_mreq_type;
    188190typedef sockaddr_in6 sockaddr_in6_type;
    189191typedef sockaddr_storage sockaddr_storage_type;
     192#ifndef __VMS
    190193typedef sockaddr_un sockaddr_un_type;
    191 typedef addrinfo addrinfo_type;
     194#endif
     195#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64
     196   typedef __addrinfo64 addrinfo_type;
     197#else
     198   typedef addrinfo addrinfo_type;
     199#endif
    192200typedef int ioctl_arg_type;
    193201typedef uint32_t u_long_type;
    194202typedef uint16_t u_short_type;
  • boost/asio/local/basic_endpoint.hpp

    diff -rupN boost_1_43_0/boost/asio/local/basic_endpoint.hpp boost_vms_1_43_0/boost/asio/local/basic_endpoint.hpp
    old new  
    3232#include <boost/asio/detail/throw_error.hpp>
    3333
    3434#if !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
    35 # if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
     35# if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) && !defined(__VMS)
    3636#  define BOOST_ASIO_HAS_LOCAL_SOCKETS 1
    3737# endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
    3838#endif // !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS)
  • boost/asio/posix/stream_descriptor_service.hpp

    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
    old new  
    2727#include <boost/asio/detail/service_base.hpp>
    2828
    2929#if !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
    30 # if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
     30# if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) && !defined(__VMS)
    3131#  define BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR 1
    3232# endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
    3333#endif // !defined(BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
  • boost/asio/serial_port_base.hpp

    diff -rupN boost_1_43_0/boost/asio/serial_port_base.hpp boost_vms_1_43_0/boost/asio/serial_port_base.hpp
    old new  
    2727
    2828#if !defined(BOOST_ASIO_DISABLE_SERIAL_PORT)
    2929# if defined(BOOST_ASIO_HAS_IOCP) \
    30     || !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
     30    || !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) && !defined(__VMS)
    3131#  define BOOST_ASIO_HAS_SERIAL_PORT 1
    3232# endif // defined(BOOST_ASIO_HAS_IOCP)
    3333#endif // !defined(BOOST_ASIO_DISABLE_STREAM_HANDLE)
  • libs/asio/test/buffered_read_stream.cpp

    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
    old new void test_sync_operations()  
    9393      boost::asio::buffer(read_buf), error);
    9494
    9595  BOOST_CHECK(bytes_read == 0);
     96#ifdef __VMS
     97  // OS bug
     98  BOOST_CHECK(error == boost::asio::error::eof || error == boost::system::errc::broken_pipe);
     99#else
    96100  BOOST_CHECK(error == boost::asio::error::eof);
     101#endif
    97102
    98103  client_socket.close(error);
    99104}
    void handle_read(const boost::system::er  
    126131void handle_read_eof(const boost::system::error_code& e,
    127132    std::size_t bytes_transferred)
    128133{
     134#ifdef __VMS
     135  // OS bug
     136  BOOST_CHECK(e == boost::asio::error::eof || e == boost::system::errc::broken_pipe);
     137#else
    129138  BOOST_CHECK(e == boost::asio::error::eof);
     139#endif
    130140  BOOST_CHECK(bytes_transferred == 0);
    131141}
    132142
  • libs/asio/test/buffered_stream.cpp

    diff -rupN boost_1_43_0/libs/asio/test/buffered_stream.cpp boost_vms_1_43_0/libs/asio/test/buffered_stream.cpp
    old new void test_sync_operations()  
    9595      boost::asio::buffer(read_buf), error);
    9696
    9797  BOOST_CHECK(bytes_read == 0);
     98#ifdef __VMS
     99  // OS bug
     100  BOOST_CHECK(error == boost::asio::error::eof || error == boost::system::errc::broken_pipe);
     101#else
    98102  BOOST_CHECK(error == boost::asio::error::eof);
    99 
     103#endif
    100104  client_socket.close(error);
    101105}
    102106
    void handle_read(const boost::system::er  
    133137void handle_read_eof(const boost::system::error_code& e,
    134138    std::size_t bytes_transferred)
    135139{
     140#ifdef __VMS
     141  // OS bug
     142  BOOST_CHECK(e == boost::asio::error::eof || e == boost::system::errc::broken_pipe);
     143#else
    136144  BOOST_CHECK(e == boost::asio::error::eof);
     145#endif
    137146  BOOST_CHECK(bytes_transferred == 0);
    138147}
    139148
  • libs/asio/test/buffered_write_stream.cpp

    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
    old new void test_sync_operations()  
    9595      boost::asio::buffer(read_buf), error);
    9696
    9797  BOOST_CHECK(bytes_read == 0);
     98#ifdef __VMS
     99  // OS bug
     100  BOOST_CHECK(error == boost::asio::error::eof || error == boost::system::errc::broken_pipe);
     101#else
    98102  BOOST_CHECK(error == boost::asio::error::eof);
     103#endif
    99104
    100105  client_socket.close(error);
    101106}
    void handle_read(const boost::system::er  
    133138void handle_read_eof(const boost::system::error_code& e,
    134139    std::size_t bytes_transferred)
    135140{
     141#ifdef __VMS
     142  // OS bug
     143  BOOST_CHECK(e == boost::asio::error::eof || e == boost::system::errc::broken_pipe);
     144#else
    136145  BOOST_CHECK(e == boost::asio::error::eof);
     146#endif
    137147  BOOST_CHECK(bytes_transferred == 0);
    138148}
    139149
  • libs/asio/test/ip/tcp.cpp

    diff -rupN boost_1_43_0/libs/asio/test/ip/tcp.cpp boost_vms_1_43_0/libs/asio/test/ip/tcp.cpp
    old new void handle_read_eof(const boost::system  
    359359    size_t bytes_transferred, bool* called)
    360360{
    361361  *called = true;
     362  #ifdef __VMS
     363  // OpenVMS recvmsg / sendmsg repots sometimes broken_pipe
     364  // instead of eof... Bad but this is OS's bug
     365  BOOST_CHECK(err == boost::asio::error::eof || err == boost::system::errc::broken_pipe);
     366  #else
    362367  BOOST_CHECK(err == boost::asio::error::eof);
     368  #endif
    363369  BOOST_CHECK(bytes_transferred == 0);
    364370}
    365371