commit 8322357836dde65eb4779b3b24dd1ffc3ab0cec2 parent d996b4b37aafdb339941459b9d5a4b1445fd9cb7 Author: Dimitris Papastamos <dimitris.papastamos@arm.com> Date: Wed, 21 Nov 2018 13:54:21 +0000 Merge "[libc] Avoid unneded data and bss" Diffstat:
| M | arch/rmode/rom.c | | | 6 | ++++++ |
| D | include/bits/.gitignore | | | 1 | - |
| A | include/bits/dragonfly/sys/errno.h | | | 104 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | include/bits/linux/sys/errno.h | | | 135 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | include/bits/netbsd/sys/errno.h | | | 101 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | include/bits/openbsd/sys/errno.h | | | 100 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | include/bits/rcode/sys/errno.h | | | 46 | ++++++++++++++++++++++++++++++++++++++++++++++ |
| M | include/ctype.h | | | 2 | +- |
| M | include/errno.h | | | 4 | ---- |
| M | include/rcode.h | | | 2 | +- |
| D | src/libc/arch/amd64/dragonfly/errno.lst | | | 100 | ------------------------------------------------------------------------------- |
| D | src/libc/arch/amd64/linux/errno.lst | | | 131 | ------------------------------------------------------------------------------- |
| D | src/libc/arch/amd64/netbsd/errno.lst | | | 97 | ------------------------------------------------------------------------------- |
| D | src/libc/arch/amd64/openbsd/errno.lst | | | 96 | ------------------------------------------------------------------------------- |
| M | src/libc/arch/arm64/linux/Makefile | | | 2 | +- |
| D | src/libc/arch/arm64/linux/errno.lst | | | 126 | ------------------------------------------------------------------------------- |
| D | src/libc/arch/generrno.sh | | | 35 | ----------------------------------- |
| D | src/libc/arch/generrstr.sh | | | 23 | ----------------------- |
| A | src/libc/arch/mkerrstr | | | 23 | +++++++++++++++++++++++ |
| M | src/libc/arch/rmode/rcode/Makefile | | | 3 | +++ |
| D | src/libc/arch/rmode/rcode/errno.lst | | | 40 | ---------------------------------------- |
| M | src/libc/arch/rules.mk | | | 7 | ++----- |
| M | src/libc/ctype/ctype.c | | | 4 | +--- |
| M | src/libc/stdlib/strtoull.c | | | 2 | +- |
| M | src/romfw/dirfs.c | | | 8 | +++++--- |
| M | src/romfw/fs.c | | | 36 | +++++++++++++++++++----------------- |
26 files changed, 549 insertions(+), 685 deletions(-)
diff --git a/arch/rmode/rom.c b/arch/rmode/rom.c @@ -25,6 +25,12 @@ struct mach { size_t stacksiz; }; +int * +geterrno(void) +{ + return &bss->errno_; +} + static void imach(Mach *mp, void *txt, size_t txtsiz, void *ram, size_t ramsiz) { diff --git a/include/bits/.gitignore b/include/bits/.gitignore @@ -1 +0,0 @@ -errno.h diff --git a/include/bits/dragonfly/sys/errno.h b/include/bits/dragonfly/sys/errno.h @@ -0,0 +1,104 @@ +extern int errno; +extern char *const _sys_errlist[]; +extern const int _sys_nerr; + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* Input/output error */ +#define ENXIO 6 /* Device not configured */ +#define E2BIG 7 /* Argument list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file descriptor */ +#define ECHILD 10 /* No child processes */ +#define EDEADLK 11 /* Resource deadlock avoided */ +#define ENOMEM 12 /* Cannot allocate memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* Operation not supported by device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* Too many open files in system */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Inappropriate ioctl for device */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only filesystem */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Numerical argument out of domain */ +#define ERANGE 34 /* Result too large */ +#define EAGAIN 35 /* Resource temporarily unavailable */ +#define EINPROGRESS 36 /* Operation now in progress */ +#define EALREADY 37 /* Operation already in progress */ +#define ENOTSOCK 38 /* Socket operation on non-socket */ +#define EDESTADDRREQ 39 /* Destination address required */ +#define EMSGSIZE 40 /* Message too long */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Operation not supported */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ +#define EADDRINUSE 48 /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Can't assign requested address */ +#define ENETDOWN 50 /* Network is down */ +#define ENETUNREACH 51 /* Network is unreachable */ +#define ENETRESET 52 /* Network dropped connection on reset */ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN 56 /* Socket is already connected */ +#define ENOTCONN 57 /* Socket is not connected */ +#define ESHUTDOWN 58 /* Can't send after socket shutdown */ +#define ETOOMANYREFS 59 /* Too many references: can't splice */ +#define ETIMEDOUT 60 /* Operation timed out */ +#define ECONNREFUSED 61 /* Connection refused */ +#define ELOOP 62 /* Too many levels of symbolic links */ +#define ENAMETOOLONG 63 /* File name too long */ +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ +#define ENOTEMPTY 66 /* Directory not empty */ +#define EPROCLIM 67 /* Too many processes */ +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Disc quota exceeded */ +#define ESTALE 70 /* Stale NFS file handle */ +#define EREMOTE 71 /* Too many levels of remote in path */ +#define EBADRPC 72 /* RPC struct is bad */ +#define ERPCMISMATCH 73 /* RPC version wrong */ +#define EPROGUNAVAIL 74 /* RPC prog. not avail */ +#define EPROGMISMATCH 75 /* Program version wrong */ +#define EPROCUNAVAIL 76 /* Bad procedure for program */ +#define ENOLCK 77 /* No locks available */ +#define ENOSYS 78 /* Function not implemented */ +#define EFTYPE 79 /* Inappropriate file type or format */ +#define EAUTH 80 /* Authentication error */ +#define ENEEDAUTH 81 /* Need authenticator */ +#define EIDRM 82 /* Identifier removed */ +#define ENOMSG 83 /* No message of desired type */ +#define EOVERFLOW 84 /* Value too large to be stored in data type */ +#define ECANCELED 85 /* Operation canceled */ +#define EILSEQ 86 /* Illegal byte sequence */ +#define ENOATTR 87 /* Attribute not found */ +#define EDOOFUS 88 /* Programming error */ +#define EBADMSG 89 /* Bad message */ +#define EMULTIHOP 90 /* Multihop attempted */ +#define ENOLINK 91 /* Link has been severed */ +#define EPROTO 92 /* Protocol error */ +#define ENOMEDIUM 93 /* linux */ +#define EUNUSED94 94 /* */ +#define EUNUSED95 95 /* */ +#define EUNUSED96 96 /* */ +#define EUNUSED97 97 /* */ +#define EUNUSED98 98 /* */ +#define EASYNC 99 /* XXX */ +#define ELAST 99 /* Must be equal largest errno */ diff --git a/include/bits/linux/sys/errno.h b/include/bits/linux/sys/errno.h @@ -0,0 +1,135 @@ +extern int errno; +extern char *const _sys_errlist[]; +extern const int _sys_nerr; + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Argument list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No child processes */ +#define EAGAIN 11 /* Try again */ +#define ENOMEM 12 /* Out of memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Device or resource busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Math argument out of domain of func */ +#define ERANGE 34 /* Math result not representable */ +#define EDEADLK 35 /* Resource deadlock would occur */ +#define ENAMETOOLONG 36 /* File name too long */ +#define ENOLCK 37 /* No record locks available */ +#define ENOSYS 38 /* Invalid system call number */ +#define ENOTEMPTY 39 /* Directory not empty */ +#define ELOOP 40 /* Too many symbolic links encountered */ +#define ENOMSG 42 /* No message of desired type */ +#define EIDRM 43 /* Identifier removed */ +#define ECHRNG 44 /* Channel number out of range */ +#define EL2NSYNC 45 /* Level 2 not synchronized */ +#define EL3HLT 46 /* Level 3 halted */ +#define EL3RST 47 /* Level 3 reset */ +#define ELNRNG 48 /* Link number out of range */ +#define EUNATCH 49 /* Protocol driver not attached */ +#define ENOCSI 50 /* No CSI structure available */ +#define EL2HLT 51 /* Level 2 halted */ +#define EBADE 52 /* Invalid exchange */ +#define EBADR 53 /* Invalid request descriptor */ +#define EXFULL 54 /* Exchange full */ +#define ENOANO 55 /* No anode */ +#define EBADRQC 56 /* Invalid request code */ +#define EBADSLT 57 /* Invalid slot */ +#define EBFONT 59 /* Bad font file format */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data available */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* Object is remote */ +#define ENOLINK 67 /* Link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EMULTIHOP 72 /* Multihop attempted */ +#define EDOTDOT 73 /* RFS specific error */ +#define EBADMSG 74 /* Not a data message */ +#define EOVERFLOW 75 /* Value too large for defined data type */ +#define ENOTUNIQ 76 /* Name not unique on network */ +#define EBADFD 77 /* File descriptor in bad state */ +#define EREMCHG 78 /* Remote address changed */ +#define ELIBACC 79 /* Can not access a needed shared library */ +#define ELIBBAD 80 /* Accessing a corrupted shared library */ +#define ELIBSCN 81 /* .lib section in a.out corrupted */ +#define ELIBMAX 82 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 83 /* Cannot exec a shared library directly */ +#define EILSEQ 84 /* Illegal byte sequence */ +#define ERESTART 85 /* Interrupted system call should be restarted */ +#define ESTRPIPE 86 /* Streams pipe error */ +#define EUSERS 87 /* Too many users */ +#define ENOTSOCK 88 /* Socket operation on non-socket */ +#define EDESTADDRREQ 89 /* Destination address required */ +#define EMSGSIZE 90 /* Message too long */ +#define EPROTOTYPE 91 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 92 /* Protocol not available */ +#define EPROTONOSUPPORT 93 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 94 /* Socket type not supported */ +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 96 /* Protocol family not supported */ +#define EAFNOSUPPORT 97 /* Address family not supported by protocol */ +#define EADDRINUSE 98 /* Address already in use */ +#define EADDRNOTAVAIL 99 /* Cannot assign requested address */ +#define ENETDOWN 100 /* Network is down */ +#define ENETUNREACH 101 /* Network is unreachable */ +#define ENETRESET 102 /* Network dropped connection because of reset */ +#define ECONNABORTED 103 /* Software caused connection abort */ +#define ECONNRESET 104 /* Connection reset by peer */ +#define ENOBUFS 105 /* No buffer space available */ +#define EISCONN 106 /* Transport endpoint is already connected */ +#define ENOTCONN 107 /* Transport endpoint is not connected */ +#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 109 /* Too many references: cannot splice */ +#define ETIMEDOUT 110 /* Connection timed out */ +#define ECONNREFUSED 111 /* Connection refused */ +#define EHOSTDOWN 112 /* Host is down */ +#define EHOSTUNREACH 113 /* No route to host */ +#define EALREADY 114 /* Operation already in progress */ +#define EINPROGRESS 115 /* Operation now in progress */ +#define ESTALE 116 /* Stale file handle */ +#define EUCLEAN 117 /* Structure needs cleaning */ +#define ENOTNAM 118 /* Not a XENIX named type file */ +#define ENAVAIL 119 /* No XENIX semaphores available */ +#define EISNAM 120 /* Is a named type file */ +#define EREMOTEIO 121 /* Remote I/O error */ +#define EDQUOT 122 /* Quota exceeded */ +#define ENOMEDIUM 123 /* No medium found */ +#define EMEDIUMTYPE 124 /* Wrong medium type */ +#define ECANCELED 125 /* Operation Canceled */ +#define ENOKEY 126 /* Required key not available */ +#define EKEYEXPIRED 127 /* Key has expired */ +#define EKEYREVOKED 128 /* Key has been revoked */ +#define EKEYREJECTED 129 /* Key was rejected by service */ +#define EOWNERDEAD 130 /* Owner died */ +#define ENOTRECOVERABLE 131 /* State not recoverable */ +#define ERFKILL 132 /* Operation not possible due to RF-kill */ +#define EHWPOISON 133 /* Memory page has hardware error */ diff --git a/include/bits/netbsd/sys/errno.h b/include/bits/netbsd/sys/errno.h @@ -0,0 +1,101 @@ +extern int errno; +extern char *const _sys_errlist[]; +extern const int _sys_nerr; + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* Input/output error */ +#define ENXIO 6 /* Device not configured */ +#define E2BIG 7 /* Argument list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file descriptor */ +#define ECHILD 10 /* No child processes */ +#define EDEADLK 11 /* Resource deadlock avoided */ +#define ENOMEM 12 /* Cannot allocate memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* Operation not supported by device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* Too many open files in system */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Inappropriate ioctl for device */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Numerical argument out of domain */ +#define ERANGE 34 /* Result too large or too small */ +#define EAGAIN 35 /* Resource temporarily unavailable */ +#define EINPROGRESS 36 /* Operation now in progress */ +#define EALREADY 37 /* Operation already in progress */ +#define ENOTSOCK 38 /* Socket operation on non-socket */ +#define EDESTADDRREQ 39 /* Destination address required */ +#define EMSGSIZE 40 /* Message too long */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol option not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Operation not supported */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ +#define EADDRINUSE 48 /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Can't assign requested address */ +#define ENETDOWN 50 /* Network is down */ +#define ENETUNREACH 51 /* Network is unreachable */ +#define ENETRESET 52 /* Network dropped connection on reset */ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN 56 /* Socket is already connected */ +#define ENOTCONN 57 /* Socket is not connected */ +#define ESHUTDOWN 58 /* Can't send after socket shutdown */ +#define ETOOMANYREFS 59 /* Too many references: can't splice */ +#define ETIMEDOUT 60 /* Operation timed out */ +#define ECONNREFUSED 61 /* Connection refused */ +#define ELOOP 62 /* Too many levels of symbolic links */ +#define ENAMETOOLONG 63 /* File name too long */ +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ +#define ENOTEMPTY 66 /* Directory not empty */ +#define EPROCLIM 67 /* Too many processes */ +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Disc quota exceeded */ +#define ESTALE 70 /* Stale NFS file handle */ +#define EREMOTE 71 /* Too many levels of remote in path */ +#define EBADRPC 72 /* RPC struct is bad */ +#define ERPCMISMATCH 73 /* RPC version wrong */ +#define EPROGUNAVAIL 74 /* RPC prog. not avail */ +#define EPROGMISMATCH 75 /* Program version wrong */ +#define EPROCUNAVAIL 76 /* Bad procedure for program */ +#define ENOLCK 77 /* No locks available */ +#define ENOSYS 78 /* Function not implemented */ +#define EFTYPE 79 /* Inappropriate file type or format */ +#define EAUTH 80 /* Authentication error */ +#define ENEEDAUTH 81 /* Need authenticator */ +#define EIDRM 82 /* Identifier removed */ +#define ENOMSG 83 /* No message of desired type */ +#define EOVERFLOW 84 /* Value too large to be stored in data type */ +#define EILSEQ 85 /* Illegal byte sequence */ +#define ENOTSUP 86 /* Not supported */ +#define ECANCELED 87 /* Operation canceled */ +#define EBADMSG 88 /* Bad or Corrupt message */ +#define ENODATA 89 /* No message available */ +#define ENOSR 90 /* No STREAM resources */ +#define ENOSTR 91 /* Not a STREAM */ +#define ETIME 92 /* STREAM ioctl timeout */ +#define ENOATTR 93 /* Attribute not found */ +#define EMULTIHOP 94 /* Multihop attempted */ +#define ENOLINK 95 /* Link has been severed */ +#define ELAST 96 /* Must equal largest errno */ +#define EPROTO 96 /* Protocol error */ diff --git a/include/bits/openbsd/sys/errno.h b/include/bits/openbsd/sys/errno.h @@ -0,0 +1,100 @@ +extern int errno; +extern char *const _sys_errlist[]; +extern const int _sys_nerr; + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* Input/output error */ +#define ENXIO 6 /* Device not configured */ +#define E2BIG 7 /* Argument list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file descriptor */ +#define ECHILD 10 /* No child processes */ +#define EDEADLK 11 /* Resource deadlock avoided */ +#define ENOMEM 12 /* Cannot allocate memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* Operation not supported by device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* Too many open files in system */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Inappropriate ioctl for device */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Numerical argument out of domain */ +#define ERANGE 34 /* Result too large */ +#define EAGAIN 35 /* Resource temporarily unavailable */ +#define EINPROGRESS 36 /* Operation now in progress */ +#define EALREADY 37 /* Operation already in progress */ +#define ENOTSOCK 38 /* Socket operation on non-socket */ +#define EDESTADDRREQ 39 /* Destination address required */ +#define EMSGSIZE 40 /* Message too long */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Operation not supported */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ +#define EADDRINUSE 48 /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Can't assign requested address */ +#define ENETDOWN 50 /* Network is down */ +#define ENETUNREACH 51 /* Network is unreachable */ +#define ENETRESET 52 /* Network dropped connection on reset */ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN 56 /* Socket is already connected */ +#define ENOTCONN 57 /* Socket is not connected */ +#define ESHUTDOWN 58 /* Can't send after socket shutdown */ +#define ETOOMANYREFS 59 /* Too many references: can't splice */ +#define ETIMEDOUT 60 /* Operation timed out */ +#define ECONNREFUSED 61 /* Connection refused */ +#define ELOOP 62 /* Too many levels of symbolic links */ +#define ENAMETOOLONG 63 /* File name too long */ +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ +#define ENOTEMPTY 66 /* Directory not empty */ +#define EPROCLIM 67 /* Too many processes */ +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Disk quota exceeded */ +#define ESTALE 70 /* Stale NFS file handle */ +#define EREMOTE 71 /* Too many levels of remote in path */ +#define EBADRPC 72 /* RPC struct is bad */ +#define ERPCMISMATCH 73 /* RPC version wrong */ +#define EPROGUNAVAIL 74 /* RPC program not available */ +#define EPROGMISMATCH 75 /* Program version wrong */ +#define EPROCUNAVAIL 76 /* Bad procedure for program */ +#define ENOLCK 77 /* No locks available */ +#define ENOSYS 78 /* Function not implemented */ +#define EFTYPE 79 /* Inappropriate file type or format */ +#define EAUTH 80 /* Authentication error */ +#define ENEEDAUTH 81 /* Need authenticator */ +#define EIPSEC 82 /* IPsec processing failure */ +#define ENOATTR 83 /* Attribute not found */ +#define EILSEQ 84 /* Illegal byte sequence */ +#define ENOMEDIUM 85 /* No medium found */ +#define EMEDIUMTYPE 86 /* Wrong medium type */ +#define EOVERFLOW 87 /* Value too large to be stored in data type */ +#define ECANCELED 88 /* Operation canceled */ +#define EIDRM 89 /* Identifier removed */ +#define ENOMSG 90 /* No message of desired type */ +#define ENOTSUP 91 /* Not supported */ +#define EBADMSG 92 /* Bad message */ +#define ENOTRECOVERABLE 93 /* State not recoverable */ +#define EOWNERDEAD 94 /* Previous owner died */ +#define ELAST 95 /* Must be equal largest errno */ +#define EPROTO 95 /* Protocol error */ diff --git a/include/bits/rcode/sys/errno.h b/include/bits/rcode/sys/errno.h @@ -0,0 +1,46 @@ +extern int *geterrno(void); + +#define errno *geterrno() +extern char *const _sys_errlist[]; +extern const int _sys_nerr; + +#define E2BIG 1 /* Argument list too long */ +#define EACCES 2 /* Permission denied */ +#define EAGAIN 3 /* Try again */ +#define EBADF 4 /* Bad file number */ +#define EBUSY 5 /* Device or resource busy */ +#define ECHILD 6 /* No child processes */ +#define EDEADLK 7 /* Resource deadlock would occur */ +#define EEXIST 8 /* File exists */ +#define EFAULT 9 /* Bad address */ +#define EFBIG 10 /* File too large */ +#define EINTR 11 /* Interrupted system call */ +#define EINVAL 12 /* Invalid argument */ +#define EIO 13 /* I/O error */ +#define EISDIR 14 /* Is a directory */ +#define EMFILE 15 /* Too many open files */ +#define EMLINK 16 /* Too many links */ +#define ENAMETOOLONG 17 /* File name too long */ +#define ENFILE 18 /* File table overflow */ +#define ENODEV 19 /* No such device */ +#define ENOENT 20 /* No such file or directory */ +#define ENOEXEC 21 /* Exec format error */ +#define ENOLCK 22 /* No record locks available */ +#define ENOMEM 23 /* Out of memory */ +#define ENOSPC 24 /* No space left on device */ +#define ENOSYS 25 /* Invalid system call number */ +#define ENOTDIR 26 /* Not a directory */ +#define ENOTEMPTY 27 /* Directory not empty */ +#define ENOTTY 28 /* Not a typewriter */ +#define ENXIO 29 /* No such device or address */ +#define EPERM 30 /* Operation not permitted */ +#define EPIPE 31 /* Broken pipe */ +#define EROFS 32 /* Read-only file system */ +#define ESPIPE 33 /* Illegal seek */ +#define ESRCH 34 /* No such process */ +#define EXDEV 35 /* Cross-device link */ +#define ECANCELED 36 /* Operation Canceled */ +#define EINPROGRESS 37 /* Operation now in progress */ +#define ETXTBSY 38 /* Text file busy */ +#define EDOM 39 /* Math argument out of domain of func */ +#define ERANGE 40 /* Math result not representable */ diff --git a/include/ctype.h b/include/ctype.h @@ -26,7 +26,7 @@ extern int toupper(int c); #define _X 0x40 /* hex char */ #define _SP 0x80 /* hard space (0x20) */ -extern unsigned char __ctype[]; +extern const unsigned char __ctype[]; #define isalnum(c) ((__ctype+1)[c] & (_U|_L|_D)) #define isalpha(c) ((__ctype+1)[c] & (_U|_L)) diff --git a/include/errno.h b/include/errno.h @@ -3,8 +3,4 @@ #include <sys/errno.h> -extern int errno; -extern char *_sys_errlist[]; -extern int _sys_nerr; - #endif diff --git a/include/rcode.h b/include/rcode.h @@ -124,7 +124,7 @@ struct bssmap { unsigned char enable; /* System realm enablement */ unsigned char hascrypto; /* System-wide memory encryption */ - int errno; + int errno_; int ndir; int nfil; Entry root; diff --git a/src/libc/arch/amd64/dragonfly/errno.lst b/src/libc/arch/amd64/dragonfly/errno.lst @@ -1,100 +0,0 @@ -EPERM 1 Operation not permitted -ENOENT 2 No such file or directory -ESRCH 3 No such process -EINTR 4 Interrupted system call -EIO 5 Input/output error -ENXIO 6 Device not configured -E2BIG 7 Argument list too long -ENOEXEC 8 Exec format error -EBADF 9 Bad file descriptor -ECHILD 10 No child processes -EDEADLK 11 Resource deadlock avoided -ENOMEM 12 Cannot allocate memory -EACCES 13 Permission denied -EFAULT 14 Bad address -ENOTBLK 15 Block device required -EBUSY 16 Device busy -EEXIST 17 File exists -EXDEV 18 Cross-device link -ENODEV 19 Operation not supported by device -ENOTDIR 20 Not a directory -EISDIR 21 Is a directory -EINVAL 22 Invalid argument -ENFILE 23 Too many open files in system -EMFILE 24 Too many open files -ENOTTY 25 Inappropriate ioctl for device -ETXTBSY 26 Text file busy -EFBIG 27 File too large -ENOSPC 28 No space left on device -ESPIPE 29 Illegal seek -EROFS 30 Read-only filesystem -EMLINK 31 Too many links -EPIPE 32 Broken pipe -EDOM 33 Numerical argument out of domain -ERANGE 34 Result too large -EAGAIN 35 Resource temporarily unavailable -EINPROGRESS 36 Operation now in progress -EALREADY 37 Operation already in progress -ENOTSOCK 38 Socket operation on non-socket -EDESTADDRREQ 39 Destination address required -EMSGSIZE 40 Message too long -EPROTOTYPE 41 Protocol wrong type for socket -ENOPROTOOPT 42 Protocol not available -EPROTONOSUPPORT 43 Protocol not supported -ESOCKTNOSUPPORT 44 Socket type not supported -EOPNOTSUPP 45 Operation not supported -EPFNOSUPPORT 46 Protocol family not supported -EAFNOSUPPORT 47 Address family not supported by protocol family -EADDRINUSE 48 Address already in use -EADDRNOTAVAIL 49 Can't assign requested address -ENETDOWN 50 Network is down -ENETUNREACH 51 Network is unreachable -ENETRESET 52 Network dropped connection on reset -ECONNABORTED 53 Software caused connection abort -ECONNRESET 54 Connection reset by peer -ENOBUFS 55 No buffer space available -EISCONN 56 Socket is already connected -ENOTCONN 57 Socket is not connected -ESHUTDOWN 58 Can't send after socket shutdown -ETOOMANYREFS 59 Too many references: can't splice -ETIMEDOUT 60 Operation timed out -ECONNREFUSED 61 Connection refused -ELOOP 62 Too many levels of symbolic links -ENAMETOOLONG 63 File name too long -EHOSTDOWN 64 Host is down -EHOSTUNREACH 65 No route to host -ENOTEMPTY 66 Directory not empty -EPROCLIM 67 Too many processes -EUSERS 68 Too many users -EDQUOT 69 Disc quota exceeded -ESTALE 70 Stale NFS file handle -EREMOTE 71 Too many levels of remote in path -EBADRPC 72 RPC struct is bad -ERPCMISMATCH 73 RPC version wrong -EPROGUNAVAIL 74 RPC prog. not avail -EPROGMISMATCH 75 Program version wrong -EPROCUNAVAIL 76 Bad procedure for program -ENOLCK 77 No locks available -ENOSYS 78 Function not implemented -EFTYPE 79 Inappropriate file type or format -EAUTH 80 Authentication error -ENEEDAUTH 81 Need authenticator -EIDRM 82 Identifier removed -ENOMSG 83 No message of desired type -EOVERFLOW 84 Value too large to be stored in data type -ECANCELED 85 Operation canceled -EILSEQ 86 Illegal byte sequence -ENOATTR 87 Attribute not found -EDOOFUS 88 Programming error -EBADMSG 89 Bad message -EMULTIHOP 90 Multihop attempted -ENOLINK 91 Link has been severed -EPROTO 92 Protocol error -ENOMEDIUM 93 linux -EUNUSED94 94 -EUNUSED95 95 -EUNUSED96 96 -EUNUSED97 97 -EUNUSED98 98 -EASYNC 99 XXX -ELAST 99 Must be equal largest errno diff --git a/src/libc/arch/amd64/linux/errno.lst b/src/libc/arch/amd64/linux/errno.lst @@ -1,131 +0,0 @@ -EPERM 1 Operation not permitted -ENOENT 2 No such file or directory -ESRCH 3 No such process -EINTR 4 Interrupted system call -EIO 5 I/O error -ENXIO 6 No such device or address -E2BIG 7 Argument list too long -ENOEXEC 8 Exec format error -EBADF 9 Bad file number -ECHILD 10 No child processes -EAGAIN 11 Try again -ENOMEM 12 Out of memory -EACCES 13 Permission denied -EFAULT 14 Bad address -ENOTBLK 15 Block device required -EBUSY 16 Device or resource busy -EEXIST 17 File exists -EXDEV 18 Cross-device link -ENODEV 19 No such device -ENOTDIR 20 Not a directory -EISDIR 21 Is a directory -EINVAL 22 Invalid argument -ENFILE 23 File table overflow -EMFILE 24 Too many open files -ENOTTY 25 Not a typewriter -ETXTBSY 26 Text file busy -EFBIG 27 File too large -ENOSPC 28 No space left on device -ESPIPE 29 Illegal seek -EROFS 30 Read-only file system -EMLINK 31 Too many links -EPIPE 32 Broken pipe -EDOM 33 Math argument out of domain of func -ERANGE 34 Math result not representable -EDEADLK 35 Resource deadlock would occur -ENAMETOOLONG 36 File name too long -ENOLCK 37 No record locks available -ENOSYS 38 Invalid system call number -ENOTEMPTY 39 Directory not empty -ELOOP 40 Too many symbolic links encountered -ENOMSG 42 No message of desired type -EIDRM 43 Identifier removed -ECHRNG 44 Channel number out of range -EL2NSYNC 45 Level 2 not synchronized -EL3HLT 46 Level 3 halted -EL3RST 47 Level 3 reset -ELNRNG 48 Link number out of range -EUNATCH 49 Protocol driver not attached -ENOCSI 50 No CSI structure available -EL2HLT 51 Level 2 halted -EBADE 52 Invalid exchange -EBADR 53 Invalid request descriptor -EXFULL 54 Exchange full -ENOANO 55 No anode -EBADRQC 56 Invalid request code -EBADSLT 57 Invalid slot -EBFONT 59 Bad font file format -ENOSTR 60 Device not a stream -ENODATA 61 No data available -ETIME 62 Timer expired -ENOSR 63 Out of streams resources -ENONET 64 Machine is not on the network -ENOPKG 65 Package not installed -EREMOTE 66 Object is remote -ENOLINK 67 Link has been severed -EADV 68 Advertise error -ESRMNT 69 Srmount error -ECOMM 70 Communication error on send -EPROTO 71 Protocol error -EMULTIHOP 72 Multihop attempted -EDOTDOT 73 RFS specific error -EBADMSG 74 Not a data message -EOVERFLOW 75 Value too large for defined data type -ENOTUNIQ 76 Name not unique on network -EBADFD 77 File descriptor in bad state -EREMCHG 78 Remote address changed -ELIBACC 79 Can not access a needed shared library -ELIBBAD 80 Accessing a corrupted shared library -ELIBSCN 81 .lib section in a.out corrupted -ELIBMAX 82 Attempting to link in too many shared libraries -ELIBEXEC 83 Cannot exec a shared library directly -EILSEQ 84 Illegal byte sequence -ERESTART 85 Interrupted system call should be restarted -ESTRPIPE 86 Streams pipe error -EUSERS 87 Too many users -ENOTSOCK 88 Socket operation on non-socket -EDESTADDRREQ 89 Destination address required -EMSGSIZE 90 Message too long -EPROTOTYPE 91 Protocol wrong type for socket -ENOPROTOOPT 92 Protocol not available -EPROTONOSUPPORT 93 Protocol not supported -ESOCKTNOSUPPORT 94 Socket type not supported -EOPNOTSUPP 95 Operation not supported on transport endpoint -EPFNOSUPPORT 96 Protocol family not supported -EAFNOSUPPORT 97 Address family not supported by protocol -EADDRINUSE 98 Address already in use -EADDRNOTAVAIL 99 Cannot assign requested address -ENETDOWN 100 Network is down -ENETUNREACH 101 Network is unreachable -ENETRESET 102 Network dropped connection because of reset -ECONNABORTED 103 Software caused connection abort -ECONNRESET 104 Connection reset by peer -ENOBUFS 105 No buffer space available -EISCONN 106 Transport endpoint is already connected -ENOTCONN 107 Transport endpoint is not connected -ESHUTDOWN 108 Cannot send after transport endpoint shutdown -ETOOMANYREFS 109 Too many references: cannot splice -ETIMEDOUT 110 Connection timed out -ECONNREFUSED 111 Connection refused -EHOSTDOWN 112 Host is down -EHOSTUNREACH 113 No route to host -EALREADY 114 Operation already in progress -EINPROGRESS 115 Operation now in progress -ESTALE 116 Stale file handle -EUCLEAN 117 Structure needs cleaning -ENOTNAM 118 Not a XENIX named type file -ENAVAIL 119 No XENIX semaphores available -EISNAM 120 Is a named type file -EREMOTEIO 121 Remote I/O error -EDQUOT 122 Quota exceeded -ENOMEDIUM 123 No medium found -EMEDIUMTYPE 124 Wrong medium type -ECANCELED 125 Operation Canceled -ENOKEY 126 Required key not available -EKEYEXPIRED 127 Key has expired -EKEYREVOKED 128 Key has been revoked -EKEYREJECTED 129 Key was rejected by service -EOWNERDEAD 130 Owner died -ENOTRECOVERABLE 131 State not recoverable -ERFKILL 132 Operation not possible due to RF-kill -EHWPOISON 133 Memory page has hardware error diff --git a/src/libc/arch/amd64/netbsd/errno.lst b/src/libc/arch/amd64/netbsd/errno.lst @@ -1,97 +0,0 @@ -EPERM 1 Operation not permitted -ENOENT 2 No such file or directory -ESRCH 3 No such process -EINTR 4 Interrupted system call -EIO 5 Input/output error -ENXIO 6 Device not configured -E2BIG 7 Argument list too long -ENOEXEC 8 Exec format error -EBADF 9 Bad file descriptor -ECHILD 10 No child processes -EDEADLK 11 Resource deadlock avoided -ENOMEM 12 Cannot allocate memory -EACCES 13 Permission denied -EFAULT 14 Bad address -ENOTBLK 15 Block device required -EBUSY 16 Device busy -EEXIST 17 File exists -EXDEV 18 Cross-device link -ENODEV 19 Operation not supported by device -ENOTDIR 20 Not a directory -EISDIR 21 Is a directory -EINVAL 22 Invalid argument -ENFILE 23 Too many open files in system -EMFILE 24 Too many open files -ENOTTY 25 Inappropriate ioctl for device -ETXTBSY 26 Text file busy -EFBIG 27 File too large -ENOSPC 28 No space left on device -ESPIPE 29 Illegal seek -EROFS 30 Read-only file system -EMLINK 31 Too many links -EPIPE 32 Broken pipe -EDOM 33 Numerical argument out of domain -ERANGE 34 Result too large or too small -EAGAIN 35 Resource temporarily unavailable -EINPROGRESS 36 Operation now in progress -EALREADY 37 Operation already in progress -ENOTSOCK 38 Socket operation on non-socket -EDESTADDRREQ 39 Destination address required -EMSGSIZE 40 Message too long -EPROTOTYPE 41 Protocol wrong type for socket -ENOPROTOOPT 42 Protocol option not available -EPROTONOSUPPORT 43 Protocol not supported -ESOCKTNOSUPPORT 44 Socket type not supported -EOPNOTSUPP 45 Operation not supported -EPFNOSUPPORT 46 Protocol family not supported -EAFNOSUPPORT 47 Address family not supported by protocol family -EADDRINUSE 48 Address already in use -EADDRNOTAVAIL 49 Can't assign requested address -ENETDOWN 50 Network is down -ENETUNREACH 51 Network is unreachable -ENETRESET 52 Network dropped connection on reset -ECONNABORTED 53 Software caused connection abort -ECONNRESET 54 Connection reset by peer -ENOBUFS 55 No buffer space available -EISCONN 56 Socket is already connected -ENOTCONN 57 Socket is not connected -ESHUTDOWN 58 Can't send after socket shutdown -ETOOMANYREFS 59 Too many references: can't splice -ETIMEDOUT 60 Operation timed out -ECONNREFUSED 61 Connection refused -ELOOP 62 Too many levels of symbolic links -ENAMETOOLONG 63 File name too long -EHOSTDOWN 64 Host is down -EHOSTUNREACH 65 No route to host -ENOTEMPTY 66 Directory not empty -EPROCLIM 67 Too many processes -EUSERS 68 Too many users -EDQUOT 69 Disc quota exceeded -ESTALE 70 Stale NFS file handle -EREMOTE 71 Too many levels of remote in path -EBADRPC 72 RPC struct is bad -ERPCMISMATCH 73 RPC version wrong -EPROGUNAVAIL 74 RPC prog. not avail -EPROGMISMATCH 75 Program version wrong -EPROCUNAVAIL 76 Bad procedure for program -ENOLCK 77 No locks available -ENOSYS 78 Function not implemented -EFTYPE 79 Inappropriate file type or format -EAUTH 80 Authentication error -ENEEDAUTH 81 Need authenticator -EIDRM 82 Identifier removed -ENOMSG 83 No message of desired type -EOVERFLOW 84 Value too large to be stored in data type -EILSEQ 85 Illegal byte sequence -ENOTSUP 86 Not supported -ECANCELED 87 Operation canceled -EBADMSG 88 Bad or Corrupt message -ENODATA 89 No message available -ENOSR 90 No STREAM resources -ENOSTR 91 Not a STREAM -ETIME 92 STREAM ioctl timeout -ENOATTR 93 Attribute not found -EMULTIHOP 94 Multihop attempted -ENOLINK 95 Link has been severed -EPROTO 96 Protocol error -ELAST 96 Must equal largest errno diff --git a/src/libc/arch/amd64/openbsd/errno.lst b/src/libc/arch/amd64/openbsd/errno.lst @@ -1,96 +0,0 @@ -EPERM 1 Operation not permitted -ENOENT 2 No such file or directory -ESRCH 3 No such process -EINTR 4 Interrupted system call -EIO 5 Input/output error -ENXIO 6 Device not configured -E2BIG 7 Argument list too long -ENOEXEC 8 Exec format error -EBADF 9 Bad file descriptor -ECHILD 10 No child processes -EDEADLK 11 Resource deadlock avoided -ENOMEM 12 Cannot allocate memory -EACCES 13 Permission denied -EFAULT 14 Bad address -ENOTBLK 15 Block device required -EBUSY 16 Device busy -EEXIST 17 File exists -EXDEV 18 Cross-device link -ENODEV 19 Operation not supported by device -ENOTDIR 20 Not a directory -EISDIR 21 Is a directory -EINVAL 22 Invalid argument -ENFILE 23 Too many open files in system -EMFILE 24 Too many open files -ENOTTY 25 Inappropriate ioctl for device -ETXTBSY 26 Text file busy -EFBIG 27 File too large -ENOSPC 28 No space left on device -ESPIPE 29 Illegal seek -EROFS 30 Read-only file system -EMLINK 31 Too many links -EPIPE 32 Broken pipe -EDOM 33 Numerical argument out of domain -ERANGE 34 Result too large -EAGAIN 35 Resource temporarily unavailable -EINPROGRESS 36 Operation now in progress -EALREADY 37 Operation already in progress -ENOTSOCK 38 Socket operation on non-socket -EDESTADDRREQ 39 Destination address required -EMSGSIZE 40 Message too long -EPROTOTYPE 41 Protocol wrong type for socket -ENOPROTOOPT 42 Protocol not available -EPROTONOSUPPORT 43 Protocol not supported -ESOCKTNOSUPPORT 44 Socket type not supported -EOPNOTSUPP 45 Operation not supported -EPFNOSUPPORT 46 Protocol family not supported -EAFNOSUPPORT 47 Address family not supported by protocol family -EADDRINUSE 48 Address already in use -EADDRNOTAVAIL 49 Can't assign requested address -ENETDOWN 50 Network is down -ENETUNREACH 51 Network is unreachable -ENETRESET 52 Network dropped connection on reset -ECONNABORTED 53 Software caused connection abort -ECONNRESET 54 Connection reset by peer -ENOBUFS 55 No buffer space available -EISCONN 56 Socket is already connected -ENOTCONN 57 Socket is not connected -ESHUTDOWN 58 Can't send after socket shutdown -ETOOMANYREFS 59 Too many references: can't splice -ETIMEDOUT 60 Operation timed out -ECONNREFUSED 61 Connection refused -ELOOP 62 Too many levels of symbolic links -ENAMETOOLONG 63 File name too long -EHOSTDOWN 64 Host is down -EHOSTUNREACH 65 No route to host -ENOTEMPTY 66 Directory not empty -EPROCLIM 67 Too many processes -EUSERS 68 Too many users -EDQUOT 69 Disk quota exceeded -ESTALE 70 Stale NFS file handle -EREMOTE 71 Too many levels of remote in path -EBADRPC 72 RPC struct is bad -ERPCMISMATCH 73 RPC version wrong -EPROGUNAVAIL 74 RPC program not available -EPROGMISMATCH 75 Program version wrong -EPROCUNAVAIL 76 Bad procedure for program -ENOLCK 77 No locks available -ENOSYS 78 Function not implemented -EFTYPE 79 Inappropriate file type or format -EAUTH 80 Authentication error -ENEEDAUTH 81 Need authenticator -EIPSEC 82 IPsec processing failure -ENOATTR 83 Attribute not found -EILSEQ 84 Illegal byte sequence -ENOMEDIUM 85 No medium found -EMEDIUMTYPE 86 Wrong medium type -EOVERFLOW 87 Value too large to be stored in data type -ECANCELED 88 Operation canceled -EIDRM 89 Identifier removed -ENOMSG 90 No message of desired type -ENOTSUP 91 Not supported -EBADMSG 92 Bad message -ENOTRECOVERABLE 93 State not recoverable -EOWNERDEAD 94 Previous owner died -EPROTO 95 Protocol error -ELAST 95 Must be equal largest errno diff --git a/src/libc/arch/arm64/linux/Makefile b/src/libc/arch/arm64/linux/Makefile @@ -34,4 +34,4 @@ syscall: syscall.lst clean: rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst` - rm -f syscall + rm -f syscall _sys_errlist.c diff --git a/src/libc/arch/arm64/linux/errno.lst b/src/libc/arch/arm64/linux/errno.lst @@ -1,126 +0,0 @@ -EPERM 1 Not owner -ENOENT 2 No such file or directory -ESRCH 3 No such process -EINTR 4 Interrupted system call -EIO 5 I/O error -ENXIO 6 No such device or address -E2BIG 7 Arg list too long -ENOEXEC 8 Exec format error -EBADF 9 Bad file number -ECHILD 10 No children -EAGAIN 11 No more processes -ENOMEM 12 Not enough space -EACCES 13 Permission denied -EFAULT 14 Bad address -ENOTBLK 15 Block device required -EBUSY 16 Device or resource busy -EEXIST 17 File exists -EXDEV 18 Cross-device link -ENODEV 19 No such device -ENOTDIR 20 Not a directory -EISDIR 21 Is a directory -EINVAL 22 Invalid argument -ENFILE 23 Too many open files in system -EMFILE 24 File descriptor value too large -ENOTTY 25 Not a character device -ETXTBSY 26 Text file busy -EFBIG 27 File too large -ENOSPC 28 No space left on device -ESPIPE 29 Illegal seek -EROFS 30 Read-only file system -EMLINK 31 Too many links -EPIPE 32 Broken pipe -EDOM 33 Mathematics argument out of domain of function -ERANGE 34 Result too large -ENOMSG 35 No message of desired type -EIDRM 36 Identifier removed -ECHRNG 37 Channel number out of range -EL2NSYNC 38 Level 2 not synchronized -EL3HLT 39 Level 3 halted -EL3RST 40 Level 3 reset -ELNRNG 41 Link number out of range -EUNATCH 42 Protocol driver not attached -ENOCSI 43 No CSI structure available -EL2HLT 44 Level 2 halted -EDEADLK 45 Deadlock -ENOLCK 46 No lock -EBADE 50 Invalid exchange -EBADR 51 Invalid request descriptor -EXFULL 52 Exchange full -ENOANO 53 No anode -EBADRQC 54 Invalid request code -EBADSLT 55 Invalid slot -EDEADLOCK 56 File locking deadlock error -EBFONT 57 Bad font file fmt -ENOSTR 60 Not a stream -ENODATA 61 No data (for no delay io) -ETIME 62 Stream ioctl timeout -ENOSR 63 No stream resources -ENONET 64 Machine is not on the network -ENOPKG 65 Package not installed -EREMOTE 66 The object is remote -ENOLINK 67 Virtual circuit is gone -EADV 68 Advertise error -ESRMNT 69 Srmount error -ECOMM 70 Communication error on send -EPROTO 71 Protocol error -EMULTIHOP 74 Multihop attempted -ELBIN 75 Inode is remote (not really error) -EDOTDOT 76 Cross mount point (not really error) -EBADMSG 77 Bad message -EFTYPE 79 Inappropriate file type or format -ENOTUNIQ 80 Given log. name not unique -EBADFD 81 f.d. invalid for this operation -EREMCHG 82 Remote address changed -ELIBACC 83 Can't access a needed shared lib -ELIBBAD 84 Accessing a corrupted shared lib -ELIBSCN 85 .lib section in a.out corrupted -ELIBMAX 86 Attempting to link in too many libs -ELIBEXEC 87 Attempting to exec a shared library -ENOSYS 88 Function not implemented -ENMFILE 89 No more files -ENOTEMPTY 90 Directory not empty -ENAMETOOLONG 91 File or path name too long -ELOOP 92 Too many symbolic links -EOPNOTSUPP 95 Operation not supported on socket -EPFNOSUPPORT 96 Protocol family not supported -ECONNRESET 104 Connection reset by peer -ENOBUFS 105 No buffer space available -EAFNOSUPPORT 106 Address family not supported by protocol family -EPROTOTYPE 107 Protocol wrong type for socket -ENOTSOCK 108 Socket operation on non-socket -ENOPROTOOPT 109 Protocol not available -ESHUTDOWN 110 Can't send after socket shutdown -ECONNREFUSED 111 Connection refused -EADDRINUSE 112 Address already in use -ECONNABORTED 113 Software caused connection abort -ENETUNREACH 114 Network is unreachable -ENETDOWN 115 Network interface is not configured -ETIMEDOUT 116 Connection timed out -EHOSTDOWN 117 Host is down -EHOSTUNREACH 118 Host is unreachable -EINPROGRESS 119 Connection already in progress -EALREADY 120 Socket already connected -EDESTADDRREQ 121 Destination address required -EMSGSIZE 122 Message too long -EPROTONOSUPPORT 123 Unknown protocol -ESOCKTNOSUPPORT 124 Socket type not supported -EADDRNOTAVAIL 125 Address not available -ENETRESET 126 Connection aborted by network -EISCONN 127 Socket is already connected -ENOTCONN 128 Socket is not connected -ETOOMANYREFS 129 -EPROCLIM 130 -EUSERS 131 -EDQUOT 132 -ESTALE 133 -ENOTSUP 134 Not supported -ENOMEDIUM 135 No medium (in tape drive) -ENOSHARE 136 No such host or network path -ECASECLASH 137 Filename exists with different case -EILSEQ 138 Illegal byte sequence -EOVERFLOW 139 Value too large for defined data type -ECANCELED 140 Operation canceled -ENOTRECOVERABLE 141 State not recoverable -EOWNERDEAD 142 Previous owner died -ESTRPIPE 143 Streams pipe error diff --git a/src/libc/arch/generrno.sh b/src/libc/arch/generrno.sh @@ -1,35 +0,0 @@ -#!/bin/sh - -trap 'r=$?; rm -f $$.tmp; exit $r' EXIT HUP QUIT INT TERM - -for i -do - case $i in - -o) - out=$2 - shift 2 - ;; - --) - shift - break - ;; - -*) - echo usage: generrno.sh [-o output] file ... - exit 1 - ;; - *) - break - ;; - esac -done - -awk ' -/^E/ && $2 > 0 { - errno[$1] = $2 -} - -END { - for (i in errno) - print "#define", i, errno[i] | "sort -n -k3" - close("sort -n -k3") -}' $@ > $$.tmp && mv $$.tmp ${out:-errno.h} diff --git a/src/libc/arch/generrstr.sh b/src/libc/arch/generrstr.sh @@ -1,23 +0,0 @@ -#!/bin/sh - -trap 'r=$?; rm -f $$.tmp; exit $r' EXIT HUP INT QUIT TERM - -awk ' -/^E/ && $2 > 0 { - str = "" - for (i = 3; i <= NF; i++) - str = str " " $i - sub(/^ /, "", str) - errstr[$1] = str - if ($2 > max) - max = $2; -} - -END { - print "#include <errno.h>\n" - print "char *_sys_errlist[] = {" - for (i in errstr) - printf "\t%-20.20s = \"%s\",\n", "[" i "]", errstr[i] - print "};" - print "int _sys_nerr =", $2 + 1 ";" -}' $@ > $$.tmp && mv $$.tmp _sys_errlist.c diff --git a/src/libc/arch/mkerrstr b/src/libc/arch/mkerrstr @@ -0,0 +1,23 @@ +#!/bin/sh + +trap 'r=$?; rm -f $$.tmp; exit $r' EXIT HUP INT QUIT TERM + +awk ' +/^#define[ \t]*E/{ + str = "" + for (i = 5; i < NF; i++) + str = str " " $i + sub(/^ /, "", str) + errstr[$2] = str + if ($3 > max) + max = $3; +} + +END { + print "#include <errno.h>\n" + print "char *const _sys_errlist[] = {" + for (i in errstr) + printf "\t%-20.20s = \"%s\",\n", "[" i "]", errstr[i] + print "};" + print "const int _sys_nerr =", $2 + 1 ";" +}' $@ > $$.tmp && mv $$.tmp _sys_errlist.c diff --git a/src/libc/arch/rmode/rcode/Makefile b/src/libc/arch/rmode/rcode/Makefile @@ -10,3 +10,6 @@ OBJS = _Exit.o \ _read.o \ all: $(OBJS) + +clean: + rm -f _sys_errlist.c diff --git a/src/libc/arch/rmode/rcode/errno.lst b/src/libc/arch/rmode/rcode/errno.lst @@ -1,40 +0,0 @@ -E2BIG 1 Argument list too long -EACCES 2 Permission denied -EAGAIN 3 Try again -EBADF 4 Bad file number -EBUSY 5 Device or resource busy -ECHILD 6 No child processes -EDEADLK 7 Resource deadlock would occur -EEXIST 8 File exists -EFAULT 9 Bad address -EFBIG 10 File too large -EINTR 11 Interrupted system call -EINVAL 12 Invalid argument -EIO 13 I/O error -EISDIR 14 Is a directory -EMFILE 15 Too many open files -EMLINK 16 Too many links -ENAMETOOLONG 17 File name too long -ENFILE 18 File table overflow -ENODEV 19 No such device -ENOENT 20 No such file or directory -ENOEXEC 21 Exec format error -ENOLCK 22 No record locks available -ENOMEM 23 Out of memory -ENOSPC 24 No space left on device -ENOSYS 25 Invalid system call number -ENOTDIR 26 Not a directory -ENOTEMPTY 27 Directory not empty -ENOTTY 28 Not a typewriter -ENXIO 29 No such device or address -EPERM 30 Operation not permitted -EPIPE 31 Broken pipe -EROFS 32 Read-only file system -ESPIPE 33 Illegal seek -ESRCH 34 No such process -EXDEV 35 Cross-device link -ECANCELED 36 Operation Canceled -EINPROGRESS 37 Operation now in progress -ETXTBSY 38 Text file busy -EDOM 39 Math argument out of domain of func -ERANGE 40 Math result not representable diff --git a/src/libc/arch/rules.mk b/src/libc/arch/rules.mk @@ -1,7 +1,4 @@ SYSERRNO = $(INCDIR)/bits/$(SYS)/sys/errno.h -$(SYSERRNO): errno.lst - ../../generrno.sh -o $@ errno.lst - -_sys_errlist.c: errno.lst $(SYSERRNO) - ../../generrstr.sh errno.lst +_sys_errlist.c: $(SYSERRNO) + ../../mkerrstr $(SYSERRNO) diff --git a/src/libc/ctype/ctype.c b/src/libc/ctype/ctype.c @@ -1,9 +1,7 @@ #include <ctype.h> -int __ctmp; - /* __ctype is shifted by one to match EOF */ -unsigned char __ctype[257] = { +const unsigned char __ctype[257] = { 0, /* EOF */ _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ diff --git a/src/libc/stdlib/strtoull.c b/src/libc/stdlib/strtoull.c @@ -11,7 +11,7 @@ strtoull(const char *s, char **end, int base) { int d, sign = 1; unsigned long long n; - static char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + static const char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const char *t, *p; while (isspace(*s)) diff --git a/src/romfw/dirfs.c b/src/romfw/dirfs.c @@ -1,4 +1,6 @@ +#include <errno.h> #include <string.h> + #include <rcode.h> #include "fs.h" @@ -37,7 +39,7 @@ dirfs_write(File *fp, void *buf, int n) return 0; if ((ep->flags & FSWRITE) == 0) { - bss->errno = 1; + errno = 1; return -1; } return 0; @@ -52,7 +54,7 @@ dirfs_read(File *fp, void *buf, int n) ep = fp->entry; if ((fp->flags & FSREAD) == 0) { - bss->errno = 1; + errno = 1; return -1; } @@ -77,7 +79,7 @@ dirfs_read(File *fp, void *buf, int n) ep->name, (unsigned long long) ep->size); if (len >= n) { - bss->errno = 1; + errno = 1; return -1; } fp->off++; diff --git a/src/romfw/fs.c b/src/romfw/fs.c @@ -1,4 +1,6 @@ +#include <errno.h> #include <string.h> + #include <rcode.h> #include "fs.h" @@ -7,7 +9,7 @@ static File * validfd(int fd) { if (fd < 0 || fd >= NR_FILS) { - bss->errno = 1; + errno = 1; return NULL; } return &bss->filtbl[fd]; @@ -73,13 +75,13 @@ bind(const char *name, char *where) walk(name, &w1); if (!w1.entry) { - bss->errno = 1; + errno = 1; return -1; } walk(where, &w2); if (!w2.entry || (w2.entry->flags & FSDIR) == 0) { - bss->errno = 1; + errno = 1; return -1; } @@ -101,7 +103,7 @@ chdir(const char *name) walk(name, &w); ep = w.entry; if (!ep || (ep->flags & FSDIR) == 0) { - bss->errno = 1; + errno = 1; return -1; } bss->cwd = ep; @@ -117,18 +119,18 @@ open(const char *name, int flags) int (*fn)(File *fp, Walk *wp, int flags); if (flags == 0 || (flags & ~(FSREAD|FSWRITE)) != 0) { - bss->errno = 1; + errno = 1; return -1; } walk(name, &w); if (w.remaning) { - bss->errno = 1; + errno = 1; return -1; } if ((w.fs->flags & flags) != flags) { - bss->errno = 1; + errno = 1; return 1; } @@ -137,7 +139,7 @@ open(const char *name, int flags) ; if (fp == lim) { - bss->errno = 1; + errno = 1; return -1; } @@ -182,13 +184,13 @@ read(int fd, void *buf, int n) return -1; if ((fp->flags & FSREAD) == 0) { - bss->errno = 1; + errno = 1; return -1; } fn = fp->fs->read; if (!fn) { - bss->errno = 1; + errno = 1; return -1; } @@ -205,13 +207,13 @@ write(int fd, void *buf, int n) return -1; if ((fp->flags & FSWRITE) == 0) { - bss->errno = 1; + errno = 1; return -1; } fn = fp->fs->write; if (!fn) { - bss->errno = 1; + errno = 1; return -1; } @@ -229,7 +231,7 @@ seek(int fd, off_t off, int whence) fn = fp->fs->seek; if (!fn) { - bss->errno = 1; + errno = 1; return -1; } @@ -270,18 +272,18 @@ create(const char *name, int flags) mode = flags & (FSREAD|FSWRITE); if (mode == 0) { - bss->errno = 1; + errno = 1; return -1; } walk(name, &w); if (!validname(w.remaning)) { - bss->errno = 2; + errno = 2; return -1; } if ((w.entry->flags & FSCREATE) == 0) { - bss->errno = 3; + errno = 3; return -1; } @@ -289,7 +291,7 @@ create(const char *name, int flags) for (ep = bss->enttbl; ep < lim && ep->fs ; ep++) ; if (ep == lim) { - bss->errno = 4; + errno = 4; return -1; }