mirror of
https://github.com/zeromq/libzmq.git
synced 2025-02-21 22:56:22 +01:00
POSIX error codes unsupported on win platform faked
This commit is contained in:
parent
e136d923b7
commit
a0db7f6b81
@ -24,6 +24,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
// Microsoft Visual Studio uses non-standard way to export/import symbols.
|
// Microsoft Visual Studio uses non-standard way to export/import symbols.
|
||||||
@ -43,9 +44,18 @@ extern "C" {
|
|||||||
// different OSes. The assumption is that error_t is at least 32-bit type.
|
// different OSes. The assumption is that error_t is at least 32-bit type.
|
||||||
#define ZMQ_HAUSNUMERO 156384712
|
#define ZMQ_HAUSNUMERO 156384712
|
||||||
|
|
||||||
#define EMTHREAD (ZMQ_HAUSNUMERO + 1)
|
// On Windows platform some of the standard POSIX errnos are not defined.
|
||||||
#define EFSM (ZMQ_HAUSNUMERO + 2)
|
#ifndef ENOTSUP
|
||||||
#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 3)
|
#define ENOTSUP (ZMQ_HAUSNUMERO + 1)
|
||||||
|
#endif
|
||||||
|
#ifndef EPROTONOSUPPORT
|
||||||
|
#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Native 0MQ error codes.
|
||||||
|
#define EMTHREAD (ZMQ_HAUSNUMERO + 50)
|
||||||
|
#define EFSM (ZMQ_HAUSNUMERO + 51)
|
||||||
|
#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52)
|
||||||
|
|
||||||
// Resolves system errors and 0MQ errors to human-readable string.
|
// Resolves system errors and 0MQ errors to human-readable string.
|
||||||
ZMQ_EXPORT const char *zmq_strerror (int errnum);
|
ZMQ_EXPORT const char *zmq_strerror (int errnum);
|
||||||
|
13
src/zmq.cpp
13
src/zmq.cpp
@ -39,6 +39,12 @@
|
|||||||
const char *zmq_strerror (int errnum_)
|
const char *zmq_strerror (int errnum_)
|
||||||
{
|
{
|
||||||
switch (errnum_) {
|
switch (errnum_) {
|
||||||
|
#if defined ZMQ_HAVE_WINDOWS
|
||||||
|
case ENOTSUP:
|
||||||
|
return "Not supported";
|
||||||
|
case EPROTONOSUPPORT:
|
||||||
|
return "Protocol not supported";
|
||||||
|
#endif
|
||||||
case EMTHREAD:
|
case EMTHREAD:
|
||||||
return "Number of preallocated application threads exceeded";
|
return "Number of preallocated application threads exceeded";
|
||||||
case EFSM:
|
case EFSM:
|
||||||
@ -46,7 +52,14 @@ const char *zmq_strerror (int errnum_)
|
|||||||
case ENOCOMPATPROTO:
|
case ENOCOMPATPROTO:
|
||||||
return "The protocol is not compatible with the socket type";
|
return "The protocol is not compatible with the socket type";
|
||||||
default:
|
default:
|
||||||
|
#if defined _MSC_VER
|
||||||
|
#pragma warning (push)
|
||||||
|
#pragma warning (disable:4996)
|
||||||
|
#endif
|
||||||
return strerror (errnum_);
|
return strerror (errnum_);
|
||||||
|
#if defined _MSC_VER
|
||||||
|
#pragma warning (pop)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user