3 typedef struct s_entry
\r
16 {"E2BIG", E2BIG, "Argument list too long."},
\r
20 {"EACCES", EACCES, "Permission denied."},
\r
24 {"EADDRINUSE", EADDRINUSE, "Address in use."},
\r
27 #ifdef EADDRNOTAVAIL
\r
28 {"EADDRNOTAVAIL", EADDRNOTAVAIL, "Address not available."},
\r
32 {"EAFNOSUPPORT", EAFNOSUPPORT, "Address family not supported."},
\r
36 {"EAGAIN", EAGAIN, "Resource unavailable, try again."},
\r
40 {"EALREADY", EALREADY, "Connection already in progress."},
\r
44 {"EBADF", EBADF, "Bad file descriptor."},
\r
48 {"EBADMSG", EBADMSG, "Bad message."},
\r
52 {"EBUSY", EBUSY, "Device or resource busy."},
\r
56 {"ECANCELED", ECANCELED, "Operation canceled."},
\r
60 {"ECHILD", ECHILD, "No child processes."},
\r
64 {"ECONNABORTED", ECONNABORTED, "Connection aborted."},
\r
68 {"ECONNREFUSED", ECONNREFUSED, "Connection refused."},
\r
72 {"ECONNRESET", ECONNRESET, "Connection reset."},
\r
76 {"EDEADLK", EDEADLK, "Resource deadlock would occur."},
\r
80 {"EDESTADDRREQ", EDESTADDRREQ, "Destination address required."},
\r
84 {"EDOM", EDOM, "Mathematics argument out of domain of function."},
\r
88 {"EEXIST", EEXIST, "File exists."},
\r
92 {"EFAULT", EFAULT, "Bad address."},
\r
96 {"EFBIG", EFBIG, "File too large."},
\r
100 {"EHOSTUNREACH", EHOSTUNREACH, "Host is unreachable."},
\r
104 {"EIDRM", EIDRM, "Identifier removed."},
\r
108 {"EILSEQ", EILSEQ, "Illegal byte sequence."},
\r
112 {"EINPROGRESS", EINPROGRESS, "Operation in progress."},
\r
116 {"EINTR", EINTR, "Interrupted function."},
\r
120 {"EINVAL", EINVAL, "Invalid argument."},
\r
124 {"EIO", EIO, "I/O error."},
\r
128 {"EISCONN", EISCONN, "Socket is connected."},
\r
132 {"EISDIR", EISDIR, "Is a directory."},
\r
136 {"ELOOP", ELOOP, "Too many levels of symbolic links."},
\r
140 {"EMFILE", EMFILE, "Too many open files."},
\r
144 {"EMLINK", EMLINK, "Too many links."},
\r
148 {"EMSGSIZE", EMSGSIZE, "Message too large."},
\r
151 #ifdef ENAMETOOLONG
\r
152 {"ENAMETOOLONG", ENAMETOOLONG, "Filename too long."},
\r
156 {"ENETDOWN", ENETDOWN, "Network is down."},
\r
160 {"ENETRESET", ENETRESET, "Connection aborted by network."},
\r
164 {"ENETUNREACH", ENETUNREACH, "Network unreachable."},
\r
168 {"ENFILE", ENFILE, "Too many files open in system."},
\r
172 {"ENOBUFS", ENOBUFS, "No buffer space available."},
\r
176 {"ENODATA", ENODATA, "No message is available on the STREAM head read queue."},
\r
180 {"ENODEV", ENODEV, "No such device."},
\r
184 {"ENOENT", ENOENT, "No such file or directory."},
\r
188 {"ENOEXEC", ENOEXEC, "Executable file format error."},
\r
192 {"ENOLCK", ENOLCK, "No locks available."},
\r
196 {"ENOMEM", ENOMEM, "Not enough space."},
\r
200 {"ENOMSG", ENOMSG, "No message of the desired type."},
\r
204 {"ENOPROTOOPT", ENOPROTOOPT, "Protocol not available."},
\r
208 {"ENOSPC", ENOSPC, "No space left on device."},
\r
212 {"ENOSR", ENOSR, "No stream resources."},
\r
216 {"ENOSTR", ENOSTR, "Not a stream."},
\r
220 {"ENOSYS", ENOSYS, "Function not supported."},
\r
224 {"ENOTCONN", ENOTCONN, "The socket is not connected."},
\r
228 {"ENOTDIR", ENOTDIR, "Not a directory."},
\r
232 {"ENOTEMPTY", ENOTEMPTY, "Directory not empty."},
\r
236 {"ENOTSOCK", ENOTSOCK, "Not a socket."},
\r
240 {"ENOTSUP", ENOTSUP, "Not supported."},
\r
244 {"ENOTTY", ENOTTY, "Inappropriate I/O control operation."},
\r
248 {"ENXIO", ENXIO, "No such device or address."},
\r
252 {"EOPNOTSUPP", EOPNOTSUPP, "Operation not supported on socket."},
\r
256 {"EOVERFLOW", EOVERFLOW, "Value too large to be stored in data type."},
\r
260 {"EPERM", EPERM, "Operation not permitted."},
\r
264 {"EPIPE", EPIPE, "Broken pipe."},
\r
268 {"EPROTO", EPROTO, "Protocol error."},
\r
271 #ifdef EPROTONOSUPPORT
\r
272 {"EPROTONOSUPPORT", EPROTONOSUPPORT, "Protocol not supported."},
\r
276 {"EPROTOTYPE", EPROTOTYPE, "Protocol wrong type for socket."},
\r
280 {"ERANGE", ERANGE, "Result too large."},
\r
284 {"EROFS", EROFS, "Read-only file system."},
\r
288 {"ESPIPE", ESPIPE, "Invalid seek."},
\r
292 {"ESRCH", ESRCH, "No such process."},
\r
296 {"ETIME", ETIME, "Stream ioctl() timeout."},
\r
300 {"ETIMEDOUT", ETIMEDOUT, "Connection timed out."},
\r
304 {"ETXTBSY", ETXTBSY, "Text file busy."},
\r
308 {"EWOULDBLOCK", EWOULDBLOCK, "Operation would block ."},
\r
312 {"EXDEV", EXDEV, "Cross-device link ."},
\r
315 {"ECMDTIMEDOUT", ECMDTIMEDOUT, "Command timed out"},
\r
317 {"EEXEC", EEXEC, "can't execute a command"},
\r
318 {"EWAIT", EWAIT, "wait function failed"},
\r
319 {"ECMDNOTFOUND", ECMDNOTFOUND, "command is not found"},
\r
320 {"EEXITCODENOTMATCH", EEXITCODENOTMATCH, "Exit code does not match"},
\r
321 {"EOUTPUTNOTMATCH", EOUTPUTNOTMATCH, "Output does not match"},
\r
322 {"ESIGNOTMATCH", ESIGNOTMATCH, "Signal does not match"},
\r
323 {"EUNXPSIG", EUNXPSIG, "Unexpected signal caught"},
\r
324 {"ESIGNOTRECEIPT", ESIGNOTRECEIPT, "Expected signal not receipt"},
\r
325 {"EFILENOTFOUND", EFILENOTFOUND, "specified tesh file not found"},
\r
326 {"EGETCWD", EGETCWD, "system error : the getcwd() function failed"},
\r
327 {"EDIRNOTFOUND", EDIRNOTFOUND, "specified directory not found"},
\r
328 {"EPROCCMDLINE", EPROCCMDLINE, "process_command_line() failed : internal error"},
\r
329 {"ENOARG", ENOARG, "none optional argument not specified"},
\r
330 {"ENOTPOSITIVENUM", ENOTPOSITIVENUM, "argument option not strictly positive"},
\r
331 {"ESYNTAX", ESYNTAX, "Syntax error"},
\r
332 {"EINVALIDTIMEOUT", EINVALIDTIMEOUT, "timeout value specified by metacommand invalid"},
\r
333 {"EINVALIDEXITCODE", EINVALIDEXITCODE, "expected exit code value specified by the metacommand invalid"},
\r
334 {"ESIGNOTSUPP", ESIGNOTSUPP, "signal specified by the metacommand not supported (Windows specific)"},
\r
335 {"ELEADTIME", ELEADTIME, "lead time"},
\r
336 {"EREADMENOTFOUND", EREADMENOTFOUND, "unable to locate the README.txt file"},
\r
337 {"EINCLUDENOTFOUND", EINCLUDENOTFOUND, "include file specified by a metacommand is not found"},
\r
338 {"ESUFFIXTOOLONG", ESUFFIXTOOLONG, "suffix is too long"},
\r
339 {"EFILENOTINSPECDIR", EFILENOTINSPECDIR,"file not found in the specified directories"},
\r
340 {"EFILENOTINCURDIR", EFILENOTINCURDIR,"file not found in the current directory"},
\r
341 {"EINVCMDLINE", EINVCMDLINE, "invalid command line"},
\r
342 {"unkwown", -1, "unknown"}
\r
349 w32error_to_string(DWORD errcode)
\r
351 static char buffer[128];
\r
354 * Special code for winsock error handling.
\r
356 if (errcode > WSABASEERR)
\r
358 HMODULE hModule = GetModuleHandle("wsock32");
\r
362 FormatMessage(FORMAT_MESSAGE_FROM_HMODULE,hModule, errcode, LANG_NEUTRAL, buffer, 128, NULL);
\r
363 FreeLibrary(hModule);
\r
369 * Default system message handling
\r
371 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, errcode, LANG_NEUTRAL, buffer, 128, NULL);
\r
379 error_to_string(int errcode)
\r
383 for(i = 0; err[i].code != -1; i++)
\r
384 if(err[i].code == errcode)
\r
385 return err[i].string;
\r
388 return w32error_to_string((DWORD)errcode);
\r
390 return "unknow error";
\r
396 error_get_at(int pos, int* code)
\r
398 if(pos < 0 || (pos > (sizeof(err)/sizeof(entry_t)) - 2))
\r
404 *code = err[pos].code;
\r
405 return err[pos].name;
\r
409 error_register(const char* reason, int errcode, const char* command, const char* unit)
\r
413 xbt_os_mutex_acquire(err_mutex);
\r
416 exit_code = errcode;
\r
418 error = xbt_new0(s_xerror_t, 1);
\r
420 error->reason = reason;
\r
421 error->command = command;
\r
422 error->unit = unit;
\r
423 error->errcode = errcode;
\r
425 xbt_dynar_push(errors, &error);
\r
427 xbt_os_mutex_release(err_mutex);
\r