mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-06 00:31:13 +01:00
fixes for OpenVMS
This commit is contained in:
parent
a25414e55c
commit
714a8d50a0
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#if defined ZMQ_HAVE_OPENVMS
|
#if defined ZMQ_HAVE_OPENVMS
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
|
#include <unistd.h>
|
||||||
#elif defined ZMQ_HAVE_WINDOWS
|
#elif defined ZMQ_HAVE_WINDOWS
|
||||||
#include "windows.hpp"
|
#include "windows.hpp"
|
||||||
#else
|
#else
|
||||||
|
@ -140,6 +140,10 @@ zmq::fd_t zmq::tcp_connecter_t::connect ()
|
|||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#ifdef ZMQ_HAVE_OPENVMS
|
||||||
|
#include <ioctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
zmq::tcp_connecter_t::tcp_connecter_t () :
|
zmq::tcp_connecter_t::tcp_connecter_t () :
|
||||||
s (retired_fd)
|
s (retired_fd)
|
||||||
{
|
{
|
||||||
@ -176,11 +180,17 @@ int zmq::tcp_connecter_t::open ()
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Set to non-blocking mode.
|
// Set to non-blocking mode.
|
||||||
int flags = fcntl (s, F_GETFL, 0);
|
#ifdef ZMQ_HAVE_OPENVMS
|
||||||
if (flags == -1)
|
int flags = 1;
|
||||||
flags = 0;
|
int rc = ioctl (s, FIONBIO, &flags);
|
||||||
int rc = fcntl (s, F_SETFL, flags | O_NONBLOCK);
|
|
||||||
errno_assert (rc != -1);
|
errno_assert (rc != -1);
|
||||||
|
#else
|
||||||
|
int flags = fcntl (s, F_GETFL, 0);
|
||||||
|
if (flags == -1)
|
||||||
|
flags = 0;
|
||||||
|
int rc = fcntl (s, F_SETFL, flags | O_NONBLOCK);
|
||||||
|
errno_assert (rc != -1);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Disable Nagle's algorithm.
|
// Disable Nagle's algorithm.
|
||||||
int flag = 1;
|
int flag = 1;
|
||||||
@ -215,6 +225,8 @@ int zmq::tcp_connecter_t::open ()
|
|||||||
errno = err;
|
errno = err;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef ZMQ_HAVE_OPENVMS
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// Create the socket.
|
// Create the socket.
|
||||||
@ -243,6 +255,7 @@ int zmq::tcp_connecter_t::open ()
|
|||||||
errno = err;
|
errno = err;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
zmq_assert (false);
|
zmq_assert (false);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -140,7 +140,14 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#ifndef ZMQ_HAVE_OPENVMS
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ZMQ_HAVE_OPENVMS
|
||||||
|
#include <ioctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
zmq::tcp_listener_t::tcp_listener_t () :
|
zmq::tcp_listener_t::tcp_listener_t () :
|
||||||
s (retired_fd)
|
s (retired_fd)
|
||||||
@ -174,11 +181,17 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_)
|
|||||||
errno_assert (rc == 0);
|
errno_assert (rc == 0);
|
||||||
|
|
||||||
// Set the non-blocking flag.
|
// Set the non-blocking flag.
|
||||||
flag = fcntl (s, F_GETFL, 0);
|
#ifdef ZMQ_HAVE_OPENVMS
|
||||||
if (flag == -1)
|
flag = 1;
|
||||||
flag = 0;
|
rc = ioctl (s, FIONBIO, &flag);
|
||||||
rc = fcntl (s, F_SETFL, flag | O_NONBLOCK);
|
|
||||||
errno_assert (rc != -1);
|
errno_assert (rc != -1);
|
||||||
|
#else
|
||||||
|
flag = fcntl (s, F_GETFL, 0);
|
||||||
|
if (flag == -1)
|
||||||
|
flag = 0;
|
||||||
|
rc = fcntl (s, F_SETFL, flag | O_NONBLOCK);
|
||||||
|
errno_assert (rc != -1);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Bind the socket to the network interface and port.
|
// Bind the socket to the network interface and port.
|
||||||
rc = bind (s, (struct sockaddr*) &addr, addr_len);
|
rc = bind (s, (struct sockaddr*) &addr, addr_len);
|
||||||
@ -196,6 +209,7 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#ifndef ZMQ_HAVE_OPENVMS
|
||||||
else if (strcmp (protocol_, "ipc") == 0) {
|
else if (strcmp (protocol_, "ipc") == 0) {
|
||||||
|
|
||||||
// Get rid of the file associated with the UNIX domain socket that
|
// Get rid of the file associated with the UNIX domain socket that
|
||||||
@ -235,6 +249,7 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else {
|
else {
|
||||||
errno = EPROTONOSUPPORT;
|
errno = EPROTONOSUPPORT;
|
||||||
return -1;
|
return -1;
|
||||||
@ -249,6 +264,7 @@ int zmq::tcp_listener_t::close ()
|
|||||||
return -1;
|
return -1;
|
||||||
s = retired_fd;
|
s = retired_fd;
|
||||||
|
|
||||||
|
#ifndef ZMQ_HAVE_OPENVMS
|
||||||
// If there's an underlying UNIX domain socket, get rid of the file it
|
// If there's an underlying UNIX domain socket, get rid of the file it
|
||||||
// is associated with.
|
// is associated with.
|
||||||
struct sockaddr_un *su = (struct sockaddr_un*) &addr;
|
struct sockaddr_un *su = (struct sockaddr_un*) &addr;
|
||||||
@ -257,6 +273,7 @@ int zmq::tcp_listener_t::close ()
|
|||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -299,11 +316,17 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
|
|||||||
errno_assert (sock != -1);
|
errno_assert (sock != -1);
|
||||||
|
|
||||||
// Set to non-blocking mode.
|
// Set to non-blocking mode.
|
||||||
|
#ifdef ZMQ_HAVE_OPENVMS
|
||||||
|
int flags = 1;
|
||||||
|
int rc = ioctl (sock, FIONBIO, &flags);
|
||||||
|
errno_assert (rc != -1);
|
||||||
|
#else
|
||||||
int flags = fcntl (s, F_GETFL, 0);
|
int flags = fcntl (s, F_GETFL, 0);
|
||||||
if (flags == -1)
|
if (flags == -1)
|
||||||
flags = 0;
|
flags = 0;
|
||||||
int rc = fcntl (sock, F_SETFL, flags | O_NONBLOCK);
|
int rc = fcntl (sock, F_SETFL, flags | O_NONBLOCK);
|
||||||
errno_assert (rc != -1);
|
errno_assert (rc != -1);
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sockaddr *sa = (struct sockaddr*) &addr;
|
struct sockaddr *sa = (struct sockaddr*) &addr;
|
||||||
if (AF_UNIX != sa->sa_family) {
|
if (AF_UNIX != sa->sa_family) {
|
||||||
|
29
src/uuid.cpp
29
src/uuid.cpp
@ -97,6 +97,35 @@ const char *zmq::uuid_t::to_string ()
|
|||||||
return string_buf;
|
return string_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif defined ZMQ_HAVE_OPENVMS
|
||||||
|
|
||||||
|
#include <starlet.h>
|
||||||
|
|
||||||
|
#define uuid_generate(x) sys$create_uid(&(x))
|
||||||
|
|
||||||
|
#define uuid_unparse(x, y) \
|
||||||
|
sprintf (y, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", \
|
||||||
|
x.data0, x.data1, x.data2, \
|
||||||
|
x.data3 [0], x.data3 [1], \
|
||||||
|
x.data3 [2], x.data3 [3], \
|
||||||
|
x.data3 [4], x.data3 [5], \
|
||||||
|
x.data3 [6], x.data3 [7]);
|
||||||
|
|
||||||
|
zmq::uuid_t::uuid_t ()
|
||||||
|
{
|
||||||
|
uuid_generate (uuid);
|
||||||
|
uuid_unparse (uuid, string_buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
zmq::uuid_t::~uuid_t ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *zmq::uuid_t::to_string ()
|
||||||
|
{
|
||||||
|
return string_buf;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
11
src/uuid.hpp
11
src/uuid.hpp
@ -30,6 +30,14 @@
|
|||||||
#include <uuid/uuid.h>
|
#include <uuid/uuid.h>
|
||||||
#elif defined ZMQ_HAVE_WINDOWS
|
#elif defined ZMQ_HAVE_WINDOWS
|
||||||
#include <rpc.h>
|
#include <rpc.h>
|
||||||
|
#elif defined ZMQ_HAVE_OPENVMS
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned long data0;
|
||||||
|
unsigned short data1;
|
||||||
|
unsigned short data2;
|
||||||
|
unsigned char data3 [8];
|
||||||
|
} uuid_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace zmq
|
namespace zmq
|
||||||
@ -77,7 +85,8 @@ namespace zmq
|
|||||||
::uuid_t uuid;
|
::uuid_t uuid;
|
||||||
char *string_buf;
|
char *string_buf;
|
||||||
#elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS ||\
|
#elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS ||\
|
||||||
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_CYGWIN
|
defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_CYGWIN ||\
|
||||||
|
defined ZMQ_HAVE_OPENVMS
|
||||||
::uuid_t uuid;
|
::uuid_t uuid;
|
||||||
char string_buf [uuid_string_len + 1];
|
char string_buf [uuid_string_len + 1];
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user