Pull request to merge porting to WindRiver VxWorks 6.x (#2966)

* Problem: Still need to port over more files to VxWorks 6.x

Solution: Port more files to VxWorks 6.x

* Problem: Need to port over remaining files to VxWorks 6.x. Also remove POSIX thread dependency for VxWorks (because of priority inversion problem in POSIX mutexes with VxWorks 6.x processes)

Solution: Port over remaining files to VxWorks 6.x. Also removed POSIX thread dependency for VxWorks

* Problem: Needed to modify TCP, UDP, TIPC classes with #ifdefs to be compatible with VxWorks 6.x.

Solution:  Modify TCP, UDP, TIPC classes with #ifdefs to be compatible with VxWorks 6.x
This commit is contained in:
Manuel Segura
2018-03-10 03:03:02 -08:00
committed by Luca Boccassi
parent 0d23b5ca69
commit 4726f7262d
35 changed files with 809 additions and 60 deletions

View File

@@ -35,6 +35,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#ifdef ZMQ_HAVE_VXWORKS
#include <sockLib.h>
#endif
#endif
#include "udp_engine.hpp"
@@ -128,8 +131,13 @@ void zmq::udp_engine_t::plug (io_thread_t *io_thread_, session_base_t *session_)
errno_assert (rc == 0);
#endif
#ifdef ZMQ_HAVE_VXWORKS
rc = bind (fd, (sockaddr *) address->resolved.udp_addr->bind_addr (),
address->resolved.udp_addr->bind_addrlen ());
#else
rc = bind (fd, address->resolved.udp_addr->bind_addr (),
address->resolved.udp_addr->bind_addrlen ());
#endif
#ifdef ZMQ_HAVE_WINDOWS
wsa_assert (rc != SOCKET_ERROR);
#else
@@ -282,6 +290,10 @@ void zmq::udp_engine_t::out_event ()
rc = sendto (fd, (const char *) out_buffer, (int) size, 0, out_address,
(int) out_addrlen);
wsa_assert (rc != SOCKET_ERROR);
#elif defined ZMQ_HAVE_VXWORKS
rc = sendto (fd, (caddr_t) out_buffer, size, 0,
(sockaddr *) out_address, (int) out_addrlen);
errno_assert (rc != -1);
#else
rc = sendto (fd, out_buffer, size, 0, out_address, out_addrlen);
errno_assert (rc != -1);
@@ -321,6 +333,14 @@ void zmq::udp_engine_t::in_event ()
|| last_error == WSAEWOULDBLOCK);
return;
}
#elif defined ZMQ_HAVE_VXWORKS
int nbytes = recvfrom (fd, (char *) in_buffer, MAX_UDP_MSG, 0,
(sockaddr *) &in_address, (int *) &in_addrlen);
if (nbytes == -1) {
errno_assert (errno != EBADF && errno != EFAULT && errno != ENOMEM
&& errno != ENOTSOCK);
return;
}
#else
int nbytes = recvfrom (fd, in_buffer, MAX_UDP_MSG, 0,
(sockaddr *) &in_address, &in_addrlen);