forked from Bananymous/banan-os
LibC: define all errnos and strerror{name,desk}_np
This commit is contained in:
parent
de18d3e64d
commit
e756cde2b1
|
@ -2,22 +2,89 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#define ENOMEM 1
|
||||
#define EINVAL 2
|
||||
#define ENOTDIR 3
|
||||
#define EISDIR 4
|
||||
#define ENOENT 5
|
||||
#define EIO 6
|
||||
#define ENOTSUP 7
|
||||
#define EBADF 8
|
||||
#define EEXISTS 9
|
||||
#define ENOTEMPTY 10
|
||||
#define ENAMETOOLONG 11
|
||||
#define ENOBUFS 12
|
||||
#define ENOTTY 13
|
||||
#define ENOTBLK 14
|
||||
#define EMFILE 15
|
||||
#define ENOSYS 16
|
||||
#define E2BIG 1
|
||||
#define EACCES 2
|
||||
#define EADDRINUSE 3
|
||||
#define EADDRNOTAVAIL 4
|
||||
#define EAFNOSUPPORT 5
|
||||
#define EAGAIN 6
|
||||
#define EALREADY 7
|
||||
#define EBADF 8
|
||||
#define EBADMSG 9
|
||||
#define EBUSY 10
|
||||
#define ECANCELED 11
|
||||
#define ECHILD 12
|
||||
#define ECONNABORTED 13
|
||||
#define ECONNREFUSED 14
|
||||
#define ECONNRESET 15
|
||||
#define EDEADLK 16
|
||||
#define EDESTADDRREQ 17
|
||||
#define EDOM 18
|
||||
#define EDQUOT 19
|
||||
#define EEXIST 20
|
||||
#define EFAULT 21
|
||||
#define EFBIG 22
|
||||
#define EHOSTUNREACH 23
|
||||
#define EIDRM 24
|
||||
#define EILSEQ 25
|
||||
#define EINPROGRESS 26
|
||||
#define EINTR 27
|
||||
#define EINVAL 28
|
||||
#define EIO 29
|
||||
#define EISCONN 30
|
||||
#define EISDIR 31
|
||||
#define ELOOP 32
|
||||
#define EMFILE 33
|
||||
#define EMLINK 34
|
||||
#define EMSGSIZE 35
|
||||
#define EMULTIHOP 36
|
||||
#define ENAMETOOLONG 37
|
||||
#define ENETDOWN 38
|
||||
#define ENETRESET 39
|
||||
#define ENETUNREACH 40
|
||||
#define ENFILE 41
|
||||
#define ENOBUFS 42
|
||||
#define ENODATA 43
|
||||
#define ENODEV 44
|
||||
#define ENOENT 45
|
||||
#define ENOEXEC 46
|
||||
#define ENOLCK 47
|
||||
#define ENOLINK 48
|
||||
#define ENOMEM 49
|
||||
#define ENOMSG 50
|
||||
#define ENOPROTOOPT 51
|
||||
#define ENOSPC 52
|
||||
#define ENOSR 53
|
||||
#define ENOSTR 54
|
||||
#define ENOSYS 55
|
||||
#define ENOTCONN 56
|
||||
#define ENOTDIR 57
|
||||
#define ENOTEMPTY 58
|
||||
#define ENOTRECOVERABLE 59
|
||||
#define ENOTSOCK 60
|
||||
#define ENOTSUP 61
|
||||
#define ENOTTY 62
|
||||
#define ENXIO 63
|
||||
#define EOPNOTSUPP 64
|
||||
#define EOVERFLOW 65
|
||||
#define EOWNERDEAD 66
|
||||
#define EPERM 67
|
||||
#define EPIPE 68
|
||||
#define EPROTO 69
|
||||
#define EPROTONOSUPPORT 70
|
||||
#define EPROTOTYPE 71
|
||||
#define ERANGE 72
|
||||
#define EROFS 73
|
||||
#define ESPIPE 74
|
||||
#define ESRCH 75
|
||||
#define ESTALE 76
|
||||
#define ETIME 77
|
||||
#define ETIMEDOUT 78
|
||||
#define ETXTBSY 79
|
||||
#define EWOULDBLOCK 80
|
||||
#define EXDEV 81
|
||||
#define EEXISTS 82
|
||||
#define ENOTBLK 83
|
||||
|
||||
#define errno errno
|
||||
|
||||
|
|
202
libc/string.cpp
202
libc/string.cpp
|
@ -89,23 +89,90 @@ const char* strerrorname_np(int error)
|
|||
{
|
||||
switch (error)
|
||||
{
|
||||
case 0: return "NOERROR";
|
||||
case ENOMEM: return "ENOMEM";
|
||||
case EINVAL: return "EINVAL";
|
||||
case EISDIR: return "EISDIR";
|
||||
case ENOTDIR: return "ENOTDIR";
|
||||
case ENOENT: return "ENOENT";
|
||||
case EIO: return "EIO";
|
||||
case ENOTSUP: return "ENOTSUP";
|
||||
case EBADF: return "EBADF";
|
||||
case EEXISTS: return "EEXISTS";
|
||||
case ENOTEMPTY: return "ENOTEMPTY";
|
||||
case ENAMETOOLONG: return "ENAMETOOLONG";
|
||||
case ENOBUFS: return "ENOBUFS";
|
||||
case ENOTTY: return "ENOTTY";
|
||||
case ENOTBLK: return "ENOTBLK";
|
||||
case EMFILE: return "EMFILE";
|
||||
case ENOSYS: return "ENOSYS";
|
||||
case 0: return "NOERROR";
|
||||
case E2BIG: return "E2BIG";
|
||||
case EACCES: return "EACCES";
|
||||
case EADDRINUSE: return "EADDRINUSE";
|
||||
case EADDRNOTAVAIL: return "EADDRNOTAVAIL";
|
||||
case EAFNOSUPPORT: return "EAFNOSUPPORT";
|
||||
case EAGAIN: return "EAGAIN";
|
||||
case EALREADY: return "EALREADY";
|
||||
case EBADF: return "EBADF";
|
||||
case EBADMSG: return "EBADMSG";
|
||||
case EBUSY: return "EBUSY";
|
||||
case ECANCELED: return "ECANCELED";
|
||||
case ECHILD: return "ECHILD";
|
||||
case ECONNABORTED: return "ECONNABORTED";
|
||||
case ECONNREFUSED: return "ECONNREFUSED";
|
||||
case ECONNRESET: return "ECONNRESET";
|
||||
case EDEADLK: return "EDEADLK";
|
||||
case EDESTADDRREQ: return "EDESTADDRREQ";
|
||||
case EDOM: return "EDOM";
|
||||
case EDQUOT: return "EDQUOT";
|
||||
case EEXIST: return "EEXIST";
|
||||
case EFAULT: return "EFAULT";
|
||||
case EFBIG: return "EFBIG";
|
||||
case EHOSTUNREACH: return "EHOSTUNREACH";
|
||||
case EIDRM: return "EIDRM";
|
||||
case EILSEQ: return "EILSEQ";
|
||||
case EINPROGRESS: return "EINPROGRESS";
|
||||
case EINTR: return "EINTR";
|
||||
case EINVAL: return "EINVAL";
|
||||
case EIO: return "EIO";
|
||||
case EISCONN: return "EISCONN";
|
||||
case EISDIR: return "EISDIR";
|
||||
case ELOOP: return "ELOOP";
|
||||
case EMFILE: return "EMFILE";
|
||||
case EMLINK: return "EMLINK";
|
||||
case EMSGSIZE: return "EMSGSIZE";
|
||||
case EMULTIHOP: return "EMULTIHOP";
|
||||
case ENAMETOOLONG: return "ENAMETOOLONG";
|
||||
case ENETDOWN: return "ENETDOWN";
|
||||
case ENETRESET: return "ENETRESET";
|
||||
case ENETUNREACH: return "ENETUNREACH";
|
||||
case ENFILE: return "ENFILE";
|
||||
case ENOBUFS: return "ENOBUFS";
|
||||
case ENODATA: return "ENODATA";
|
||||
case ENODEV: return "ENODEV";
|
||||
case ENOENT: return "ENOENT";
|
||||
case ENOEXEC: return "ENOEXEC";
|
||||
case ENOLCK: return "ENOLCK";
|
||||
case ENOLINK: return "ENOLINK";
|
||||
case ENOMEM: return "ENOMEM";
|
||||
case ENOMSG: return "ENOMSG";
|
||||
case ENOPROTOOPT: return "ENOPROTOOPT";
|
||||
case ENOSPC: return "ENOSPC";
|
||||
case ENOSR: return "ENOSR";
|
||||
case ENOSTR: return "ENOSTR";
|
||||
case ENOSYS: return "ENOSYS";
|
||||
case ENOTCONN: return "ENOTCONN";
|
||||
case ENOTDIR: return "ENOTDIR";
|
||||
case ENOTEMPTY: return "ENOTEMPTY";
|
||||
case ENOTRECOVERABLE: return "ENOTRECOVERABLE";
|
||||
case ENOTSOCK: return "ENOTSOCK";
|
||||
case ENOTSUP: return "ENOTSUP";
|
||||
case ENOTTY: return "ENOTTY";
|
||||
case ENXIO: return "ENXIO";
|
||||
case EOPNOTSUPP: return "EOPNOTSUPP";
|
||||
case EOVERFLOW: return "EOVERFLOW";
|
||||
case EOWNERDEAD: return "EOWNERDEAD";
|
||||
case EPERM: return "EPERM";
|
||||
case EPIPE: return "EPIPE";
|
||||
case EPROTO: return "EPROTO";
|
||||
case EPROTONOSUPPORT: return "EPROTONOSUPPORT";
|
||||
case EPROTOTYPE: return "EPROTOTYPE";
|
||||
case ERANGE: return "ERANGE";
|
||||
case EROFS: return "EROFS";
|
||||
case ESPIPE: return "ESPIPE";
|
||||
case ESRCH: return "ESRCH";
|
||||
case ESTALE: return "ESTALE";
|
||||
case ETIME: return "ETIME";
|
||||
case ETIMEDOUT: return "ETIMEDOUT";
|
||||
case ETXTBSY: return "ETXTBSY";
|
||||
case EWOULDBLOCK: return "EWOULDBLOCK";
|
||||
case EXDEV: return "EXDEV";
|
||||
case EEXISTS: return "EEXISTS";
|
||||
case ENOTBLK: return "ENOTBLK";
|
||||
}
|
||||
|
||||
errno = EINVAL;
|
||||
|
@ -116,23 +183,90 @@ const char* strerrordesc_np(int error)
|
|||
{
|
||||
switch (error)
|
||||
{
|
||||
case 0: return "Success";
|
||||
case ENOMEM: return "Cannot allocate memory";
|
||||
case EINVAL: return "Invalid argument";
|
||||
case EISDIR: return "Is a directory";
|
||||
case ENOTDIR: return "Not a directory";
|
||||
case ENOENT: return "No such file or directory";
|
||||
case EIO: return "Input/output error";
|
||||
case ENOTSUP: return "Operation not supported";
|
||||
case EBADF: return "Bad file descriptor";
|
||||
case EEXISTS: return "File exists";
|
||||
case ENOTEMPTY: return "Directory not empty";
|
||||
case ENAMETOOLONG: return "Filename too long";
|
||||
case ENOBUFS: return "No buffer space available";
|
||||
case ENOTTY: return "Inappropriate I/O control operation";
|
||||
case ENOTBLK: return "Block device required";
|
||||
case EMFILE: return "File descriptor value too large";
|
||||
case ENOSYS: return "Function not implemented";
|
||||
case 0: return "Success";
|
||||
case E2BIG: return "Argument list too long.";
|
||||
case EACCES: return "Permission denied.";
|
||||
case EADDRINUSE: return "Address in use.";
|
||||
case EADDRNOTAVAIL: return "Address not available.";
|
||||
case EAFNOSUPPORT: return "Address family not supported.";
|
||||
case EAGAIN: return "Resource unavailable, try again.";
|
||||
case EALREADY: return "Connection already in progress.";
|
||||
case EBADF: return "Bad file descriptor.";
|
||||
case EBADMSG: return "Bad message.";
|
||||
case EBUSY: return "Device or resource busy.";
|
||||
case ECANCELED: return "Operation canceled.";
|
||||
case ECHILD: return "No child processes.";
|
||||
case ECONNABORTED: return "Connection aborted.";
|
||||
case ECONNREFUSED: return "Connection refused.";
|
||||
case ECONNRESET: return "Connection reset.";
|
||||
case EDEADLK: return "Resource deadlock would occur.";
|
||||
case EDESTADDRREQ: return "Destination address required.";
|
||||
case EDOM: return "Mathematics argument out of domain of function.";
|
||||
case EDQUOT: return "Reserved.";
|
||||
case EEXIST: return "File exists.";
|
||||
case EFAULT: return "Bad address.";
|
||||
case EFBIG: return "File too large.";
|
||||
case EHOSTUNREACH: return "Host is unreachable.";
|
||||
case EIDRM: return "Identifier removed.";
|
||||
case EILSEQ: return "Illegal byte sequence.";
|
||||
case EINPROGRESS: return "Operation in progress.";
|
||||
case EINTR: return "Interrupted function.";
|
||||
case EINVAL: return "Invalid argument.";
|
||||
case EIO: return "I/O error.";
|
||||
case EISCONN: return "Socket is connected.";
|
||||
case EISDIR: return "Is a directory.";
|
||||
case ELOOP: return "Too many levels of symbolic links.";
|
||||
case EMFILE: return "File descriptor value too large.";
|
||||
case EMLINK: return "Too many links.";
|
||||
case EMSGSIZE: return "Message too large.";
|
||||
case EMULTIHOP: return "Reserved.";
|
||||
case ENAMETOOLONG: return "Filename too long.";
|
||||
case ENETDOWN: return "Network is down.";
|
||||
case ENETRESET: return "Connection aborted by network.";
|
||||
case ENETUNREACH: return "Network unreachable.";
|
||||
case ENFILE: return "Too many files open in system.";
|
||||
case ENOBUFS: return "No buffer space available.";
|
||||
case ENODATA: return "No message is available on the STREAM head read queue.";
|
||||
case ENODEV: return "No such device.";
|
||||
case ENOENT: return "No such file or directory.";
|
||||
case ENOEXEC: return "Executable file format error.";
|
||||
case ENOLCK: return "No locks available.";
|
||||
case ENOLINK: return "Reserved.";
|
||||
case ENOMEM: return "Not enough space.";
|
||||
case ENOMSG: return "No message of the desired type.";
|
||||
case ENOPROTOOPT: return "Protocol not available.";
|
||||
case ENOSPC: return "No space left on device.";
|
||||
case ENOSR: return "No STREAM resources.";
|
||||
case ENOSTR: return "Not a STREAM.";
|
||||
case ENOSYS: return "Functionality not supported.";
|
||||
case ENOTCONN: return "The socket is not connected.";
|
||||
case ENOTDIR: return "Not a directory or a symbolic link to a directory.";
|
||||
case ENOTEMPTY: return "Directory not empty.";
|
||||
case ENOTRECOVERABLE: return "State not recoverable.";
|
||||
case ENOTSOCK: return "Not a socket.";
|
||||
case ENOTSUP: return "Not supported.";
|
||||
case ENOTTY: return "Inappropriate I/O control operation.";
|
||||
case ENXIO: return "No such device or address.";
|
||||
case EOPNOTSUPP: return "Operation not supported on socket .";
|
||||
case EOVERFLOW: return "Value too large to be stored in data type.";
|
||||
case EOWNERDEAD: return "Previous owner died.";
|
||||
case EPERM: return "Operation not permitted.";
|
||||
case EPIPE: return "Broken pipe.";
|
||||
case EPROTO: return "Protocol error.";
|
||||
case EPROTONOSUPPORT: return "Protocol not supported.";
|
||||
case EPROTOTYPE: return "Protocol wrong type for socket.";
|
||||
case ERANGE: return "Result too large.";
|
||||
case EROFS: return "Read-only file system.";
|
||||
case ESPIPE: return "Invalid seek.";
|
||||
case ESRCH: return "No such process.";
|
||||
case ESTALE: return "Reserved.";
|
||||
case ETIME: return "Stream ioctl() timeout.";
|
||||
case ETIMEDOUT: return "Connection timed out.";
|
||||
case ETXTBSY: return "Text file busy.";
|
||||
case EWOULDBLOCK: return "Operation would block.";
|
||||
case EXDEV: return "Cross-device link.";
|
||||
case EEXISTS: return "File exists";
|
||||
case ENOTBLK: return "Block device required";
|
||||
}
|
||||
|
||||
errno = EINVAL;
|
||||
|
|
Loading…
Reference in New Issue