25 #define LELY_UTIL_ERRNUM_INLINE extern inline 36 #define ERRSTR_SIZE 256 228 #ifdef ENOTRECOVERABLE 243 #if defined(EOPNOTSUPP) && EOPNOTSUPP != ENOTSUP 261 #ifdef EPROTONOSUPPORT 289 #if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN 305 return errc > 0 ? errc : 0;
332 case ERROR_BEGINNING_OF_MEDIA:
return ERRNUM_IO;
347 case ERROR_CANT_RESOLVE_FILENAME:
return ERRNUM_LOOP;
355 case ERROR_DEVICE_DOOR_OPEN:
return ERRNUM_IO;
358 case ERROR_DEVICE_REQUIRES_CLEANING:
return ERRNUM_IO;
365 case ERROR_DISK_CORRUPT:
return ERRNUM_IO;
368 case ERROR_DS_GENERIC_ERROR:
return ERRNUM_IO;
373 #ifdef ERROR_ELEVATION_REQUIRED 377 case ERROR_EOM_OVERFLOW:
return ERRNUM_IO;
384 case ERROR_FILEMARK_DETECTED:
return ERRNUM_IO;
388 #ifdef ERROR_FLOAT_MULTIPLE_FAULTS 389 case ERROR_FLOAT_MULTIPLE_FAULTS:
return ERRNUM_DOM;
391 case ERROR_GEN_FAILURE:
return ERRNUM_IO;
395 #ifdef ERROR_ILLEGAL_CHARACTER 401 case ERROR_INVALID_AT_INTERRUPT_TIME:
return ERRNUM_INTR;
403 case ERROR_INVALID_BLOCK_LENGTH:
return ERRNUM_IO;
432 case ERROR_META_EXPANSION_TOO_LONG:
return ERRNUM_INVAL;
445 case ERROR_NONPAGED_SYSTEM_RESOURCES:
return ERRNUM_AGAIN;
448 case ERROR_NOT_ENOUGH_QUOTA:
return ERRNUM_IO;
456 case ERROR_NO_DATA_DETECTED:
return ERRNUM_IO;
461 case ERROR_NO_SIGNAL_SENT:
return ERRNUM_IO;
462 case ERROR_NO_SYSTEM_RESOURCES:
return ERRNUM_FBIG;
465 case ERROR_OPEN_FAILED:
return ERRNUM_IO;
487 case ERROR_SERVICE_REQUEST_TIMEOUT:
return ERRNUM_BUSY;
488 case ERROR_SETMARK_DETECTED:
return ERRNUM_IO;
489 case ERROR_SHARING_BUFFER_EXCEEDED:
return ERRNUM_NOLCK;
493 case ERROR_SIGNAL_REFUSED:
return ERRNUM_IO;
494 #ifdef ERROR_SYMLINK_NOT_SUPPORTED 502 case ERROR_UNEXP_NET_ERR:
return ERRNUM_IO;
505 case ERROR_WRITE_FAULT:
return ERRNUM_IO;
555 #if _POSIX_C_SOURCE >= 200112L && !defined(__NEWLIB__) 751 #ifdef ENOTRECOVERABLE 784 #ifdef EPROTONOSUPPORT 846 #ifdef ERROR_FLOAT_MULTIPLE_FAULTS 847 case ERRNUM_DOM:
return ERROR_FLOAT_MULTIPLE_FAULTS;
852 case ERRNUM_FBIG:
return ERROR_NO_SYSTEM_RESOURCES;
856 #ifdef ERROR_ILLEGAL_CHARACTER 866 case ERRNUM_LOOP:
return ERROR_CANT_RESOLVE_FILENAME;
928 #if _POSIX_C_SOURCE >= 200112L && !defined(__NEWLIB__) 950 return GetLastError();
969 return strerror(errnum);
977 if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM
978 | FORMAT_MESSAGE_IGNORE_INSERTS,
979 NULL, errc, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
980 errstr,
sizeof(errstr), NULL))
984 size_t n = strlen(errstr);
986 errstr[n - 2] =
'\0';
989 #if _POSIX_C_SOURCE >= 200112L && !defined(__NEWLIB__) 991 case -
ABS(EAI_AGAIN):
return gai_strerror(EAI_AGAIN);
992 case -
ABS(EAI_BADFLAGS):
return gai_strerror(EAI_BADFLAGS);
993 case -
ABS(EAI_FAIL):
return gai_strerror(EAI_FAIL);
994 case -
ABS(EAI_FAMILY):
return gai_strerror(EAI_FAMILY);
995 case -
ABS(EAI_MEMORY):
return gai_strerror(EAI_MEMORY);
996 case -
ABS(EAI_NONAME):
return gai_strerror(EAI_NONAME);
997 case -
ABS(EAI_OVERFLOW):
return gai_strerror(EAI_OVERFLOW);
998 case -
ABS(EAI_SERVICE):
return gai_strerror(EAI_SERVICE);
999 case -
ABS(EAI_SOCKTYPE):
return gai_strerror(EAI_SOCKTYPE);
int errc2no(int errc)
Transforms a native error code to a standard C error number.
File descriptor value too large.
Inappropriate I/O control operation.
The intended socket type was not recognized.
Resource deadlock would occur.
int errnum2c(errnum_t errnum)
Transforms a platform-independent error number to a native error code.
Operation not supported on socket.
This header file is part of the C11 and POSIX compatibility library; it includes <string.h> and defines any missing functionality.
No buffer space available.
Mathematics argument out of domain of function.
Too many levels of symbolic links.
The address family was not recognized or the address length was invalid for the specified family...
Too many files open in system.
Executable file format error.
const char * errc2str(int errc)
Returns a string describing a native error code.
Connection already in progress.
This header file is part of the utilities library; it contains the native and platform-independent er...
Address family not supported.
The flags had an invalid value.
A non-recoverable error occurred.
const char * errno2str(int errnum)
Returns a string describing a standard C error number.
Resource unavailable, try again.
int get_errc(void)
Returns the last (thread-specific) native error code set by a system call or library function...
void set_errc(int errc)
Sets the current (thread-specific) native error code to errc.
The socket is not connected.
#define ABS(a)
Returns the absolute value of a.
errnum
The platform-independent error numbers.
No message of the desired type.
No message is available on the STREAM head read queue.
int errno2c(int errnum)
Transforms a standard C error number to a native error code.
No such device or address.
int errnum2no(errnum_t errnum)
Transforms a platform-independent error number to a standard C error number.
No such file or directory.
#define _Thread_local
An object whose identifier is declared with the storage-class specifier _Thread_local has thread stor...
errnum_t errno2num(int errnum)
Transforms a standard C error number to a platform-independent error number.
enum errnum errnum_t
The platform-independent error number type.
errnum_t errc2num(int errc)
Transforms a native error code to a platform-independent error number.
The service passed was not recognized for the specified socket type.
The name does not resolve for the supplied parameters.
Protocol wrong type for socket.
An argument buffer overflowed.
Destination address required.
The name could not be resolved at this time.
There was a memory allocation failure.
Not a directory or a symbolic link to a directory.
This is the public header file of the utilities library.
Value too large to be stored in data type.
Connection aborted by network.