mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:57:35 +00:00
Kernel+LibC: Move errno definitions to Kernel/API/POSIX
This fixes at least half of our LibC includes in the kernel. The source of truth for errno codes and their description strings now lives in Kernel/API/POSIX/errno.h as an enumeration, which LibC includes.
This commit is contained in:
parent
0cca6cef95
commit
69ef211925
23 changed files with 123 additions and 183 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <errno_numbers.h>
|
||||
#include <errno_codes.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#define __RETURN_WITH_ERRNO(rc, good_ret, bad_ret) \
|
||||
|
|
|
@ -6,168 +6,89 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
enum ErrnoCode {
|
||||
EPERM = 1,
|
||||
#include <Kernel/API/POSIX/errno.h>
|
||||
|
||||
// NOTE: You can't define with a macro, so these have to be duplicated.
|
||||
#define EPERM EPERM
|
||||
ENOENT,
|
||||
#define ENOENT ENOENT
|
||||
ESRCH,
|
||||
#define ESRCH ESRCH
|
||||
EINTR,
|
||||
#define EINTR EINTR
|
||||
EIO,
|
||||
#define EIO EIO
|
||||
ENXIO,
|
||||
#define ENXIO ENXIO
|
||||
E2BIG,
|
||||
#define E2BIG E2BIG
|
||||
ENOEXEC,
|
||||
#define ENOEXEC ENOEXEC
|
||||
EBADF,
|
||||
#define EBADF EBADF
|
||||
ECHILD,
|
||||
#define ECHILD ECHILD
|
||||
EAGAIN,
|
||||
#define EAGAIN EAGAIN
|
||||
ENOMEM,
|
||||
#define ENOMEM ENOMEM
|
||||
EACCES,
|
||||
#define EACCES EACCES
|
||||
EFAULT,
|
||||
#define EFAULT EFAULT
|
||||
ENOTBLK,
|
||||
#define ENOTBLK ENOTBLK
|
||||
EBUSY,
|
||||
#define EBUSY EBUSY
|
||||
EEXIST,
|
||||
#define EEXIST EEXIST
|
||||
EXDEV,
|
||||
#define EXDEV EXDEV
|
||||
ENODEV,
|
||||
#define ENODEV ENODEV
|
||||
ENOTDIR,
|
||||
#define ENOTDIR ENOTDIR
|
||||
EISDIR,
|
||||
#define EISDIR EISDIR
|
||||
EINVAL,
|
||||
#define EINVAL EINVAL
|
||||
ENFILE,
|
||||
#define ENFILE ENFILE
|
||||
EMFILE,
|
||||
#define EMFILE EMFILE
|
||||
ENOTTY,
|
||||
#define ENOTTY ENOTTY
|
||||
ETXTBSY,
|
||||
#define ETXTBSY ETXTBSY
|
||||
EFBIG,
|
||||
#define EFBIG EFBIG
|
||||
ENOSPC,
|
||||
#define ENOSPC ENOSPC
|
||||
ESPIPE,
|
||||
#define ESPIPE ESPIPE
|
||||
EROFS,
|
||||
#define EROFS EROFS
|
||||
EMLINK,
|
||||
#define EMLINK EMLINK
|
||||
EPIPE,
|
||||
#define EPIPE EPIPE
|
||||
ERANGE,
|
||||
#define ERANGE ERANGE
|
||||
ENAMETOOLONG,
|
||||
#define ENAMETOOLONG ENAMETOOLONG
|
||||
ELOOP,
|
||||
#define ELOOP ELOOP
|
||||
EOVERFLOW,
|
||||
#define EOVERFLOW EOVERFLOW
|
||||
EOPNOTSUPP,
|
||||
#define EOPNOTSUPP EOPNOTSUPP
|
||||
ENOSYS,
|
||||
#define ENOSYS ENOSYS
|
||||
ENOTIMPL,
|
||||
#define ENOTIMPL ENOTIMPL
|
||||
EAFNOSUPPORT,
|
||||
#define EAFNOSUPPORT EAFNOSUPPORT
|
||||
ENOTSOCK,
|
||||
#define ENOTSOCK ENOTSOCK
|
||||
EADDRINUSE,
|
||||
#define EADDRINUSE EADDRINUSE
|
||||
EWHYTHO,
|
||||
#define EWHYTHO EWHYTHO
|
||||
ENOTEMPTY,
|
||||
#define ENOTEMPTY ENOTEMPTY
|
||||
EDOM,
|
||||
#define EDOM EDOM
|
||||
ECONNREFUSED,
|
||||
#define ECONNREFUSED ECONNREFUSED
|
||||
EHOSTDOWN,
|
||||
#define EHOSTDOWN EHOSTDOWN
|
||||
EADDRNOTAVAIL,
|
||||
#define EADDRNOTAVAIL EADDRNOTAVAIL
|
||||
EISCONN,
|
||||
#define EISCONN EISCONN
|
||||
ECONNABORTED,
|
||||
#define ECONNABORTED ECONNABORTED
|
||||
EALREADY,
|
||||
#define EALREADY EALREADY
|
||||
ECONNRESET,
|
||||
#define ECONNRESET ECONNRESET
|
||||
EDESTADDRREQ,
|
||||
#define EDESTADDRREQ EDESTADDRREQ
|
||||
EHOSTUNREACH,
|
||||
#define EHOSTUNREACH EHOSTUNREACH
|
||||
EILSEQ,
|
||||
#define EILSEQ EILSEQ
|
||||
EMSGSIZE,
|
||||
#define EMSGSIZE EMSGSIZE
|
||||
ENETDOWN,
|
||||
#define ENETDOWN ENETDOWN
|
||||
ENETUNREACH,
|
||||
#define ENETUNREACH ENETUNREACH
|
||||
ENETRESET,
|
||||
#define ENETRESET ENETRESET
|
||||
ENOBUFS,
|
||||
#define ENOBUFS ENOBUFS
|
||||
ENOLCK,
|
||||
#define ENOLCK ENOLCK
|
||||
ENOMSG,
|
||||
#define ENOMSG ENOMSG
|
||||
ENOPROTOOPT,
|
||||
#define ENOPROTOOPT ENOPROTOOPT
|
||||
ENOTCONN,
|
||||
#define ENOTCONN ENOTCONN
|
||||
ESHUTDOWN,
|
||||
#define ESHUTDOWN ESHUTDOWN
|
||||
ETOOMANYREFS,
|
||||
#define ETOOMANYREFS ETOOMANYREFS
|
||||
EPROTONOSUPPORT,
|
||||
#define EPROTONOSUPPORT EPROTONOSUPPORT
|
||||
ESOCKTNOSUPPORT,
|
||||
#define ESOCKTNOSUPPORT ESOCKTNOSUPPORT
|
||||
EDEADLK,
|
||||
#define EDEADLK EDEADLK
|
||||
ETIMEDOUT,
|
||||
#define ETIMEDOUT ETIMEDOUT
|
||||
EPROTOTYPE,
|
||||
#define EPROTOTYPE EPROTOTYPE
|
||||
EINPROGRESS,
|
||||
#define EINPROGRESS EINPROGRESS
|
||||
ENOTHREAD,
|
||||
#define ENOTHREAD ENOTHREAD
|
||||
EPROTO,
|
||||
#define EPROTO EPROTO
|
||||
ENOTSUP,
|
||||
#define ENOTSUP ENOTSUP
|
||||
EPFNOSUPPORT,
|
||||
#define EPFNOSUPPORT EPFNOSUPPORT
|
||||
EDIRINTOSELF,
|
||||
#define EDQUOT EDQUOT
|
||||
EDQUOT,
|
||||
#define EDIRINTOSELF EDIRINTOSELF
|
||||
ENOTRECOVERABLE,
|
||||
#define ENOTRECOVERABLE ENOTRECOVERABLE
|
||||
EMAXERRNO,
|
||||
#define EMAXERRNO EMAXERRNO
|
||||
};
|
||||
|
||||
#define EWOULDBLOCK EAGAIN
|
||||
#define ELAST EMAXERRNO
|
|
@ -8,7 +8,7 @@
|
|||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <errno.h>
|
||||
#include <errno_numbers.h>
|
||||
#include <errno_codes.h>
|
||||
#include <grp.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -264,87 +264,9 @@ char* strncat(char* dest, const char* src, size_t n)
|
|||
}
|
||||
|
||||
const char* const sys_errlist[] = {
|
||||
"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",
|
||||
"Host is down",
|
||||
"Address not available",
|
||||
"Already connected",
|
||||
"Connection aborted",
|
||||
"Connection already in progress",
|
||||
"Connection reset",
|
||||
"Destination 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",
|
||||
"Transport endpoint has shutdown",
|
||||
"Too many references",
|
||||
"Protocol not supported",
|
||||
"Socket type not supported",
|
||||
"Resource deadlock would occur",
|
||||
"Timed out",
|
||||
"Wrong protocol type",
|
||||
"Operation in progress",
|
||||
"No such thread",
|
||||
"Protocol error",
|
||||
"Not supported",
|
||||
"Protocol family not supported",
|
||||
"Cannot make directory a subdirectory of itself",
|
||||
"Quota exceeded",
|
||||
"State not recoverable",
|
||||
"The highest errno +1 :^)",
|
||||
#define __ENUMERATE_ERRNO_CODE(c, s) s,
|
||||
ENUMERATE_ERRNO_CODES(__ENUMERATE_ERRNO_CODE)
|
||||
#undef __ENUMERATE_ERRNO_CODE
|
||||
};
|
||||
static_assert(array_size(sys_errlist) == (EMAXERRNO + 1));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue