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