1 /*
2  * Copyright (c) 1984-1999, 2012 Wind River Systems, Inc.
3  * Copyright (c) 2021 Nordic Semiconductor ASA
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 /*
9  * Copyright (c) 1982, 1986 Regents of the University of California.
10  * All rights reserved.  The Berkeley software License Agreement
11  * specifies the terms and conditions for redistribution.
12  *
13  *	@(#)errno.h	7.1 (Berkeley) 6/4/86
14  */
15 
16 /**
17  * @file
18  * @brief System error numbers
19  */
20 
21 #ifndef ZEPHYR_LIB_LIBC_ARMSTDC_INCLUDE_ERRNO_H_
22 #define ZEPHYR_LIB_LIBC_ARMSTDC_INCLUDE_ERRNO_H_
23 
24 /**
25  * @brief System error numbers
26  *        Error codes returned by functions.
27  *        Includes a list of those defined by IEEE Std 1003.1-2017.
28  *
29  *        This file is supposed to be used together with ARMClang and
30  *        #define _AEABI_PORTABILITY_LEVEL 1
31  *        or
32  *        -D_AEABI_PORTABILITY_LEVEL=1
33  *
34  *        For details, please refer to the document:
35  *        'C Library ABI for the Arm® Architecture, 2021Q1'
36  *
37  * @defgroup system_errno Error numbers
38  * @{
39  */
40 
41 #include <zephyr/sys/errno_private.h>
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 #define errno (*z_errno())
48 
49 #define EPERM 1         /**< Not owner */
50 #define ENOENT 2        /**< No such file or directory */
51 #define ESRCH 3         /**< No such context */
52 #define EINTR 4         /**< Interrupted system call */
53 #define EIO 5           /**< I/O error */
54 #define ENXIO 6         /**< No such device or address */
55 #define E2BIG 7         /**< Arg list too long */
56 #define ENOEXEC 8       /**< Exec format error */
57 #define EBADF 9         /**< Bad file number */
58 #define ECHILD 10       /**< No children */
59 #define EAGAIN 11       /**< No more contexts */
60 #define ENOMEM 12       /**< Not enough core */
61 #define EACCES 13       /**< Permission denied */
62 #define EFAULT 14       /**< Bad address */
63 #define ENOTBLK 15      /**< Block device required */
64 #define EBUSY 16        /**< Mount device busy */
65 #define EEXIST 17       /**< File exists */
66 #define EXDEV 18        /**< Cross-device link */
67 #define ENODEV 19       /**< No such device */
68 #define ENOTDIR 20      /**< Not a directory */
69 #define EISDIR 21       /**< Is a directory */
70 #define EINVAL 22       /**< Invalid argument */
71 #define ENFILE 23       /**< File table overflow */
72 #define EMFILE 24       /**< Too many open files */
73 #define ENOTTY 25       /**< Not a typewriter */
74 #define ETXTBSY 26      /**< Text file busy */
75 #define EFBIG 27        /**< File too large */
76 #define ENOSPC 28       /**< No space left on device */
77 #define ESPIPE 29       /**< Illegal seek */
78 #define EROFS 30        /**< Read-only file system */
79 #define EMLINK 31       /**< Too many links */
80 #define EPIPE 32        /**< Broken pipe */
81 /* Implemented in errno.c    Argument too large */
82 /* Implemented in errno.c    Result too large */
83 #define ENOMSG 35       /**< Unexpected message type */
84 #define EDEADLK 45      /**< Resource deadlock avoided */
85 #define ENOLCK 46       /**< No locks available */
86 #define ENOSTR 60       /**< STREAMS device required */
87 #define ENODATA 61      /**< Missing expected message data */
88 #define ETIME 62        /**< STREAMS timeout occurred */
89 #define ENOSR 63        /**< Insufficient memory */
90 #define EPROTO 71       /**< Generic STREAMS error */
91 #define EBADMSG 77      /**< Invalid STREAMS message */
92 #define ENOSYS 88       /**< Function not implemented */
93 #define ENOTEMPTY 90    /**< Directory not empty */
94 #define ENAMETOOLONG 91 /**< File name too long */
95 #define ELOOP 92        /**< Too many levels of symbolic links */
96 #define EOPNOTSUPP 95   /**< Operation not supported on socket */
97 #define EPFNOSUPPORT 96 /**< Protocol family not supported */
98 #define ECONNRESET 104   /**< Connection reset by peer */
99 #define ENOBUFS 105      /**< No buffer space available */
100 #define EAFNOSUPPORT 106 /**< Addr family not supported */
101 #define EPROTOTYPE 107   /**< Protocol wrong type for socket */
102 #define ENOTSOCK 108     /**< Socket operation on non-socket */
103 #define ENOPROTOOPT 109  /**< Protocol not available */
104 #define ESHUTDOWN 110    /**< Can't send after socket shutdown */
105 #define ECONNREFUSED 111 /**< Connection refused */
106 #define EADDRINUSE 112   /**< Address already in use */
107 #define ECONNABORTED 113 /**< Software caused connection abort */
108 #define ENETUNREACH 114  /**< Network is unreachable */
109 #define ENETDOWN 115     /**< Network is down */
110 #define ETIMEDOUT 116    /**< Connection timed out */
111 #define EHOSTDOWN 117    /**< Host is down */
112 #define EHOSTUNREACH 118 /**< No route to host */
113 #define EINPROGRESS 119  /**< Operation now in progress */
114 #define EALREADY 120     /**< Operation already in progress */
115 #define EDESTADDRREQ 121 /**< Destination address required */
116 #define EMSGSIZE 122        /**< Message size */
117 #define EPROTONOSUPPORT 123 /**< Protocol not supported */
118 #define ESOCKTNOSUPPORT 124 /**< Socket type not supported */
119 #define EADDRNOTAVAIL 125   /**< Can't assign requested address */
120 #define ENETRESET 126       /**< Network dropped connection on reset */
121 #define EISCONN 127         /**< Socket is already connected */
122 #define ENOTCONN 128        /**< Socket is not connected */
123 #define ETOOMANYREFS 129    /**< Too many references: can't splice */
124 #define ENOTSUP 134         /**< Unsupported value */
125 /* Implemented in errno.c   Illegal byte sequence */
126 #define EOVERFLOW 139       /**< Value overflow */
127 #define ECANCELED 140       /**< Operation canceled */
128 
129 #define EWOULDBLOCK EAGAIN /**< Operation would block */
130 
131 /**
132  * @}
133  */
134 #include_next <errno.h>
135 
136 #ifdef __cplusplus
137 }
138 #endif
139 
140 #endif /* ZEPHYR_LIB_LIBC_ARMSTDC_INCLUDE_ERRNO_H_ */
141