main shrub/shrubtools / shared / error_str.c
  1/* Public domain. */
  2
  3#include <errno.h>
  4#include "error.h"
  5
  6#define X(e,s) if (i == e) return s;
  7
  8const char *error_str(int i)
  9{
 10  X(0,"no error")
 11  X(error_intr,"interrupted system call")
 12  X(error_nomem,"out of memory")
 13  X(error_noent,"file does not exist")
 14  X(error_txtbsy,"text busy")
 15  X(error_io,"input/output error")
 16  X(error_exist,"file already exists")
 17  X(error_timeout,"timed out")
 18  X(error_inprogress,"operation in progress")
 19  X(error_again,"temporary failure")
 20  X(error_wouldblock,"input/output would block")
 21  X(error_pipe,"broken pipe")
 22  X(error_perm,"permission denied")
 23  X(error_acces,"access denied")
 24  X(error_nodevice,"device not configured")
 25  X(error_proto,"protocol error")
 26  X(error_isdir,"is a directory")
 27  X(error_connrefused,"connection refused")
 28  X(error_notdir,"not a directory")
 29#ifdef ESRCH
 30  X(ESRCH,"no such process")
 31#endif
 32#ifdef E2BIG
 33  X(E2BIG,"argument list too long")
 34#endif
 35#ifdef ENOEXEC
 36  X(ENOEXEC,"exec format error")
 37#endif
 38#ifdef EBADF
 39  X(EBADF,"file descriptor not open")
 40#endif
 41#ifdef ECHILD
 42  X(ECHILD,"no child processes")
 43#endif
 44#ifdef EDEADLK
 45  X(EDEADLK,"operation would cause deadlock")
 46#endif
 47#ifdef EFAULT
 48  X(EFAULT,"bad address")
 49#endif
 50#ifdef ENOTBLK
 51  X(ENOTBLK,"not a block device")
 52#endif
 53#ifdef EBUSY
 54  X(EBUSY,"device busy")
 55#endif
 56#ifdef EXDEV
 57  X(EXDEV,"cross-device link")
 58#endif
 59#ifdef ENODEV
 60  X(ENODEV,"device does not support operation")
 61#endif
 62#ifdef EINVAL
 63  X(EINVAL,"invalid argument")
 64#endif
 65#ifdef ENFILE
 66  X(ENFILE,"system cannot open more files")
 67#endif
 68#ifdef EMFILE
 69  X(EMFILE,"process cannot open more files")
 70#endif
 71#ifdef ENOTTY
 72  X(ENOTTY,"not a tty")
 73#endif
 74#ifdef EFBIG
 75  X(EFBIG,"file too big")
 76#endif
 77#ifdef ENOSPC
 78  X(ENOSPC,"out of disk space")
 79#endif
 80#ifdef ESPIPE
 81  X(ESPIPE,"unseekable descriptor")
 82#endif
 83#ifdef EROFS
 84  X(EROFS,"read-only file system")
 85#endif
 86#ifdef EMLINK
 87  X(EMLINK,"too many links")
 88#endif
 89#ifdef EDOM
 90  X(EDOM,"input out of range")
 91#endif
 92#ifdef ERANGE
 93  X(ERANGE,"output out of range")
 94#endif
 95#ifdef EALREADY
 96  X(EALREADY,"operation already in progress")
 97#endif
 98#ifdef ENOTSOCK
 99  X(ENOTSOCK,"not a socket")
100#endif
101#ifdef EDESTADDRREQ
102  X(EDESTADDRREQ,"destination address required")
103#endif
104#ifdef EMSGSIZE
105  X(EMSGSIZE,"message too long")
106#endif
107#ifdef EPROTOTYPE
108  X(EPROTOTYPE,"incorrect protocol type")
109#endif
110#ifdef ENOPROTOOPT
111  X(ENOPROTOOPT,"protocol not available")
112#endif
113#ifdef EPROTONOSUPPORT
114  X(EPROTONOSUPPORT,"protocol not supported")
115#endif
116#ifdef ESOCKTNOSUPPORT
117  X(ESOCKTNOSUPPORT,"socket type not supported")
118#endif
119#ifdef EOPNOTSUPP
120  X(EOPNOTSUPP,"operation not supported")
121#endif
122#ifdef EPFNOSUPPORT
123  X(EPFNOSUPPORT,"protocol family not supported")
124#endif
125#ifdef EAFNOSUPPORT
126  X(EAFNOSUPPORT,"address family not supported")
127#endif
128#ifdef EADDRINUSE
129  X(EADDRINUSE,"address already used")
130#endif
131#ifdef EADDRNOTAVAIL
132  X(EADDRNOTAVAIL,"address not available")
133#endif
134#ifdef ENETDOWN
135  X(ENETDOWN,"network down")
136#endif
137#ifdef ENETUNREACH
138  X(ENETUNREACH,"network unreachable")
139#endif
140#ifdef ENETRESET
141  X(ENETRESET,"network reset")
142#endif
143#ifdef ECONNABORTED
144  X(ECONNABORTED,"connection aborted")
145#endif
146#ifdef ECONNRESET
147  X(ECONNRESET,"connection reset")
148#endif
149#ifdef ENOBUFS
150  X(ENOBUFS,"out of buffer space")
151#endif
152#ifdef EISCONN
153  X(EISCONN,"already connected")
154#endif
155#ifdef ENOTCONN
156  X(ENOTCONN,"not connected")
157#endif
158#ifdef ESHUTDOWN
159  X(ESHUTDOWN,"socket shut down")
160#endif
161#ifdef ETOOMANYREFS
162  X(ETOOMANYREFS,"too many references")
163#endif
164#ifdef ELOOP
165  X(ELOOP,"symbolic link loop")
166#endif
167#ifdef ENAMETOOLONG
168  X(ENAMETOOLONG,"file name too long")
169#endif
170#ifdef EHOSTDOWN
171  X(EHOSTDOWN,"host down")
172#endif
173#ifdef EHOSTUNREACH
174  X(EHOSTUNREACH,"host unreachable")
175#endif
176#ifdef ENOTEMPTY
177  X(ENOTEMPTY,"directory not empty")
178#endif
179#ifdef EPROCLIM
180  X(EPROCLIM,"too many processes")
181#endif
182#ifdef EUSERS
183  X(EUSERS,"too many users")
184#endif
185#ifdef EDQUOT
186  X(EDQUOT,"disk quota exceeded")
187#endif
188#ifdef ESTALE
189  X(ESTALE,"stale NFS file handle")
190#endif
191#ifdef EREMOTE
192  X(EREMOTE,"too many levels of remote in path")
193#endif
194#ifdef EBADRPC
195  X(EBADRPC,"RPC structure is bad")
196#endif
197#ifdef ERPCMISMATCH
198  X(ERPCMISMATCH,"RPC version mismatch")
199#endif
200#ifdef EPROGUNAVAIL
201  X(EPROGUNAVAIL,"RPC program unavailable")
202#endif
203#ifdef EPROGMISMATCH
204  X(EPROGMISMATCH,"program version mismatch")
205#endif
206#ifdef EPROCUNAVAIL
207  X(EPROCUNAVAIL,"bad procedure for program")
208#endif
209#ifdef ENOLCK
210  X(ENOLCK,"no locks available")
211#endif
212#ifdef ENOSYS
213  X(ENOSYS,"system call not available")
214#endif
215#ifdef EFTYPE
216  X(EFTYPE,"bad file type")
217#endif
218#ifdef EAUTH
219  X(EAUTH,"authentication error")
220#endif
221#ifdef ENEEDAUTH
222  X(ENEEDAUTH,"not authenticated")
223#endif
224#ifdef ENOSTR
225  X(ENOSTR,"not a stream device")
226#endif
227#ifdef ETIME
228  X(ETIME,"timer expired")
229#endif
230#ifdef ENOSR
231  X(ENOSR,"out of stream resources")
232#endif
233#ifdef ENOMSG
234  X(ENOMSG,"no message of desired type")
235#endif
236#ifdef EBADMSG
237  X(EBADMSG,"bad message type")
238#endif
239#ifdef EIDRM
240  X(EIDRM,"identifier removed")
241#endif
242#ifdef ENONET
243  X(ENONET,"machine not on network")
244#endif
245#ifdef ERREMOTE
246  X(ERREMOTE,"object not local")
247#endif
248#ifdef ENOLINK
249  X(ENOLINK,"link severed")
250#endif
251#ifdef EADV
252  X(EADV,"advertise error")
253#endif
254#ifdef ESRMNT
255  X(ESRMNT,"srmount error")
256#endif
257#ifdef ECOMM
258  X(ECOMM,"communication error")
259#endif
260#ifdef EMULTIHOP
261  X(EMULTIHOP,"multihop attempted")
262#endif
263#ifdef EREMCHG
264  X(EREMCHG,"remote address changed")
265#endif
266  return "unknown error";
267}