blob: ad140ab147789061b41c0c9f6da763b921036621 [file] [log] [blame]
Antonio Nino Diazc6fdaa72018-08-13 19:39:40 +01001/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1982, 1986, 1989, 1993
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)errno.h 8.5 (Berkeley) 1/21/94
37 * $FreeBSD$
38 */
39
40#ifndef _SYS_ERRNO_H_
41#define _SYS_ERRNO_H_
42
43#if !defined(_KERNEL) && !defined(_STANDALONE)
44#include <sys/cdefs.h>
45__BEGIN_DECLS
46int * __error(void);
47__END_DECLS
48#define errno (* __error())
49#endif
50
51#define EPERM 1 /* Operation not permitted */
52#define ENOENT 2 /* No such file or directory */
53#define ESRCH 3 /* No such process */
54#define EINTR 4 /* Interrupted system call */
55#define EIO 5 /* Input/output error */
56#define ENXIO 6 /* Device not configured */
57#define E2BIG 7 /* Argument list too long */
58#define ENOEXEC 8 /* Exec format error */
59#define EBADF 9 /* Bad file descriptor */
60#define ECHILD 10 /* No child processes */
61#define EDEADLK 11 /* Resource deadlock avoided */
62 /* 11 was EAGAIN */
63#define ENOMEM 12 /* Cannot allocate memory */
64#define EACCES 13 /* Permission denied */
65#define EFAULT 14 /* Bad address */
66#ifndef _POSIX_SOURCE
67#define ENOTBLK 15 /* Block device required */
68#endif
69#define EBUSY 16 /* Device busy */
70#define EEXIST 17 /* File exists */
71#define EXDEV 18 /* Cross-device link */
72#define ENODEV 19 /* Operation not supported by device */
73#define ENOTDIR 20 /* Not a directory */
74#define EISDIR 21 /* Is a directory */
75#define EINVAL 22 /* Invalid argument */
76#define ENFILE 23 /* Too many open files in system */
77#define EMFILE 24 /* Too many open files */
78#define ENOTTY 25 /* Inappropriate ioctl for device */
79#ifndef _POSIX_SOURCE
80#define ETXTBSY 26 /* Text file busy */
81#endif
82#define EFBIG 27 /* File too large */
83#define ENOSPC 28 /* No space left on device */
84#define ESPIPE 29 /* Illegal seek */
85#define EROFS 30 /* Read-only filesystem */
86#define EMLINK 31 /* Too many links */
87#define EPIPE 32 /* Broken pipe */
88
89/* math software */
90#define EDOM 33 /* Numerical argument out of domain */
91#define ERANGE 34 /* Result too large */
92
93/* non-blocking and interrupt i/o */
94#define EAGAIN 35 /* Resource temporarily unavailable */
95#ifndef _POSIX_SOURCE
96#define EWOULDBLOCK EAGAIN /* Operation would block */
97#define EINPROGRESS 36 /* Operation now in progress */
98#define EALREADY 37 /* Operation already in progress */
99
100/* ipc/network software -- argument errors */
101#define ENOTSOCK 38 /* Socket operation on non-socket */
102#define EDESTADDRREQ 39 /* Destination address required */
103#define EMSGSIZE 40 /* Message too long */
104#define EPROTOTYPE 41 /* Protocol wrong type for socket */
105#define ENOPROTOOPT 42 /* Protocol not available */
106#define EPROTONOSUPPORT 43 /* Protocol not supported */
107#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
108#define EOPNOTSUPP 45 /* Operation not supported */
109#define ENOTSUP EOPNOTSUPP /* Operation not supported */
110#define EPFNOSUPPORT 46 /* Protocol family not supported */
111#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */
112#define EADDRINUSE 48 /* Address already in use */
113#define EADDRNOTAVAIL 49 /* Can't assign requested address */
114
115/* ipc/network software -- operational errors */
116#define ENETDOWN 50 /* Network is down */
117#define ENETUNREACH 51 /* Network is unreachable */
118#define ENETRESET 52 /* Network dropped connection on reset */
119#define ECONNABORTED 53 /* Software caused connection abort */
120#define ECONNRESET 54 /* Connection reset by peer */
121#define ENOBUFS 55 /* No buffer space available */
122#define EISCONN 56 /* Socket is already connected */
123#define ENOTCONN 57 /* Socket is not connected */
124#define ESHUTDOWN 58 /* Can't send after socket shutdown */
125#define ETOOMANYREFS 59 /* Too many references: can't splice */
126#define ETIMEDOUT 60 /* Operation timed out */
127#define ECONNREFUSED 61 /* Connection refused */
128
129#define ELOOP 62 /* Too many levels of symbolic links */
130#endif /* _POSIX_SOURCE */
131#define ENAMETOOLONG 63 /* File name too long */
132
133/* should be rearranged */
134#ifndef _POSIX_SOURCE
135#define EHOSTDOWN 64 /* Host is down */
136#define EHOSTUNREACH 65 /* No route to host */
137#endif /* _POSIX_SOURCE */
138#define ENOTEMPTY 66 /* Directory not empty */
139
140/* quotas & mush */
141#ifndef _POSIX_SOURCE
142#define EPROCLIM 67 /* Too many processes */
143#define EUSERS 68 /* Too many users */
144#define EDQUOT 69 /* Disc quota exceeded */
145
146/* Network File System */
147#define ESTALE 70 /* Stale NFS file handle */
148#define EREMOTE 71 /* Too many levels of remote in path */
149#define EBADRPC 72 /* RPC struct is bad */
150#define ERPCMISMATCH 73 /* RPC version wrong */
151#define EPROGUNAVAIL 74 /* RPC prog. not avail */
152#define EPROGMISMATCH 75 /* Program version wrong */
153#define EPROCUNAVAIL 76 /* Bad procedure for program */
154#endif /* _POSIX_SOURCE */
155
156#define ENOLCK 77 /* No locks available */
157#define ENOSYS 78 /* Function not implemented */
158
159#ifndef _POSIX_SOURCE
160#define EFTYPE 79 /* Inappropriate file type or format */
161#define EAUTH 80 /* Authentication error */
162#define ENEEDAUTH 81 /* Need authenticator */
163#define EIDRM 82 /* Identifier removed */
164#define ENOMSG 83 /* No message of desired type */
165#define EOVERFLOW 84 /* Value too large to be stored in data type */
166#define ECANCELED 85 /* Operation canceled */
167#define EILSEQ 86 /* Illegal byte sequence */
168#define ENOATTR 87 /* Attribute not found */
169
170#define EDOOFUS 88 /* Programming error */
171#endif /* _POSIX_SOURCE */
172
173#define EBADMSG 89 /* Bad message */
174#define EMULTIHOP 90 /* Multihop attempted */
175#define ENOLINK 91 /* Link has been severed */
176#define EPROTO 92 /* Protocol error */
177
178#ifndef _POSIX_SOURCE
179#define ENOTCAPABLE 93 /* Capabilities insufficient */
180#define ECAPMODE 94 /* Not permitted in capability mode */
181#define ENOTRECOVERABLE 95 /* State not recoverable */
182#define EOWNERDEAD 96 /* Previous owner died */
183#endif /* _POSIX_SOURCE */
184
185#ifndef _POSIX_SOURCE
186#define ELAST 96 /* Must be equal largest errno */
187#endif /* _POSIX_SOURCE */
188
189#if defined(_KERNEL) || defined(_WANT_KERNEL_ERRNO)
190/* pseudo-errors returned inside kernel to modify return to process */
191#define ERESTART (-1) /* restart syscall */
192#define EJUSTRETURN (-2) /* don't modify regs, just return */
193#define ENOIOCTL (-3) /* ioctl not handled by this layer */
194#define EDIRIOCTL (-4) /* do direct ioctl in GEOM */
195#define ERELOOKUP (-5) /* retry the directory lookup */
196#endif
197
198#ifndef _KERNEL
199#if __EXT1_VISIBLE
200/* ISO/IEC 9899:2011 K.3.2.2 */
201#ifndef _ERRNO_T_DEFINED
202#define _ERRNO_T_DEFINED
203typedef int errno_t;
204#endif
205#endif /* __EXT1_VISIBLE */
206#endif
207
208#endif