1 /* Copyright (c) 2007 Patrick Mansfield <patmans@us.ibm.com> */
2 /*
3  * The SPU must have these values match those on the PPU linux side, so
4  * the assisted calls (system or library ones) that set errno will use the
5  * same values.
6  *
7  * This file is based on the CRIS file, with these modifications:
8  *
9  * EDEADLOCK  - instead of EDEADLK (35) use 58 (for some reason ppc only does
10  * this, it is not used by ppc kernel code nor glibc code).
11  *
12  * ECANCELED value of 125 added, in linux and posix value of 125, in generic
13  * newlib errno.h, value of 140
14  *
15  * ENOTSUP as EOPNOTSUPP (95) added, in linux and posix value 95, in
16  * generic newlib errno.h, value of 134
17  */
18 
19 /* This file is to be kept in sync with newlib/libc/include/sys/errno.h
20    on which it is based, except values used or returned by syscalls must
21    be those of the Linux ppc.  */
22 
23 #ifndef _SYS_ERRNO_H_
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 #define _SYS_ERRNO_H_
28 
29 #include <sys/reent.h>
30 
31 #define errno (_impure_data._errno)
32 
33 /* Please don't use these variables directly.
34    Use strerror instead. */
35 extern const char * const _sys_errlist[];
36 extern int _sys_nerr;
37 
38 #define __errno_r(ptr) _REENT_ERRNO(ptr)
39 
40 /* Adjusted to the linux asm/errno.h */
41 #define	EPERM		 1	/* Operation not permitted */
42 #define	ENOENT		 2	/* No such file or directory */
43 #define	ESRCH		 3	/* No such process */
44 #define	EINTR		 4	/* Interrupted system call */
45 #define	EIO		 5	/* I/O error */
46 #define	ENXIO		 6	/* No such device or address */
47 #define	E2BIG		 7	/* Arg list too long */
48 #define	ENOEXEC		 8	/* Exec format error */
49 #define	EBADF		 9	/* Bad file number */
50 #define	ECHILD		10	/* No child processes */
51 #define	EAGAIN		11	/* Try again */
52 #define	ENOMEM		12	/* Out of memory */
53 #define	EACCES		13	/* Permission denied */
54 #define	EFAULT		14	/* Bad address */
55 #define	ENOTBLK		15	/* Block device required */
56 #define	EBUSY		16	/* Device or resource busy */
57 #define	EEXIST		17	/* File exists */
58 #define	EXDEV		18	/* Cross-device link */
59 #define	ENODEV		19	/* No such device */
60 #define	ENOTDIR		20	/* Not a directory */
61 #define	EISDIR		21	/* Is a directory */
62 #define	EINVAL		22	/* Invalid argument */
63 #define	ENFILE		23	/* File table overflow */
64 #define	EMFILE		24	/* Too many open files */
65 #define	ENOTTY		25	/* Not a typewriter */
66 #define	ETXTBSY		26	/* Text file busy */
67 #define	EFBIG		27	/* File too large */
68 #define	ENOSPC		28	/* No space left on device */
69 #define	ESPIPE		29	/* Illegal seek */
70 #define	EROFS		30	/* Read-only file system */
71 #define	EMLINK		31	/* Too many links */
72 #define	EPIPE		32	/* Broken pipe */
73 #define	EDOM		33	/* Math argument out of domain of func */
74 #define	ERANGE		34	/* Math result not representable */
75 #define	EDEADLK		35	/* Resource deadlock would occur */
76 #define	ENAMETOOLONG	36	/* File name too long */
77 #define	ENOLCK		37	/* No record locks available */
78 #define	ENOSYS		38	/* Function not implemented */
79 #define	ENOTEMPTY	39	/* Directory not empty */
80 #define	ELOOP		40	/* Too many symbolic links encountered */
81 #define	EWOULDBLOCK	EAGAIN	/* Operation would block */
82 #define	ENOMSG		42	/* No message of desired type */
83 #define	EIDRM		43	/* Identifier removed */
84 #define	ECHRNG		44	/* Channel number out of range */
85 #define	EL2NSYNC	45	/* Level 2 not synchronized */
86 #define	EL3HLT		46	/* Level 3 halted */
87 #define	EL3RST		47	/* Level 3 reset */
88 #define	ELNRNG		48	/* Link number out of range */
89 #define	EUNATCH		49	/* Protocol driver not attached */
90 #define	ENOCSI		50	/* No CSI structure available */
91 #define	EL2HLT		51	/* Level 2 halted */
92 #define	EBADE		52	/* Invalid exchange */
93 #define	EBADR		53	/* Invalid request descriptor */
94 #define	EXFULL		54	/* Exchange full */
95 #define	ENOANO		55	/* No anode */
96 #define	EBADRQC		56	/* Invalid request code */
97 #define	EBADSLT		57	/* Invalid slot */
98 
99 #define	EDEADLOCK	58
100 
101 #define	EBFONT		59	/* Bad font file format */
102 /* This is only used internally in newlib; not returned by the kernel.
103    EBFONT seems the closest match for a "bad file format" error.  */
104 #define EFTYPE		EBFONT	/* Inappropriate file type or format */
105 #define	ENOSTR		60	/* Device not a stream */
106 #define	ENODATA		61	/* No data available */
107 #define	ETIME		62	/* Timer expired */
108 #define	ENOSR		63	/* Out of streams resources */
109 #define	ENONET		64	/* Machine is not on the network */
110 #define	ENOPKG		65	/* Package not installed */
111 #define	EREMOTE		66	/* Object is remote */
112 #define	ENOLINK		67	/* Link has been severed */
113 #define	EADV		68	/* Advertise error */
114 #define	ESRMNT		69	/* Srmount error */
115 #define	ECOMM		70	/* Communication error on send */
116 #define	EPROTO		71	/* Protocol error */
117 #define	EMULTIHOP	72	/* Multihop attempted */
118 #define	EDOTDOT		73	/* RFS specific error */
119 #define	EBADMSG		74	/* Not a data message */
120 #define	EOVERFLOW	75	/* Value too large for defined data type */
121 #define	ENOTUNIQ	76	/* Name not unique on network */
122 #define	EBADFD		77	/* File descriptor in bad state */
123 #define	EREMCHG		78	/* Remote address changed */
124 #define	ELIBACC		79	/* Can not access a needed shared library */
125 #define	ELIBBAD		80	/* Accessing a corrupted shared library */
126 #define	ELIBSCN		81	/* .lib section in a.out corrupted */
127 #define	ELIBMAX		82	/* Attempting to link in too many shared libraries */
128 #define	ELIBEXEC	83	/* Cannot exec a shared library directly */
129 #define	EILSEQ		84	/* Illegal byte sequence */
130 #define	ERESTART	85	/* Interrupted system call should be restarted */
131 #define	ESTRPIPE	86	/* Streams pipe error */
132 #define	EUSERS		87	/* Too many users */
133 #define	ENOTSOCK	88	/* Socket operation on non-socket */
134 #define	EDESTADDRREQ	89	/* Destination address required */
135 #define	EMSGSIZE	90	/* Message too long */
136 #define	EPROTOTYPE	91	/* Protocol wrong type for socket */
137 #define	ENOPROTOOPT	92	/* Protocol not available */
138 #define	EPROTONOSUPPORT	93	/* Protocol not supported */
139 #define	ESOCKTNOSUPPORT	94	/* Socket type not supported */
140 #define	EOPNOTSUPP	95	/* Operation not supported on transport endpoint */
141 #define	ENOTSUP		EOPNOTSUPP
142 #define	EPFNOSUPPORT	96	/* Protocol family not supported */
143 #define	EAFNOSUPPORT	97	/* Address family not supported by protocol */
144 #define	EADDRINUSE	98	/* Address already in use */
145 #define	EADDRNOTAVAIL	99	/* Cannot assign requested address */
146 #define	ENETDOWN	100	/* Network is down */
147 #define	ENETUNREACH	101	/* Network is unreachable */
148 #define	ENETRESET	102	/* Network dropped connection because of reset */
149 #define	ECONNABORTED	103	/* Software caused connection abort */
150 #define	ECONNRESET	104	/* Connection reset by peer */
151 #define	ENOBUFS		105	/* No buffer space available */
152 #define	EISCONN		106	/* Transport endpoint is already connected */
153 #define	ENOTCONN	107	/* Transport endpoint is not connected */
154 #define	ESHUTDOWN	108	/* Cannot send after transport endpoint shutdown */
155 #define	ETOOMANYREFS	109	/* Too many references: cannot splice */
156 #define	ETIMEDOUT	110	/* Connection timed out */
157 #define	ECONNREFUSED	111	/* Connection refused */
158 #define	EHOSTDOWN	112	/* Host is down */
159 #define	EHOSTUNREACH	113	/* No route to host */
160 #define	EALREADY	114	/* Operation already in progress */
161 #define	EINPROGRESS	115	/* Operation now in progress */
162 #define	ESTALE		116	/* Stale NFS file handle */
163 #define	EUCLEAN		117	/* Structure needs cleaning */
164 #define	ENOTNAM		118	/* Not a XENIX named type file */
165 #define	ENAVAIL		119	/* No XENIX semaphores available */
166 #define	EISNAM		120	/* Is a named type file */
167 #define	EREMOTEIO	121	/* Remote I/O error */
168 #define	EDQUOT		122	/* Quota exceeded */
169 
170 #define	ENOMEDIUM	123	/* No medium found */
171 #define	EMEDIUMTYPE	124	/* Wrong medium type */
172 #define	ECANCELED	125	/* Operation Canceled */
173 
174 #define __ELASTERROR 2000	/* Users can add values starting here */
175 
176 #ifdef __cplusplus
177 }
178 #endif
179 #endif /* _SYS_ERRNO_H */
180