errno.h revision 17649
11541Srgrimes/*
21541Srgrimes * Copyright (c) 1982, 1986, 1989, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes * (c) UNIX System Laboratories, Inc.
51541Srgrimes * All or some portions of this file are derived from material licensed
61541Srgrimes * to the University of California by American Telephone and Telegraph
71541Srgrimes * Co. or Unix System Laboratories, Inc. and are reproduced herein with
81541Srgrimes * the permission of UNIX System Laboratories, Inc.
91541Srgrimes *
101541Srgrimes * Redistribution and use in source and binary forms, with or without
111541Srgrimes * modification, are permitted provided that the following conditions
121541Srgrimes * are met:
131541Srgrimes * 1. Redistributions of source code must retain the above copyright
141541Srgrimes *    notice, this list of conditions and the following disclaimer.
151541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
161541Srgrimes *    notice, this list of conditions and the following disclaimer in the
171541Srgrimes *    documentation and/or other materials provided with the distribution.
181541Srgrimes * 3. All advertising materials mentioning features or use of this software
191541Srgrimes *    must display the following acknowledgement:
201541Srgrimes *	This product includes software developed by the University of
211541Srgrimes *	California, Berkeley and its contributors.
221541Srgrimes * 4. Neither the name of the University nor the names of its contributors
231541Srgrimes *    may be used to endorse or promote products derived from this software
241541Srgrimes *    without specific prior written permission.
251541Srgrimes *
261541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
271541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
281541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
291541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
301541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
311541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
321541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
331541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
341541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
351541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
361541Srgrimes * SUCH DAMAGE.
371541Srgrimes *
381541Srgrimes *	@(#)errno.h	8.5 (Berkeley) 1/21/94
3917649Speter * $Id: errno.h,v 1.4 1996/01/22 00:02:33 julian Exp $
401541Srgrimes */
411541Srgrimes
422165Spaul#ifndef _SYS_ERRNO_H_
432165Spaul#define _SYS_ERRNO_H_
442165Spaul
451541Srgrimes#ifndef KERNEL
4613545Sjulian#ifdef	_THREAD_SAFE
4717649Speter#include <sys/cdefs.h>
4817649Speter__BEGIN_DECLS
4917649Speterint *	__error __P((void));
5017649Speter__END_DECLS
5113545Sjulian#define	errno		(* __error())
5213545Sjulian#else
531541Srgrimesextern int errno;			/* global error number */
541541Srgrimes#endif
5513545Sjulian#endif
561541Srgrimes
571541Srgrimes#define	EPERM		1		/* Operation not permitted */
581541Srgrimes#define	ENOENT		2		/* No such file or directory */
591541Srgrimes#define	ESRCH		3		/* No such process */
601541Srgrimes#define	EINTR		4		/* Interrupted system call */
611541Srgrimes#define	EIO		5		/* Input/output error */
621541Srgrimes#define	ENXIO		6		/* Device not configured */
631541Srgrimes#define	E2BIG		7		/* Argument list too long */
641541Srgrimes#define	ENOEXEC		8		/* Exec format error */
651541Srgrimes#define	EBADF		9		/* Bad file descriptor */
661541Srgrimes#define	ECHILD		10		/* No child processes */
671541Srgrimes#define	EDEADLK		11		/* Resource deadlock avoided */
681541Srgrimes					/* 11 was EAGAIN */
691541Srgrimes#define	ENOMEM		12		/* Cannot allocate memory */
701541Srgrimes#define	EACCES		13		/* Permission denied */
711541Srgrimes#define	EFAULT		14		/* Bad address */
721541Srgrimes#ifndef _POSIX_SOURCE
731541Srgrimes#define	ENOTBLK		15		/* Block device required */
741541Srgrimes#endif
751541Srgrimes#define	EBUSY		16		/* Device busy */
761541Srgrimes#define	EEXIST		17		/* File exists */
771541Srgrimes#define	EXDEV		18		/* Cross-device link */
781541Srgrimes#define	ENODEV		19		/* Operation not supported by device */
791541Srgrimes#define	ENOTDIR		20		/* Not a directory */
801541Srgrimes#define	EISDIR		21		/* Is a directory */
811541Srgrimes#define	EINVAL		22		/* Invalid argument */
821541Srgrimes#define	ENFILE		23		/* Too many open files in system */
831541Srgrimes#define	EMFILE		24		/* Too many open files */
841541Srgrimes#define	ENOTTY		25		/* Inappropriate ioctl for device */
851541Srgrimes#ifndef _POSIX_SOURCE
861541Srgrimes#define	ETXTBSY		26		/* Text file busy */
871541Srgrimes#endif
881541Srgrimes#define	EFBIG		27		/* File too large */
891541Srgrimes#define	ENOSPC		28		/* No space left on device */
901541Srgrimes#define	ESPIPE		29		/* Illegal seek */
911541Srgrimes#define	EROFS		30		/* Read-only file system */
921541Srgrimes#define	EMLINK		31		/* Too many links */
931541Srgrimes#define	EPIPE		32		/* Broken pipe */
941541Srgrimes
951541Srgrimes/* math software */
961541Srgrimes#define	EDOM		33		/* Numerical argument out of domain */
971541Srgrimes#define	ERANGE		34		/* Result too large */
981541Srgrimes
991541Srgrimes/* non-blocking and interrupt i/o */
1001541Srgrimes#define	EAGAIN		35		/* Resource temporarily unavailable */
1011541Srgrimes#ifndef _POSIX_SOURCE
1021541Srgrimes#define	EWOULDBLOCK	EAGAIN		/* Operation would block */
1031541Srgrimes#define	EINPROGRESS	36		/* Operation now in progress */
1041541Srgrimes#define	EALREADY	37		/* Operation already in progress */
1051541Srgrimes
1061541Srgrimes/* ipc/network software -- argument errors */
1071541Srgrimes#define	ENOTSOCK	38		/* Socket operation on non-socket */
1081541Srgrimes#define	EDESTADDRREQ	39		/* Destination address required */
1091541Srgrimes#define	EMSGSIZE	40		/* Message too long */
1101541Srgrimes#define	EPROTOTYPE	41		/* Protocol wrong type for socket */
1111541Srgrimes#define	ENOPROTOOPT	42		/* Protocol not available */
1121541Srgrimes#define	EPROTONOSUPPORT	43		/* Protocol not supported */
1131541Srgrimes#define	ESOCKTNOSUPPORT	44		/* Socket type not supported */
1141541Srgrimes#define	EOPNOTSUPP	45		/* Operation not supported */
1151541Srgrimes#define	EPFNOSUPPORT	46		/* Protocol family not supported */
1161541Srgrimes#define	EAFNOSUPPORT	47		/* Address family not supported by protocol family */
1171541Srgrimes#define	EADDRINUSE	48		/* Address already in use */
1181541Srgrimes#define	EADDRNOTAVAIL	49		/* Can't assign requested address */
1191541Srgrimes
1201541Srgrimes/* ipc/network software -- operational errors */
1211541Srgrimes#define	ENETDOWN	50		/* Network is down */
1221541Srgrimes#define	ENETUNREACH	51		/* Network is unreachable */
1231541Srgrimes#define	ENETRESET	52		/* Network dropped connection on reset */
1241541Srgrimes#define	ECONNABORTED	53		/* Software caused connection abort */
1251541Srgrimes#define	ECONNRESET	54		/* Connection reset by peer */
1261541Srgrimes#define	ENOBUFS		55		/* No buffer space available */
1271541Srgrimes#define	EISCONN		56		/* Socket is already connected */
1281541Srgrimes#define	ENOTCONN	57		/* Socket is not connected */
1291541Srgrimes#define	ESHUTDOWN	58		/* Can't send after socket shutdown */
1301541Srgrimes#define	ETOOMANYREFS	59		/* Too many references: can't splice */
1311541Srgrimes#define	ETIMEDOUT	60		/* Operation timed out */
1321541Srgrimes#define	ECONNREFUSED	61		/* Connection refused */
1331541Srgrimes
1341541Srgrimes#define	ELOOP		62		/* Too many levels of symbolic links */
1351541Srgrimes#endif /* _POSIX_SOURCE */
1361541Srgrimes#define	ENAMETOOLONG	63		/* File name too long */
1371541Srgrimes
1381541Srgrimes/* should be rearranged */
1391541Srgrimes#ifndef _POSIX_SOURCE
1401541Srgrimes#define	EHOSTDOWN	64		/* Host is down */
1411541Srgrimes#define	EHOSTUNREACH	65		/* No route to host */
1421541Srgrimes#endif /* _POSIX_SOURCE */
1431541Srgrimes#define	ENOTEMPTY	66		/* Directory not empty */
1441541Srgrimes
1451541Srgrimes/* quotas & mush */
1461541Srgrimes#ifndef _POSIX_SOURCE
1471541Srgrimes#define	EPROCLIM	67		/* Too many processes */
1481541Srgrimes#define	EUSERS		68		/* Too many users */
1491541Srgrimes#define	EDQUOT		69		/* Disc quota exceeded */
1501541Srgrimes
1511541Srgrimes/* Network File System */
1521541Srgrimes#define	ESTALE		70		/* Stale NFS file handle */
1531541Srgrimes#define	EREMOTE		71		/* Too many levels of remote in path */
1541541Srgrimes#define	EBADRPC		72		/* RPC struct is bad */
1551541Srgrimes#define	ERPCMISMATCH	73		/* RPC version wrong */
1561541Srgrimes#define	EPROGUNAVAIL	74		/* RPC prog. not avail */
1571541Srgrimes#define	EPROGMISMATCH	75		/* Program version wrong */
1581541Srgrimes#define	EPROCUNAVAIL	76		/* Bad procedure for program */
1591541Srgrimes#endif /* _POSIX_SOURCE */
1601541Srgrimes
1611541Srgrimes#define	ENOLCK		77		/* No locks available */
1621541Srgrimes#define	ENOSYS		78		/* Function not implemented */
1631541Srgrimes
1641541Srgrimes#ifndef _POSIX_SOURCE
1651541Srgrimes#define	EFTYPE		79		/* Inappropriate file type or format */
1661541Srgrimes#define	EAUTH		80		/* Authentication error */
1671541Srgrimes#define	ENEEDAUTH	81		/* Need authenticator */
1681541Srgrimes#define	ELAST		81		/* Must be equal largest errno */
1691541Srgrimes#endif /* _POSIX_SOURCE */
1701541Srgrimes
1711541Srgrimes#ifdef KERNEL
1721541Srgrimes/* pseudo-errors returned inside kernel to modify return to process */
1731541Srgrimes#define	ERESTART	-1		/* restart syscall */
1741541Srgrimes#define	EJUSTRETURN	-2		/* don't modify regs, just return */
1751541Srgrimes#endif
1762165Spaul
1772165Spaul#endif
178