mirror of
https://github.com/zeromq/libzmq.git
synced 2025-02-24 07:21:32 +01:00
Merge pull request #517 from SRombauts/master
Windows CE support : using standard _WIN32_WCE flag instead of WINCE
This commit is contained in:
commit
ccf2b9b466
@ -1,4 +1,4 @@
|
||||
#if defined WINCE
|
||||
#if defined _WIN32_WCE
|
||||
|
||||
//#include "..\..\include\zmq.h"
|
||||
#include "..\..\src\err.hpp"
|
||||
|
@ -13,7 +13,7 @@
|
||||
//#define ECHILD 10
|
||||
#define EAGAIN 11
|
||||
//#define ENOMEM 12
|
||||
//#define EACCES 13
|
||||
#define EACCES 13
|
||||
#define EFAULT 14
|
||||
//#define EOSERR 15 // rk
|
||||
//#define EBUSY 16
|
||||
|
@ -27,7 +27,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined WINCE
|
||||
#if !defined _WIN32_WCE
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined _MSC_VER
|
||||
#if defined WINCE
|
||||
#if defined _WIN32_WCE
|
||||
#include <cmnintrin.h>
|
||||
#else
|
||||
#include <intrin.h>
|
||||
|
@ -203,7 +203,7 @@ const char *zmq::wsa_error_no (int no_)
|
||||
void zmq::win_error (char *buffer_, size_t buffer_size_)
|
||||
{
|
||||
DWORD errcode = GetLastError ();
|
||||
#if defined WINCE
|
||||
#if defined _WIN32_WCE
|
||||
DWORD rc = FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errcode, MAKELANGID(LANG_NEUTRAL,
|
||||
SUBLANG_DEFAULT), (LPWSTR)buffer_, buffer_size_ / sizeof(wchar_t), NULL );
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "../include/zmq.h"
|
||||
|
||||
#include <assert.h>
|
||||
#if defined WINCE
|
||||
#if defined _WIN32_WCE
|
||||
#include "..\builds\msvc\errno.hpp"
|
||||
#else
|
||||
#include <errno.h>
|
||||
|
@ -238,6 +238,8 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
|
||||
return 0;
|
||||
|
||||
#elif defined ZMQ_HAVE_WINDOWS
|
||||
#if !defined _WIN32_WCE
|
||||
// Windows CE does not manage security attributes
|
||||
SECURITY_DESCRIPTOR sd;
|
||||
SECURITY_ATTRIBUTES sa;
|
||||
memset (&sd, 0, sizeof (sd));
|
||||
@ -248,6 +250,7 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
|
||||
|
||||
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
sa.lpSecurityDescriptor = &sd;
|
||||
#endif
|
||||
|
||||
// This function has to be in a system-wide critical section so that
|
||||
// two instances of the library don't accidentally create signaler
|
||||
@ -256,7 +259,11 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
|
||||
// Note that if the event object already exists, the CreateEvent requests
|
||||
// EVENT_ALL_ACCESS access right. If this fails, we try to open
|
||||
// the event object asking for SYNCHRONIZE access only.
|
||||
#if !defined _WIN32_WCE
|
||||
HANDLE sync = CreateEvent (&sa, FALSE, TRUE, TEXT ("Global\\zmq-signaler-port-sync"));
|
||||
#else
|
||||
HANDLE sync = CreateEvent (NULL, FALSE, TRUE, TEXT ("Global\\zmq-signaler-port-sync"));
|
||||
#endif
|
||||
if (sync == NULL && GetLastError () == ERROR_ACCESS_DENIED)
|
||||
sync = OpenEvent (SYNCHRONIZE | EVENT_MODIFY_STATE, FALSE, TEXT ("Global\\zmq-signaler-port-sync"));
|
||||
|
||||
@ -303,9 +310,13 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
|
||||
*w_ = WSASocket (AF_INET, SOCK_STREAM, 0, NULL, 0, 0);
|
||||
wsa_assert (*w_ != INVALID_SOCKET);
|
||||
|
||||
#if !defined _WIN32_WCE
|
||||
// On Windows, preventing sockets to be inherited by child processes.
|
||||
BOOL brc = SetHandleInformation ((HANDLE) *w_, HANDLE_FLAG_INHERIT, 0);
|
||||
win_assert (brc);
|
||||
#else
|
||||
BOOL brc;
|
||||
#endif
|
||||
|
||||
// Set TCP_NODELAY on writer socket.
|
||||
rc = setsockopt (*w_, IPPROTO_TCP, TCP_NODELAY,
|
||||
@ -341,10 +352,11 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
|
||||
win_assert (brc != 0);
|
||||
|
||||
if (*r_ != INVALID_SOCKET) {
|
||||
#if !defined _WIN32_WCE
|
||||
// On Windows, preventing sockets to be inherited by child processes.
|
||||
brc = SetHandleInformation ((HANDLE) *r_, HANDLE_FLAG_INHERIT, 0);
|
||||
win_assert (brc);
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
} else {
|
||||
// Cleanup writer if connection failed
|
||||
|
@ -29,7 +29,7 @@
|
||||
#if defined ZMQ_HAVE_WINDOWS
|
||||
#include "windows.hpp"
|
||||
#if defined _MSC_VER
|
||||
#if defined WINCE
|
||||
#if defined _WIN32_WCE
|
||||
#include <cmnintrin.h>
|
||||
#else
|
||||
#include <intrin.h>
|
||||
|
@ -174,9 +174,11 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
|
||||
errno = wsa_error_to_errno (WSAGetLastError ());
|
||||
return -1;
|
||||
}
|
||||
#if !defined _WIN32_WCE
|
||||
// On Windows, preventing sockets to be inherited by child processes.
|
||||
BOOL brc = SetHandleInformation ((HANDLE) s, HANDLE_FLAG_INHERIT, 0);
|
||||
win_assert (brc);
|
||||
#endif
|
||||
#else
|
||||
if (s == -1)
|
||||
return -1;
|
||||
@ -258,9 +260,11 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
|
||||
WSAGetLastError () == WSAENOBUFS);
|
||||
return retired_fd;
|
||||
}
|
||||
#if !defined _WIN32_WCE
|
||||
// On Windows, preventing sockets to be inherited by child processes.
|
||||
BOOL brc = SetHandleInformation ((HANDLE) sock, HANDLE_FLAG_INHERIT, 0);
|
||||
win_assert (brc);
|
||||
#endif
|
||||
#else
|
||||
if (sock == -1) {
|
||||
errno_assert (errno == EAGAIN || errno == EWOULDBLOCK ||
|
||||
|
@ -43,7 +43,7 @@ void zmq::thread_t::start (thread_fn *tfn_, void *arg_)
|
||||
{
|
||||
tfn = tfn_;
|
||||
arg =arg_;
|
||||
#if defined WINCE
|
||||
#if defined _WIN32_WCE
|
||||
descriptor = (HANDLE) CreateThread (NULL, 0,
|
||||
&::thread_routine, this, 0 , NULL);
|
||||
#else
|
||||
|
@ -170,7 +170,7 @@
|
||||
|
||||
#include <ws2tcpip.h>
|
||||
#include <ipexport.h>
|
||||
#if !defined WINCE
|
||||
#if !defined _WIN32_WCE
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user