e.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #include "e.h"
  2. #define X(e,s) if (i == e) return s;
  3. const char *e_str(int i)
  4. {
  5. X(0,"no error");
  6. X(EINTR,"interrupted system call")
  7. X(ENOMEM,"out of memory")
  8. X(ENOENT,"file does not exist")
  9. X(ETXTBSY,"text busy")
  10. X(EIO,"input/output error")
  11. X(EEXIST,"file already exists")
  12. X(ETIMEDOUT,"timed out")
  13. X(EINPROGRESS,"operation in progress")
  14. X(EAGAIN,"temporary failure")
  15. X(EWOULDBLOCK,"input/output would block")
  16. X(EPIPE,"broken pipe")
  17. X(EPERM,"permission denied")
  18. X(EACCES,"access denied")
  19. X(ENODEV,"device not configured")
  20. X(EPROTO,"protocol error")
  21. X(EISDIR,"is a directory")
  22. X(ESRCH,"no such process")
  23. X(E2BIG,"argument list too long")
  24. X(ENOEXEC,"exec format error")
  25. X(EBADF,"file descriptor not open")
  26. X(ECHILD,"no child processes")
  27. X(EDEADLK,"operation would cause deadlock")
  28. X(EFAULT,"bad address")
  29. X(ENOTBLK,"not a block device")
  30. X(EBUSY,"device busy")
  31. X(EXDEV,"cross-device link")
  32. X(ENODEV,"device does not support operation")
  33. X(ENOTDIR,"not a directory")
  34. X(EINVAL,"invalid argument")
  35. X(ENFILE,"system cannot open more files")
  36. X(EMFILE,"process cannot open more files")
  37. X(ENOTTY,"not a tty")
  38. X(EFBIG,"file too big")
  39. X(ENOSPC,"out of disk space")
  40. X(ESPIPE,"unseekable descriptor")
  41. X(EROFS,"read-only file system")
  42. X(EMLINK,"too many links")
  43. X(EDOM,"input out of range")
  44. X(ERANGE,"output out of range")
  45. X(EALREADY,"operation already in progress")
  46. X(ENOTSOCK,"not a socket")
  47. X(EDESTADDRREQ,"destination address required")
  48. X(EMSGSIZE,"message too long")
  49. X(EPROTOTYPE,"incorrect protocol type")
  50. X(ENOPROTOOPT,"protocol not available")
  51. X(EPROTONOSUPPORT,"protocol not supported")
  52. X(ESOCKTNOSUPPORT,"socket type not supported")
  53. X(EOPNOTSUPP,"operation not supported")
  54. X(EPFNOSUPPORT,"protocol family not supported")
  55. X(EAFNOSUPPORT,"address family not supported")
  56. X(EADDRINUSE,"address already used")
  57. X(EADDRNOTAVAIL,"address not available")
  58. X(ENETDOWN,"network down")
  59. X(ENETUNREACH,"network unreachable")
  60. X(ENETRESET,"network reset")
  61. X(ECONNABORTED,"connection aborted")
  62. X(ECONNRESET,"connection reset")
  63. X(ENOBUFS,"out of buffer space")
  64. X(EISCONN,"already connected")
  65. X(ENOTCONN,"not connected")
  66. X(ESHUTDOWN,"socket shut down")
  67. X(ETOOMANYREFS,"too many references")
  68. X(ECONNREFUSED,"connection refused")
  69. X(ELOOP,"symbolic link loop")
  70. X(ENAMETOOLONG,"file name too long")
  71. X(EHOSTDOWN,"host down")
  72. X(EHOSTUNREACH,"host unreachable")
  73. X(ENOTEMPTY,"directory not empty")
  74. X(EPROCLIM,"too many processes")
  75. X(EUSERS,"too many users")
  76. X(EDQUOT,"disk quota exceeded")
  77. X(ESTALE,"stale NFS file handle")
  78. X(EREMOTE,"too many levels of remote in path")
  79. X(EBADRPC,"RPC structure is bad")
  80. X(ERPCMISMATCH,"RPC version mismatch")
  81. X(EPROGUNAVAIL,"RPC program unavailable")
  82. X(EPROGMISMATCH,"program version mismatch")
  83. X(EPROCUNAVAIL,"bad procedure for program")
  84. X(ENOLCK,"no locks available")
  85. X(ENOSYS,"system call not available")
  86. X(EFTYPE,"bad file type")
  87. X(EAUTH,"authentication error")
  88. X(ENEEDAUTH,"not authenticated")
  89. X(ENOSTR,"not a stream device")
  90. X(ETIME,"timer expired")
  91. X(ENOSR,"out of stream resources")
  92. X(ENOMSG,"no message of desired type")
  93. X(EBADMSG,"bad message type")
  94. X(EIDRM,"identifier removed")
  95. X(ENONET,"machine not on network")
  96. X(EREMOTE,"object not local")
  97. X(ENOLINK,"link severed")
  98. X(EADV,"advertise error")
  99. X(ESRMNT,"srmount error")
  100. X(ECOMM,"communication error")
  101. X(EMULTIHOP,"multihop attempted")
  102. X(EREMCHG,"remote address changed")
  103. return "unknown error";
  104. }