1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:08:12 +00:00

LibC: Make errno codes be #defines instead of enum values.

It turns out that a lot of 3rd party software does things like:

    #ifdef EINTR
        ...
    #endif

This won't work if EINTR is an enum. So much for that nice idea.
This commit is contained in:
Andreas Kling 2019-02-26 22:40:35 +01:00
parent 83e78648e4
commit 424368034b
4 changed files with 146 additions and 87 deletions

View file

@ -242,11 +242,79 @@ char* strncat(char *dest, const char *src, size_t n)
}
const char* sys_errlist[] = {
#undef __ERROR
#define __ERROR(a, b) b,
__ENUMERATE_ALL_ERRORS
#undef __ERROR
"Success (not an error)",
"Operation not permitted",
"No such file or directory",
"No such process",
"Interrupted syscall",
"I/O error",
"No such device or address",
"Argument list too long",
"Exec format error",
"Bad fd number",
"No child processes",
"Try again",
"Out of memory",
"Permission denied",
"Bad address",
"Block device required",
"Device or resource busy",
"File already exists",
"Cross-device link",
"No such device",
"Not a directory",
"Is a directory",
"Invalid argument",
"File table overflow",
"Too many open files",
"Not a TTY",
"Text file busy",
"File too large",
"No space left on device",
"Illegal seek",
"Read-only filesystem",
"Too many links",
"Broken pipe",
"Range error",
"Name too long",
"Too many symlinks",
"Overflow",
"Operation not supported",
"No such syscall",
"Not implemented",
"Address family not supported",
"Not a socket",
"Address in use",
"Failed without setting an error code (bug!)",
"Directory not empty",
"Math argument out of domain",
"Connection refused",
"Address not available",
"Already connected",
"Connection aborted",
"Connection already in progress",
"Connection reset",
"Desination address required",
"Host unreachable",
"Illegal byte sequence",
"Message size",
"Network down",
"Network unreachable",
"Network reset",
"No buffer space",
"No lock available",
"No message",
"No protocol option",
"Not connected",
"Operation would block",
"Protocol not supported",
"Resource deadlock would occur",
"Timed out",
"Wrong protocol type",
"Operation in progress",
"The highest errno +1 :^)",
};
int sys_nerr = EMAXERRNO;
char* strerror(int errnum)