Ticket #2958: boost_1_38_0.asio.vxworks.patch

File boost_1_38_0.asio.vxworks.patch, 8.1 KB (added by Dustin Spicuzza <dustin@…>, 14 years ago)
  • boost/asio/detail/descriptor_ops.hpp

    diff -r -u boost_1_38_0/boost/asio/detail/descriptor_ops.hpp boost_1_38_vxworks/boost/asio/detail/descriptor_ops.hpp
    old new  
    5050inline int open(const char* path, int flags, boost::system::error_code& ec)
    5151{
    5252  clear_error(ec);
     53#if defined(__VXWORKS__) && defined(_WRS_KERNEL)
     54  return error_wrapper(::open(path, flags, 0), ec);
     55#else
    5356  return error_wrapper(::open(path, flags), ec);
     57#endif
    5458}
    5559
    5660inline int close(int d, boost::system::error_code& ec)
     
    9599    boost::system::error_code& ec)
    96100{
    97101  clear_error(ec);
     102#if defined(__VXWORKS__)
     103  return error_wrapper(::writev(d, const_cast<buf*>(bufs), static_cast<int>(count)), ec);
     104#else
    98105  return error_wrapper(::writev(d, bufs, static_cast<int>(count)), ec);
     106#endif
    99107}
    100108
    101109inline int ioctl(int d, long cmd, ioctl_arg_type* arg,
    102110    boost::system::error_code& ec)
    103111{
    104112  clear_error(ec);
     113#if defined(__VXWORKS__) && defined(_WRS_KERNEL)
     114  return error_wrapper(::ioctl(d, cmd, (int)arg), ec);
     115#else
    105116  return error_wrapper(::ioctl(d, cmd, arg), ec);
     117#endif
    106118}
    107119
    108120inline int fcntl(int d, long cmd, boost::system::error_code& ec)
  • boost/asio/detail/pipe_select_interrupter.hpp

    diff -r -u boost_1_38_0/boost/asio/detail/pipe_select_interrupter.hpp boost_1_38_vxworks/boost/asio/detail/pipe_select_interrupter.hpp
    old new  
    2323#include <boost/system/system_error.hpp>
    2424#include <boost/asio/detail/pop_options.hpp>
    2525
    26 #if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
     26#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) && !defined(__VXWORKS__)
    2727
    2828#include <boost/asio/detail/push_options.hpp>
    2929#include <fcntl.h>
  • boost/asio/detail/select_interrupter.hpp

    Only in boost_1_38_vxworks/boost/asio/detail: pipe_select_interrupter.hpp.rej
    diff -r -u boost_1_38_0/boost/asio/detail/select_interrupter.hpp boost_1_38_vxworks/boost/asio/detail/select_interrupter.hpp
    old new  
    2929namespace asio {
    3030namespace detail {
    3131
    32 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
     32#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) || defined(__VXWORKS__)
    3333typedef socket_select_interrupter select_interrupter;
    3434#elif defined(BOOST_ASIO_HAS_EVENTFD)
    3535typedef eventfd_select_interrupter select_interrupter;
  • boost/asio/detail/socket_ops.hpp

    Only in boost_1_38_vxworks/boost/asio/detail: select_interrupter.hpp.rej
    diff -r -u boost_1_38_0/boost/asio/detail/socket_ops.hpp boost_1_38_vxworks/boost/asio/detail/socket_ops.hpp
    old new  
    4040struct msghdr { int msg_namelen; };
    4141#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
    4242
     43#if defined(__VXWORKS__)
     44  // vxworks has strange function definitions, uses int instead of socklen_t (which is unsigned)
     45# define SockLenTypeImpl int
     46#else
     47# define SockLenTypeImpl SockLenType
     48#endif
     49
     50
    4351#if defined(__hpux)
    4452// HP-UX doesn't declare these functions extern "C", so they are declared again
    4553// here to avoid linker errors about undefined symbols.
     
    7583inline socket_type call_accept(SockLenType msghdr::*,
    7684    socket_type s, socket_addr_type* addr, std::size_t* addrlen)
    7785{
    78   SockLenType tmp_addrlen = addrlen ? (SockLenType)*addrlen : 0;
     86  SockLenTypeImpl tmp_addrlen = addrlen ? (SockLenTypeImpl)*addrlen : 0;
    7987  socket_type result = ::accept(s, addr, addrlen ? &tmp_addrlen : 0);
    8088  if (addrlen)
    8189    *addrlen = (std::size_t)tmp_addrlen;
     
    114122inline int call_bind(SockLenType msghdr::*,
    115123    socket_type s, const socket_addr_type* addr, std::size_t addrlen)
    116124{
    117   return ::bind(s, addr, (SockLenType)addrlen);
     125  return ::bind(s, const_cast<socket_addr_type*>(addr), (SockLenTypeImpl)addrlen);
    118126}
    119127
    120128inline int bind(socket_type s, const socket_addr_type* addr,
     
    158166inline int call_connect(SockLenType msghdr::*,
    159167    socket_type s, const socket_addr_type* addr, std::size_t addrlen)
    160168{
    161   return ::connect(s, addr, (SockLenType)addrlen);
     169  return ::connect(s, const_cast<socket_addr_type*>(addr), (SockLenTypeImpl)addrlen);
    162170}
    163171
    164172inline int connect(socket_type s, const socket_addr_type* addr,
     
    177185inline int socketpair(int af, int type, int protocol,
    178186    socket_type sv[2], boost::system::error_code& ec)
    179187{
    180 #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
     188#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) || defined(__VXWORKS__)
    181189  (void)(af);
    182190  (void)(type);
    183191  (void)(protocol);
     
    418426    socket_type s, int level, int optname,
    419427    const void* optval, std::size_t optlen)
    420428{
     429#if defined(__VXWORKS__)
    421430  return ::setsockopt(s, level, optname,
    422       (const char*)optval, (SockLenType)optlen);
     431      (char*)optval, (SockLenTypeImpl)optlen);
     432#else
     433  return ::setsockopt(s, level, optname,
     434      (const char*)optval, (SockLenTypeImpl)optlen);
     435#endif // defined(__VXWORKS__)
    423436}
    424437
    425438inline int setsockopt(socket_type s, int level, int optname,
     
    465478    socket_type s, int level, int optname,
    466479    void* optval, std::size_t* optlen)
    467480{
    468   SockLenType tmp_optlen = (SockLenType)*optlen;
     481  SockLenTypeImpl tmp_optlen = (SockLenTypeImpl)*optlen;
    469482  int result = ::getsockopt(s, level, optname, (char*)optval, &tmp_optlen);
    470483  *optlen = (std::size_t)tmp_optlen;
    471484  return result;
     
    552565inline int call_getpeername(SockLenType msghdr::*,
    553566    socket_type s, socket_addr_type* addr, std::size_t* addrlen)
    554567{
    555   SockLenType tmp_addrlen = (SockLenType)*addrlen;
     568  SockLenTypeImpl tmp_addrlen = (SockLenTypeImpl)*addrlen;
    556569  int result = ::getpeername(s, addr, &tmp_addrlen);
    557570  *addrlen = (std::size_t)tmp_addrlen;
    558571  return result;
     
    575588inline int call_getsockname(SockLenType msghdr::*,
    576589    socket_type s, socket_addr_type* addr, std::size_t* addrlen)
    577590{
    578   SockLenType tmp_addrlen = (SockLenType)*addrlen;
     591  SockLenTypeImpl tmp_addrlen = (SockLenTypeImpl)*addrlen;
    579592  int result = ::getsockname(s, addr, &tmp_addrlen);
    580593  *addrlen = (std::size_t)tmp_addrlen;
    581594  return result;
     
    603616  if (result == 0)
    604617    clear_error(ec);
    605618  return result;
    606 #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
     619#elif defined(__VXWORKS__) && defined(_WRS_KERNEL)
     620  return error_wrapper(::ioctl(s, cmd, (int)arg), ec);
     621#else // defined(__VXWORKS__)
    607622  return error_wrapper(::ioctl(s, cmd, arg), ec);
    608 #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
     623#endif
    609624}
    610625
    611626inline int select(int nfds, fd_set* readfds, fd_set* writefds,
  • boost/asio/detail/socket_types.hpp

    diff -r -u boost_1_38_0/boost/asio/detail/socket_types.hpp boost_1_38_vxworks/boost/asio/detail/socket_types.hpp
    old new  
    9292#  endif // defined(_MSC_VER) || defined(__BORLANDC__)
    9393# endif // !defined(BOOST_ASIO_NO_DEFAULT_LINKED_LIBS)
    9494# include <boost/asio/detail/old_win_sdk_compat.hpp>
     95#elif defined(__VXWORKS__)
     96# include <sys/ioctl.h>
     97# include <poll.h>
     98# include <sys/types.h>
     99# include <selectLib.h>
     100# include <sys/socket.h>
     101# include <sockLib.h>
     102# include <ioLib.h>
     103# include <hostLib.h>
     104# include <net/uio.h>
     105# include <sys/un.h>
     106# include <netinet/in.h>
     107# include <netinet/tcp.h>
     108# include <arpa/inet.h>
     109# include <netdb.h>
     110# include <net/if.h>
     111# include <limits.h>
     112// vxworks has some really braindead macros defined
     113#ifdef m_flags
     114#       undef m_flags
     115#endif
     116#ifdef m_data
     117#       undef m_data
     118#endif
     119
    95120#else
    96121# include <sys/ioctl.h>
    97122# include <sys/poll.h>