10 #if defined ZMQ_HAVE_WINDOWS
12 return "Not supported";
14 return "Protocol not supported";
16 return "No buffer space available";
18 return "Network is down";
20 return "Address in use";
22 return "Address not available";
24 return "Connection refused";
26 return "Operation in progress";
29 return "Operation cannot be accomplished in current state";
31 return "The protocol is not compatible with the socket type";
33 return "Context was terminated";
35 return "No thread available";
37 return "Host unreachable";
41 #pragma warning(disable : 4996)
52 #if defined ZMQ_HAVE_WINDOWS
55 ULONG_PTR extra_info[1];
56 extra_info[0] = (ULONG_PTR) errmsg_;
57 RaiseException (0x40000015, EXCEPTION_NONCONTINUABLE, 1, extra_info);
65 #ifdef ZMQ_HAVE_WINDOWS
67 const char *zmq::wsa_error ()
69 return wsa_error_no (WSAGetLastError (),
NULL);
72 const char *zmq::wsa_error_no (
int no_,
const char *wsae_wouldblock_string_)
81 return "Interrupted system call";
83 return "Bad file number";
85 return "Permission denied";
89 return "Invalid argument";
91 return "Too many open files";
93 return wsae_wouldblock_string_;
95 return "Operation now in progress";
97 return "Operation already in progress";
99 return "Socket operation on non-socket";
100 case WSAEDESTADDRREQ:
101 return "Destination address required";
103 return "Message too long";
105 return "Protocol wrong type for socket";
107 return "Bas protocol option";
108 case WSAEPROTONOSUPPORT:
109 return "Protocol not supported";
110 case WSAESOCKTNOSUPPORT:
111 return "Socket type not supported";
113 return "Operation not supported on socket";
114 case WSAEPFNOSUPPORT:
115 return "Protocol family not supported";
116 case WSAEAFNOSUPPORT:
117 return "Address family not supported by protocol family";
119 return "Address already in use";
120 case WSAEADDRNOTAVAIL:
121 return "Can't assign requested address";
123 return "Network is down";
125 return "Network is unreachable";
127 return "Net dropped connection or reset";
128 case WSAECONNABORTED:
129 return "Software caused connection abort";
131 return "Connection reset by peer";
133 return "No buffer space available";
135 return "Socket is already connected";
137 return "Socket is not connected";
139 return "Can't send after socket shutdown";
140 case WSAETOOMANYREFS:
141 return "Too many references can't splice";
143 return "Connection timed out";
144 case WSAECONNREFUSED:
145 return "Connection refused";
147 return "Too many levels of symbolic links";
148 case WSAENAMETOOLONG:
149 return "File name too long";
151 return "Host is down";
152 case WSAEHOSTUNREACH:
153 return "No Route to Host";
155 return "Directory not empty";
157 return "Too many processes";
159 return "Too many users";
161 return "Disc Quota Exceeded";
163 return "Stale NFS file handle";
165 return "Too many levels of remote in path";
167 return "Network SubSystem is unavailable";
168 case WSAVERNOTSUPPORTED:
169 return "WINSOCK DLL Version out of range";
170 case WSANOTINITIALISED:
171 return "Successful WSASTARTUP not yet performed";
172 case WSAHOST_NOT_FOUND:
173 return "Host not found";
175 return "Non-Authoritative Host not found";
177 return "Non-Recoverable errors: FORMERR REFUSED NOTIMP";
179 return "Valid name no data record of requested";
181 return "error not defined";
185 void zmq::win_error (
char *
buffer_,
size_t buffer_size_)
187 const DWORD errcode = GetLastError ();
188 #if defined _WIN32_WCE
189 DWORD rc = FormatMessageW (
190 FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errcode,
191 MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)
buffer_,
192 buffer_size_ /
sizeof (
wchar_t),
NULL);
194 const DWORD rc = FormatMessageA (
195 FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, errcode,
196 MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
buffer_,
197 static_cast<DWORD
> (buffer_size_),
NULL);
202 int zmq::wsa_error_to_errno (
int errcode_)
236 case WSAEDESTADDRREQ:
248 case WSAEPROTONOSUPPORT:
251 case WSAESOCKTNOSUPPORT:
257 case WSAEPFNOSUPPORT:
260 case WSAEAFNOSUPPORT:
266 case WSAEADDRNOTAVAIL:
278 case WSAECONNABORTED:
296 case WSAETOOMANYREFS:
302 case WSAECONNREFUSED:
308 case WSAENAMETOOLONG:
314 case WSAEHOSTUNREACH:
338 case WSAVERNOTSUPPORTED:
341 case WSANOTINITIALISED:
344 case WSAHOST_NOT_FOUND:
364 #if defined(HAVE_LIBUNWIND) && !defined(__SUNPRO_CC)
366 #define UNW_LOCAL_ONLY
367 #include <libunwind.h>
379 unsigned frame_n = 0;
381 unw_getcontext (&ctx);
382 unw_init_local (&cursor, &ctx);
384 while (unw_step (&cursor) > 0) {
386 unw_proc_info_t p_info;
387 static const char unknown[] =
"?";
388 const char *file_name;
389 char *demangled_name;
390 char func_name[256] =
"";
394 if (unw_get_proc_info (&cursor, &p_info))
397 rc = unw_get_proc_name (&cursor, func_name, 256, &
offset);
398 if (rc == -UNW_ENOINFO)
399 memcpy (func_name, unknown,
sizeof unknown);
401 addr = (
void *) (p_info.start_ip +
offset);
403 if (dladdr (addr, &dl_info) && dl_info.dli_fname)
404 file_name = dl_info.dli_fname;
408 demangled_name = abi::__cxa_demangle (func_name,
NULL,
NULL, &rc);
410 printf (
"#%u %p in %s (%s+0x%lx)\n", frame_n++, addr, file_name,
411 rc ? func_name : demangled_name, (
unsigned long)
offset);
412 free (demangled_name);