2000-02-18 03:39:52 +08:00
|
|
|
/* errno is not a global variable, because that would make using it
|
|
|
|
non-reentrant. Instead, its address is returned by the function
|
|
|
|
__errno. */
|
|
|
|
|
|
|
|
#ifndef _SYS_ERRNO_H_
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
#define _SYS_ERRNO_H_
|
|
|
|
|
|
|
|
#include <sys/reent.h>
|
|
|
|
|
Add --enable-newlib-reent-thread-local option
By default, Newlib uses a huge object of type struct _reent to store
thread-specific data. This object is returned by __getreent() if the
__DYNAMIC_REENT__ Newlib configuration option is defined.
The reentrancy structure contains for example errno and the standard input,
output, and error file streams. This means that if an application only uses
errno it has a dependency on the file stream support even if it does not use
it. This is an issue for lower end targets and applications which need to
qualify the software according to safety standards (for example ECSS-E-ST-40C,
ECSS-Q-ST-80C, IEC 61508, ISO 26262, DO-178, DO-330, DO-333).
If the new _REENT_THREAD_LOCAL configuration option is enabled, then struct
_reent is replaced by dedicated thread-local objects for each struct _reent
member. The thread-local objects are defined in translation units which use
the corresponding object.
2022-05-16 17:51:54 +08:00
|
|
|
#ifdef _REENT_THREAD_LOCAL
|
|
|
|
#define errno (_tls_errno)
|
|
|
|
#else /* _REENT_THREAD_LOCAL */
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifndef _REENT_ONLY
|
|
|
|
#define errno (*__errno())
|
2017-12-04 10:41:16 +08:00
|
|
|
extern int *__errno (void);
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif
|
|
|
|
|
Add --enable-newlib-reent-thread-local option
By default, Newlib uses a huge object of type struct _reent to store
thread-specific data. This object is returned by __getreent() if the
__DYNAMIC_REENT__ Newlib configuration option is defined.
The reentrancy structure contains for example errno and the standard input,
output, and error file streams. This means that if an application only uses
errno it has a dependency on the file stream support even if it does not use
it. This is an issue for lower end targets and applications which need to
qualify the software according to safety standards (for example ECSS-E-ST-40C,
ECSS-Q-ST-80C, IEC 61508, ISO 26262, DO-178, DO-330, DO-333).
If the new _REENT_THREAD_LOCAL configuration option is enabled, then struct
_reent is replaced by dedicated thread-local objects for each struct _reent
member. The thread-local objects are defined in translation units which use
the corresponding object.
2022-05-16 17:51:54 +08:00
|
|
|
#endif /* _REENT_THREAD_LOCAL */
|
|
|
|
|
2001-08-26 10:28:33 +08:00
|
|
|
/* Please don't use these variables directly.
|
|
|
|
Use strerror instead. */
|
2017-12-04 10:25:16 +08:00
|
|
|
extern __IMPORT const char * const _sys_errlist[];
|
2000-08-02 04:51:51 +08:00
|
|
|
extern __IMPORT int _sys_nerr;
|
2001-08-14 22:36:58 +08:00
|
|
|
#ifdef __CYGWIN__
|
|
|
|
extern __IMPORT const char * const sys_errlist[];
|
|
|
|
extern __IMPORT int sys_nerr;
|
2010-12-27 05:11:38 +08:00
|
|
|
extern __IMPORT char *program_invocation_name;
|
|
|
|
extern __IMPORT char *program_invocation_short_name;
|
2001-08-14 22:36:58 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2022-01-18 17:13:04 +08:00
|
|
|
#define __errno_r(ptr) _REENT_ERRNO(ptr)
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2014-07-14 21:40:17 +08:00
|
|
|
#define EPERM 1 /* Not owner */
|
2000-02-18 03:39:52 +08:00
|
|
|
#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 /* Arg list too long */
|
|
|
|
#define ENOEXEC 8 /* Exec format error */
|
|
|
|
#define EBADF 9 /* Bad file number */
|
|
|
|
#define ECHILD 10 /* No children */
|
|
|
|
#define EAGAIN 11 /* No more processes */
|
2014-07-14 21:40:17 +08:00
|
|
|
#define ENOMEM 12 /* Not enough space */
|
2000-02-18 03:39:52 +08:00
|
|
|
#define EACCES 13 /* Permission denied */
|
|
|
|
#define EFAULT 14 /* Bad address */
|
2009-03-21 04:44:14 +08:00
|
|
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
2000-02-18 03:39:52 +08:00
|
|
|
#define ENOTBLK 15 /* Block device required */
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
2014-07-14 21:40:17 +08:00
|
|
|
#define EBUSY 16 /* Device or resource busy */
|
2000-02-18 03:39:52 +08:00
|
|
|
#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 /* Too many open files in system */
|
2014-07-14 21:40:17 +08:00
|
|
|
#define EMFILE 24 /* File descriptor value too large */
|
|
|
|
#define ENOTTY 25 /* Not a character device */
|
2000-02-18 03:39:52 +08:00
|
|
|
#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 */
|
2014-07-14 21:40:17 +08:00
|
|
|
#define EROFS 30 /* Read-only file system */
|
2000-02-18 03:39:52 +08:00
|
|
|
#define EMLINK 31 /* Too many links */
|
|
|
|
#define EPIPE 32 /* Broken pipe */
|
2014-07-14 21:40:17 +08:00
|
|
|
#define EDOM 33 /* Mathematics argument out of domain of function */
|
|
|
|
#define ERANGE 34 /* Result too large */
|
2000-02-18 03:39:52 +08:00
|
|
|
#define ENOMSG 35 /* No message of desired type */
|
|
|
|
#define EIDRM 36 /* Identifier removed */
|
2009-03-21 04:44:14 +08:00
|
|
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
2000-02-18 03:39:52 +08:00
|
|
|
#define ECHRNG 37 /* Channel number out of range */
|
|
|
|
#define EL2NSYNC 38 /* Level 2 not synchronized */
|
|
|
|
#define EL3HLT 39 /* Level 3 halted */
|
|
|
|
#define EL3RST 40 /* Level 3 reset */
|
|
|
|
#define ELNRNG 41 /* Link number out of range */
|
|
|
|
#define EUNATCH 42 /* Protocol driver not attached */
|
|
|
|
#define ENOCSI 43 /* No CSI structure available */
|
|
|
|
#define EL2HLT 44 /* Level 2 halted */
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
2014-07-14 21:40:17 +08:00
|
|
|
#define EDEADLK 45 /* Deadlock */
|
|
|
|
#define ENOLCK 46 /* No lock */
|
2009-03-21 04:44:14 +08:00
|
|
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
2000-02-18 03:39:52 +08:00
|
|
|
#define EBADE 50 /* Invalid exchange */
|
|
|
|
#define EBADR 51 /* Invalid request descriptor */
|
|
|
|
#define EXFULL 52 /* Exchange full */
|
|
|
|
#define ENOANO 53 /* No anode */
|
|
|
|
#define EBADRQC 54 /* Invalid request code */
|
|
|
|
#define EBADSLT 55 /* Invalid slot */
|
|
|
|
#define EDEADLOCK 56 /* File locking deadlock error */
|
|
|
|
#define EBFONT 57 /* Bad font file fmt */
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
2014-07-14 21:40:17 +08:00
|
|
|
#define ENOSTR 60 /* Not a stream */
|
2000-02-18 03:39:52 +08:00
|
|
|
#define ENODATA 61 /* No data (for no delay io) */
|
2014-07-14 21:40:17 +08:00
|
|
|
#define ETIME 62 /* Stream ioctl timeout */
|
|
|
|
#define ENOSR 63 /* No stream resources */
|
2009-03-21 04:44:14 +08:00
|
|
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
2000-02-18 03:39:52 +08:00
|
|
|
#define ENONET 64 /* Machine is not on the network */
|
|
|
|
#define ENOPKG 65 /* Package not installed */
|
|
|
|
#define EREMOTE 66 /* The object is remote */
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
2014-07-14 21:40:17 +08:00
|
|
|
#define ENOLINK 67 /* Virtual circuit is gone */
|
2009-03-21 04:44:14 +08:00
|
|
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
2000-02-18 03:39:52 +08:00
|
|
|
#define EADV 68 /* Advertise error */
|
|
|
|
#define ESRMNT 69 /* Srmount error */
|
|
|
|
#define ECOMM 70 /* Communication error on send */
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
#define EPROTO 71 /* Protocol error */
|
|
|
|
#define EMULTIHOP 74 /* Multihop attempted */
|
2009-03-21 04:44:14 +08:00
|
|
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
2000-02-18 03:39:52 +08:00
|
|
|
#define ELBIN 75 /* Inode is remote (not really error) */
|
|
|
|
#define EDOTDOT 76 /* Cross mount point (not really error) */
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
2014-07-14 21:40:17 +08:00
|
|
|
#define EBADMSG 77 /* Bad message */
|
2002-06-21 03:51:40 +08:00
|
|
|
#define EFTYPE 79 /* Inappropriate file type or format */
|
2009-03-25 00:05:07 +08:00
|
|
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
2000-02-18 03:39:52 +08:00
|
|
|
#define ENOTUNIQ 80 /* Given log. name not unique */
|
|
|
|
#define EBADFD 81 /* f.d. invalid for this operation */
|
|
|
|
#define EREMCHG 82 /* Remote address changed */
|
|
|
|
#define ELIBACC 83 /* Can't access a needed shared lib */
|
|
|
|
#define ELIBBAD 84 /* Accessing a corrupted shared lib */
|
|
|
|
#define ELIBSCN 85 /* .lib section in a.out corrupted */
|
|
|
|
#define ELIBMAX 86 /* Attempting to link in too many libs */
|
|
|
|
#define ELIBEXEC 87 /* Attempting to exec a shared library */
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
#define ENOSYS 88 /* Function not implemented */
|
2009-03-21 04:44:14 +08:00
|
|
|
#ifdef __CYGWIN__
|
2000-02-18 03:39:52 +08:00
|
|
|
#define ENMFILE 89 /* No more files */
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
#define ENOTEMPTY 90 /* Directory not empty */
|
|
|
|
#define ENAMETOOLONG 91 /* File or path name too long */
|
|
|
|
#define ELOOP 92 /* Too many symbolic links */
|
2014-07-14 21:40:17 +08:00
|
|
|
#define EOPNOTSUPP 95 /* Operation not supported on socket */
|
2000-02-18 03:39:52 +08:00
|
|
|
#define EPFNOSUPPORT 96 /* Protocol family not supported */
|
|
|
|
#define ECONNRESET 104 /* Connection reset by peer */
|
|
|
|
#define ENOBUFS 105 /* No buffer space available */
|
2000-12-05 02:01:50 +08:00
|
|
|
#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
|
|
|
|
#define EPROTOTYPE 107 /* Protocol wrong type for socket */
|
|
|
|
#define ENOTSOCK 108 /* Socket operation on non-socket */
|
|
|
|
#define ENOPROTOOPT 109 /* Protocol not available */
|
2009-03-21 04:44:14 +08:00
|
|
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
2000-12-05 02:01:50 +08:00
|
|
|
#define ESHUTDOWN 110 /* Can't send after socket shutdown */
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
#define ECONNREFUSED 111 /* Connection refused */
|
|
|
|
#define EADDRINUSE 112 /* Address already in use */
|
2014-07-14 21:40:17 +08:00
|
|
|
#define ECONNABORTED 113 /* Software caused connection abort */
|
2000-12-05 02:01:50 +08:00
|
|
|
#define ENETUNREACH 114 /* Network is unreachable */
|
|
|
|
#define ENETDOWN 115 /* Network interface is not configured */
|
|
|
|
#define ETIMEDOUT 116 /* Connection timed out */
|
|
|
|
#define EHOSTDOWN 117 /* Host is down */
|
|
|
|
#define EHOSTUNREACH 118 /* Host is unreachable */
|
|
|
|
#define EINPROGRESS 119 /* Connection already in progress */
|
|
|
|
#define EALREADY 120 /* Socket already connected */
|
|
|
|
#define EDESTADDRREQ 121 /* Destination address required */
|
|
|
|
#define EMSGSIZE 122 /* Message too long */
|
|
|
|
#define EPROTONOSUPPORT 123 /* Unknown protocol */
|
2009-03-21 04:44:14 +08:00
|
|
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
2000-12-05 02:01:50 +08:00
|
|
|
#define ESOCKTNOSUPPORT 124 /* Socket type not supported */
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
2000-12-05 02:01:50 +08:00
|
|
|
#define EADDRNOTAVAIL 125 /* Address not available */
|
2014-07-14 21:40:17 +08:00
|
|
|
#define ENETRESET 126 /* Connection aborted by network */
|
2000-12-05 02:01:50 +08:00
|
|
|
#define EISCONN 127 /* Socket is already connected */
|
|
|
|
#define ENOTCONN 128 /* Socket is not connected */
|
2000-02-18 03:39:52 +08:00
|
|
|
#define ETOOMANYREFS 129
|
2009-12-17 03:33:10 +08:00
|
|
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
2000-02-18 03:39:52 +08:00
|
|
|
#define EPROCLIM 130
|
|
|
|
#define EUSERS 131
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
#define EDQUOT 132
|
|
|
|
#define ESTALE 133
|
2000-12-05 02:01:50 +08:00
|
|
|
#define ENOTSUP 134 /* Not supported */
|
2009-03-21 04:44:14 +08:00
|
|
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
2000-05-03 23:59:37 +08:00
|
|
|
#define ENOMEDIUM 135 /* No medium (in tape drive) */
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
|
|
|
#ifdef __CYGWIN__
|
2000-05-03 23:59:37 +08:00
|
|
|
#define ENOSHARE 136 /* No such host or network path */
|
2001-04-13 05:17:27 +08:00
|
|
|
#define ECASECLASH 137 /* Filename exists with different case */
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
2014-07-14 21:40:17 +08:00
|
|
|
#define EILSEQ 138 /* Illegal byte sequence */
|
2002-09-24 22:10:12 +08:00
|
|
|
#define EOVERFLOW 139 /* Value too large for defined data type */
|
2008-09-20 00:11:35 +08:00
|
|
|
#define ECANCELED 140 /* Operation canceled */
|
|
|
|
#define ENOTRECOVERABLE 141 /* State not recoverable */
|
|
|
|
#define EOWNERDEAD 142 /* Previous owner died */
|
2009-03-21 04:44:14 +08:00
|
|
|
#ifdef __LINUX_ERRNO_EXTENSIONS__
|
2009-03-15 21:41:46 +08:00
|
|
|
#define ESTRPIPE 143 /* Streams pipe error */
|
2009-03-21 04:44:14 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
#define EWOULDBLOCK EAGAIN /* Operation would block */
|
|
|
|
|
|
|
|
#define __ELASTERROR 2000 /* Users can add values starting here */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* _SYS_ERRNO_H */
|