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