1 // Copyright 2023 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
11 // TODO: Auto-generate some day. (Hard-coded in binaries so not likely to change.)
16 EADDRNOTAVAIL Errno = 4
17 EAFNOSUPPORT Errno = 5
25 ECONNABORTED Errno = 13
26 ECONNREFUSED Errno = 14
29 EDESTADDRREQ Errno = 17
35 EHOSTUNREACH Errno = 23
38 EINPROGRESS Errno = 26
49 ENAMETOOLONG Errno = 37
52 ENETUNREACH Errno = 40
62 ENOPROTOOPT Errno = 50
68 ENOTRECOVERABLE Errno = 56
78 EPROTONOSUPPORT Errno = 66
88 ENOTCAPABLE Errno = 76
89 // needed by src/net/error_unix_test.go
93 // TODO: Auto-generate some day. (Hard-coded in binaries so not likely to change.)
94 var errorstr = [...]string{
95 E2BIG: "Argument list too long",
96 EACCES: "Permission denied",
97 EADDRINUSE: "Address already in use",
98 EADDRNOTAVAIL: "Address not available",
99 EAFNOSUPPORT: "Address family not supported by protocol family",
101 EALREADY: "Socket already connected",
102 EBADF: "Bad file number",
103 EBADMSG: "Trying to read unreadable message",
104 EBUSY: "Device or resource busy",
105 ECANCELED: "Operation canceled.",
106 ECHILD: "No child processes",
107 ECONNABORTED: "Connection aborted",
108 ECONNREFUSED: "Connection refused",
109 ECONNRESET: "Connection reset by peer",
110 EDEADLK: "Deadlock condition",
111 EDESTADDRREQ: "Destination address required",
112 EDOM: "Math arg out of domain of func",
113 EDQUOT: "Quota exceeded",
114 EEXIST: "File exists",
115 EFAULT: "Bad address",
116 EFBIG: "File too large",
117 EHOSTUNREACH: "Host is unreachable",
118 EIDRM: "Identifier removed",
120 EINPROGRESS: "Connection already in progress",
121 EINTR: "Interrupted system call",
122 EINVAL: "Invalid argument",
124 EISCONN: "Socket is already connected",
125 EISDIR: "Is a directory",
126 ELOOP: "Too many symbolic links",
127 EMFILE: "Too many open files",
128 EMLINK: "Too many links",
129 EMSGSIZE: "Message too long",
130 EMULTIHOP: "Multihop attempted",
131 ENAMETOOLONG: "File name too long",
132 ENETDOWN: "Network interface is not configured",
133 ENETRESET: "Network dropped connection on reset",
134 ENETUNREACH: "Network is unreachable",
135 ENFILE: "File table overflow",
136 ENOBUFS: "No buffer space available",
137 ENODEV: "No such device",
138 ENOENT: "No such file or directory",
139 ENOEXEC: "Exec format error",
140 ENOLCK: "No record locks available",
141 ENOLINK: "The link has been severed",
142 ENOMEM: "Out of memory",
143 ENOMSG: "No message of desired type",
144 ENOPROTOOPT: "Protocol not available",
145 ENOSPC: "No space left on device",
146 ENOSYS: "Not implemented on " + runtime.GOOS,
147 ENOTCONN: "Socket is not connected",
148 ENOTDIR: "Not a directory",
149 ENOTEMPTY: "Directory not empty",
150 ENOTRECOVERABLE: "State not recoverable",
151 ENOTSOCK: "Socket operation on non-socket",
152 ENOTSUP: "Not supported",
153 ENOTTY: "Not a typewriter",
154 ENXIO: "No such device or address",
155 EOVERFLOW: "Value too large for defined data type",
156 EOWNERDEAD: "Owner died",
157 EPERM: "Operation not permitted",
158 EPIPE: "Broken pipe",
159 EPROTO: "Protocol error",
160 EPROTONOSUPPORT: "Unknown protocol",
161 EPROTOTYPE: "Protocol wrong type for socket",
162 ERANGE: "Math result not representable",
163 EROFS: "Read-only file system",
164 ESPIPE: "Illegal seek",
165 ESRCH: "No such process",
166 ESTALE: "Stale file handle",
167 ETIMEDOUT: "Connection timed out",
168 ETXTBSY: "Text file busy",
169 EXDEV: "Cross-device link",
170 ENOTCAPABLE: "Capabilities insufficient",
173 // Do the interface allocations only once for common
176 errEAGAIN error = EAGAIN
177 errEINVAL error = EINVAL
178 errENOENT error = ENOENT
181 // errnoErr returns common boxed Errno values, to prevent
182 // allocations at runtime.
184 // We set both noinline and nosplit to reduce code size, this function has many
185 // call sites in the syscall package, inlining it causes a significant increase
186 // of the compiled code; the function call ultimately does not make a difference
187 // in the performance of syscall functions since the time is dominated by calls
188 // to the imports and path resolution.
192 func errnoErr(e Errno) error {