1/*
2 * errno.h
3 * This file has no copyright assigned and is placed in the Public Domain.
4 * This file is a part of the mingw-runtime package.
5 * No warranty is given; refer to the file DISCLAIMER within the package.
6 *
7 * Error numbers and access to error reporting.
8 *
9 */
10
11#ifndef _ERRNO_H_
12#define	_ERRNO_H_
13
14#include <crtdefs.h>
15
16/*
17 * Error numbers.
18 * TODO: Can't be sure of some of these assignments, I guessed from the
19 * names given by strerror and the defines in the Cygnus errno.h. A lot
20 * of the names from the Cygnus errno.h are not represented, and a few
21 * of the descriptions returned by strerror do not obviously match
22 * their error naming.
23 */
24#define EPERM		1	/* Operation not permitted */
25#define	ENOFILE		2	/* No such file or directory */
26#define	ENOENT		2
27#define	ESRCH		3	/* No such process */
28#define	EINTR		4	/* Interrupted function call */
29#define	EIO		5	/* Input/output error */
30#define	ENXIO		6	/* No such device or address */
31#define	E2BIG		7	/* Arg list too long */
32#define	ENOEXEC		8	/* Exec format error */
33#define	EBADF		9	/* Bad file descriptor */
34#define	ECHILD		10	/* No child processes */
35#define	EAGAIN		11	/* Resource temporarily unavailable */
36#define	ENOMEM		12	/* Not enough space */
37#define	EACCES		13	/* Permission denied */
38#define	EFAULT		14	/* Bad address */
39/* 15 - Unknown Error */
40#define	EBUSY		16	/* strerror reports "Resource device" */
41#define	EEXIST		17	/* File exists */
42#define	EXDEV		18	/* Improper link (cross-device link?) */
43#define	ENODEV		19	/* No such device */
44#define	ENOTDIR		20	/* Not a directory */
45#define	EISDIR		21	/* Is a directory */
46#define	EINVAL		22	/* Invalid argument */
47#define	ENFILE		23	/* Too many open files in system */
48#define	EMFILE		24	/* Too many open files */
49#define	ENOTTY		25	/* Inappropriate I/O control operation */
50/* 26 - Unknown Error */
51#define	EFBIG		27	/* File too large */
52#define	ENOSPC		28	/* No space left on device */
53#define	ESPIPE		29	/* Invalid seek (seek on a pipe?) */
54#define	EROFS		30	/* Read-only file system */
55#define	EMLINK		31	/* Too many links */
56#define	EPIPE		32	/* Broken pipe */
57#define	EDOM		33	/* Domain error (math functions) */
58#define	ERANGE		34	/* Result too large (possibly too small) */
59/* 35 - Unknown Error */
60#define	EDEADLOCK	36	/* Resource deadlock avoided (non-Cyg) */
61#define	EDEADLK		36
62#if 0
63/* 37 - Unknown Error */
64#define	ENAMETOOLONG	38	/* Filename too long (91 in Cyg?) */
65#define	ENOLCK		39	/* No locks available (46 in Cyg?) */
66#define	ENOSYS		40	/* Function not implemented (88 in Cyg?) */
67#define	ENOTEMPTY	41	/* Directory not empty (90 in Cyg?) */
68#define	EILSEQ		42	/* Illegal byte sequence */
69#endif
70
71/*
72 * NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the
73 *       sockets.h header provided with windows32api-0.1.2.
74 *       You should go and put an #if 0 ... #endif around the whole block
75 *       of errors (look at the comment above them).
76 */
77
78#ifndef	RC_INVOKED
79
80#ifdef	__cplusplus
81extern "C" {
82#endif
83
84/*
85 * Definitions of errno. For _doserrno, sys_nerr and * sys_errlist, see
86 * stdlib.h.
87 */
88#if defined(_UWIN) || defined(_WIN32_WCE)
89#undef errno
90extern int errno;
91#else
92_CRTIMP int* __cdecl _errno(void);
93#define	errno		(*_errno())
94#endif
95
96#ifdef	__cplusplus
97}
98#endif
99
100#endif	/* Not RC_INVOKED */
101
102#endif	/* Not _ERRNO_H_ */