30 #ifndef __ZMQ_ERR_HPP_INCLUDED__ 31 #define __ZMQ_ERR_HPP_INCLUDED__ 34 #if defined _WIN32_WCE 35 #include "..\builds\msvc\errno.hpp" 43 #include "platform.hpp" 45 #ifdef ZMQ_HAVE_WINDOWS 54 #include "../include/zmq.h" 68 #ifdef ZMQ_HAVE_WINDOWS 72 const char *wsa_error ();
73 const char *wsa_error_no (
int no_);
74 void win_error (
char *buffer_,
size_t buffer_size_);
75 int wsa_error_to_errno (
int errcode);
79 #define wsa_assert(x) \ 81 if (unlikely (!(x))) {\ 82 const char *errstr = zmq::wsa_error ();\ 83 if (errstr != NULL) {\ 84 fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \ 86 zmq::zmq_abort (errstr);\ 92 #define wsa_assert_no(no) \ 94 const char *errstr = zmq::wsa_error_no (no);\ 95 if (errstr != NULL) {\ 96 fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \ 98 zmq::zmq_abort (errstr);\ 103 #define win_assert(x) \ 105 if (unlikely (!(x))) {\ 107 zmq::win_error (errstr, 256);\ 108 fprintf (stderr, "Assertion failed: %s (%s:%d)\n", errstr, \ 109 __FILE__, __LINE__);\ 110 zmq::zmq_abort (errstr);\ 119 #define zmq_assert(x) \ 121 if (unlikely (!(x))) {\ 122 fprintf (stderr, "Assertion failed: %s (%s:%d)\n", #x, \ 123 __FILE__, __LINE__);\ 124 zmq::zmq_abort (#x);\ 129 #define errno_assert(x) \ 131 if (unlikely (!(x))) {\ 132 const char *errstr = strerror (errno);\ 133 fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\ 134 zmq::zmq_abort (errstr);\ 139 #define posix_assert(x) \ 142 const char *errstr = strerror (x);\ 143 fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\ 144 zmq::zmq_abort (errstr);\ 149 #define gai_assert(x) \ 152 const char *errstr = gai_strerror (x);\ 153 fprintf (stderr, "%s (%s:%d)\n", errstr, __FILE__, __LINE__);\ 154 zmq::zmq_abort (errstr);\ 159 #define alloc_assert(x) \ 161 if (unlikely (!x)) {\ 162 fprintf (stderr, "FATAL ERROR: OUT OF MEMORY (%s:%d)\n",\ 163 __FILE__, __LINE__);\ 164 zmq::zmq_abort ("FATAL ERROR: OUT OF MEMORY");\
void zmq_abort(const char *errmsg_)
void print_backtrace(void)
const char * errno_to_string(int errno_)