00001 #include <errno.h>
00002 #include "error.h"
00003
00004 #define X(e,s) if (i == e) return s;
00005
00006 char *error_str(int i)
00007 {
00008 X(0,"no error")
00009 X(error_intr,"interrupted system call")
00010 X(error_nomem,"out of memory")
00011 X(error_noent,"file does not exist")
00012 X(error_txtbsy,"text busy")
00013 X(error_io,"input/output error")
00014 X(error_exist,"file already exists")
00015 X(error_timeout,"timed out")
00016 X(error_inprogress,"operation in progress")
00017 X(error_again,"temporary failure")
00018 X(error_wouldblock,"input/output would block")
00019 X(error_pipe,"broken pipe")
00020 X(error_perm,"permission denied")
00021 X(error_acces,"access denied")
00022 X(error_nodevice,"device not configured")
00023 X(error_proto,"protocol error")
00024 #ifdef ESRCH
00025 X(ESRCH,"no such process")
00026 #endif
00027 #ifdef E2BIG
00028 X(E2BIG,"argument list too long")
00029 #endif
00030 #ifdef ENOEXEC
00031 X(ENOEXEC,"exec format error")
00032 #endif
00033 #ifdef EBADF
00034 X(EBADF,"file descriptor not open")
00035 #endif
00036 #ifdef ECHILD
00037 X(ECHILD,"no child processes")
00038 #endif
00039 #ifdef EDEADLK
00040 X(EDEADLK,"operation would cause deadlock")
00041 #endif
00042 #ifdef EFAULT
00043 X(EFAULT,"bad address")
00044 #endif
00045 #ifdef ENOTBLK
00046 X(ENOTBLK,"not a block device")
00047 #endif
00048 #ifdef EBUSY
00049 X(EBUSY,"device busy")
00050 #endif
00051 #ifdef EXDEV
00052 X(EXDEV,"cross-device link")
00053 #endif
00054 #ifdef ENODEV
00055 X(ENODEV,"device does not support operation")
00056 #endif
00057 #ifdef ENOTDIR
00058 X(ENOTDIR,"not a directory")
00059 #endif
00060 #ifdef EISDIR
00061 X(EISDIR,"is a directory")
00062 #endif
00063 #ifdef EINVAL
00064 X(EINVAL,"invalid argument")
00065 #endif
00066 #ifdef ENFILE
00067 X(ENFILE,"system cannot open more files")
00068 #endif
00069 #ifdef EMFILE
00070 X(EMFILE,"process cannot open more files")
00071 #endif
00072 #ifdef ENOTTY
00073 X(ENOTTY,"not a tty")
00074 #endif
00075 #ifdef EFBIG
00076 X(EFBIG,"file too big")
00077 #endif
00078 #ifdef ENOSPC
00079 X(ENOSPC,"out of disk space")
00080 #endif
00081 #ifdef ESPIPE
00082 X(ESPIPE,"unseekable descriptor")
00083 #endif
00084 #ifdef EROFS
00085 X(EROFS,"read-only file system")
00086 #endif
00087 #ifdef EMLINK
00088 X(EMLINK,"too many links")
00089 #endif
00090 #ifdef EDOM
00091 X(EDOM,"input out of range")
00092 #endif
00093 #ifdef ERANGE
00094 X(ERANGE,"output out of range")
00095 #endif
00096 #ifdef EALREADY
00097 X(EALREADY,"operation already in progress")
00098 #endif
00099 #ifdef ENOTSOCK
00100 X(ENOTSOCK,"not a socket")
00101 #endif
00102 #ifdef EDESTADDRREQ
00103 X(EDESTADDRREQ,"destination address required")
00104 #endif
00105 #ifdef EMSGSIZE
00106 X(EMSGSIZE,"message too long")
00107 #endif
00108 #ifdef EPROTOTYPE
00109 X(EPROTOTYPE,"incorrect protocol type")
00110 #endif
00111 #ifdef ENOPROTOOPT
00112 X(ENOPROTOOPT,"protocol not available")
00113 #endif
00114 #ifdef EPROTONOSUPPORT
00115 X(EPROTONOSUPPORT,"protocol not supported")
00116 #endif
00117 #ifdef ESOCKTNOSUPPORT
00118 X(ESOCKTNOSUPPORT,"socket type not supported")
00119 #endif
00120 #ifdef EOPNOTSUPP
00121 X(EOPNOTSUPP,"operation not supported")
00122 #endif
00123 #ifdef EPFNOSUPPORT
00124 X(EPFNOSUPPORT,"protocol family not supported")
00125 #endif
00126 #ifdef EAFNOSUPPORT
00127 X(EAFNOSUPPORT,"address family not supported")
00128 #endif
00129 #ifdef EADDRINUSE
00130 X(EADDRINUSE,"address already used")
00131 #endif
00132 #ifdef EADDRNOTAVAIL
00133 X(EADDRNOTAVAIL,"address not available")
00134 #endif
00135 #ifdef ENETDOWN
00136 X(ENETDOWN,"network down")
00137 #endif
00138 #ifdef ENETUNREACH
00139 X(ENETUNREACH,"network unreachable")
00140 #endif
00141 #ifdef ENETRESET
00142 X(ENETRESET,"network reset")
00143 #endif
00144 #ifdef ECONNABORTED
00145 X(ECONNABORTED,"connection aborted")
00146 #endif
00147 #ifdef ECONNRESET
00148 X(ECONNRESET,"connection reset")
00149 #endif
00150 #ifdef ENOBUFS
00151 X(ENOBUFS,"out of buffer space")
00152 #endif
00153 #ifdef EISCONN
00154 X(EISCONN,"already connected")
00155 #endif
00156 #ifdef ENOTCONN
00157 X(ENOTCONN,"not connected")
00158 #endif
00159 #ifdef ESHUTDOWN
00160 X(ESHUTDOWN,"socket shut down")
00161 #endif
00162 #ifdef ETOOMANYREFS
00163 X(ETOOMANYREFS,"too many references")
00164 #endif
00165 #ifdef ECONNREFUSED
00166 X(ECONNREFUSED,"connection refused")
00167 #endif
00168 #ifdef ELOOP
00169 X(ELOOP,"symbolic link loop")
00170 #endif
00171 #ifdef ENAMETOOLONG
00172 X(ENAMETOOLONG,"file name too long")
00173 #endif
00174 #ifdef EHOSTDOWN
00175 X(EHOSTDOWN,"host down")
00176 #endif
00177 #ifdef EHOSTUNREACH
00178 X(EHOSTUNREACH,"host unreachable")
00179 #endif
00180 #ifdef ENOTEMPTY
00181 X(ENOTEMPTY,"directory not empty")
00182 #endif
00183 #ifdef EPROCLIM
00184 X(EPROCLIM,"too many processes")
00185 #endif
00186 #ifdef EUSERS
00187 X(EUSERS,"too many users")
00188 #endif
00189 #ifdef EDQUOT
00190 X(EDQUOT,"disk quota exceeded")
00191 #endif
00192 #ifdef ESTALE
00193 X(ESTALE,"stale NFS file handle")
00194 #endif
00195 #ifdef EREMOTE
00196 X(EREMOTE,"too many levels of remote in path")
00197 #endif
00198 #ifdef EBADRPC
00199 X(EBADRPC,"RPC structure is bad")
00200 #endif
00201 #ifdef ERPCMISMATCH
00202 X(ERPCMISMATCH,"RPC version mismatch")
00203 #endif
00204 #ifdef EPROGUNAVAIL
00205 X(EPROGUNAVAIL,"RPC program unavailable")
00206 #endif
00207 #ifdef EPROGMISMATCH
00208 X(EPROGMISMATCH,"program version mismatch")
00209 #endif
00210 #ifdef EPROCUNAVAIL
00211 X(EPROCUNAVAIL,"bad procedure for program")
00212 #endif
00213 #ifdef ENOLCK
00214 X(ENOLCK,"no locks available")
00215 #endif
00216 #ifdef ENOSYS
00217 X(ENOSYS,"system call not available")
00218 #endif
00219 #ifdef EFTYPE
00220 X(EFTYPE,"bad file type")
00221 #endif
00222 #ifdef EAUTH
00223 X(EAUTH,"authentication error")
00224 #endif
00225 #ifdef ENEEDAUTH
00226 X(ENEEDAUTH,"not authenticated")
00227 #endif
00228 #ifdef ENOSTR
00229 X(ENOSTR,"not a stream device")
00230 #endif
00231 #ifdef ETIME
00232 X(ETIME,"timer expired")
00233 #endif
00234 #ifdef ENOSR
00235 X(ENOSR,"out of stream resources")
00236 #endif
00237 #ifdef ENOMSG
00238 X(ENOMSG,"no message of desired type")
00239 #endif
00240 #ifdef EBADMSG
00241 X(EBADMSG,"bad message type")
00242 #endif
00243 #ifdef EIDRM
00244 X(EIDRM,"identifier removed")
00245 #endif
00246 #ifdef ENONET
00247 X(ENONET,"machine not on network")
00248 #endif
00249 #ifdef ERREMOTE
00250 X(ERREMOTE,"object not local")
00251 #endif
00252 #ifdef ENOLINK
00253 X(ENOLINK,"link severed")
00254 #endif
00255 #ifdef EADV
00256 X(EADV,"advertise error")
00257 #endif
00258 #ifdef ESRMNT
00259 X(ESRMNT,"srmount error")
00260 #endif
00261 #ifdef ECOMM
00262 X(ECOMM,"communication error")
00263 #endif
00264 #ifdef EMULTIHOP
00265 X(EMULTIHOP,"multihop attempted")
00266 #endif
00267 #ifdef EREMCHG
00268 X(EREMCHG,"remote address changed")
00269 #endif
00270 return "unknown error";
00271 }