errno.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Global errno and strerror for single-threaded ring-3 commands. */
  2. #include <errno.h>
  3. int errno;
  4. const char *strerror(int err)
  5. {
  6. switch (err) {
  7. case 0: return "Success";
  8. case EPERM: return "Operation not permitted";
  9. case ENOENT: return "No such file or directory";
  10. case ESRCH: return "No such process";
  11. case EINTR: return "Interrupted system call";
  12. case EIO: return "I/O error";
  13. case ENXIO: return "No such device or address";
  14. case E2BIG: return "Argument list too long";
  15. case ENOEXEC: return "Exec format error";
  16. case EBADF: return "Bad file descriptor";
  17. case ECHILD: return "No child processes";
  18. case EAGAIN: return "Resource temporarily unavailable";
  19. case ENOMEM: return "Cannot allocate memory";
  20. case EACCES: return "Permission denied";
  21. case EFAULT: return "Bad address";
  22. case EBUSY: return "Device or resource busy";
  23. case EEXIST: return "File exists";
  24. case EXDEV: return "Invalid cross-device link";
  25. case ENODEV: return "No such device";
  26. case ENOTDIR: return "Not a directory";
  27. case EISDIR: return "Is a directory";
  28. case EINVAL: return "Invalid argument";
  29. case ENFILE: return "Too many open files in system";
  30. case EMFILE: return "Too many open files";
  31. case ENOTTY: return "Inappropriate ioctl for device";
  32. case EFBIG: return "File too large";
  33. case ENOSPC: return "No space left on device";
  34. case ESPIPE: return "Illegal seek";
  35. case EROFS: return "Read-only file system";
  36. case EPIPE: return "Broken pipe";
  37. case EDOM: return "Numerical argument out of domain";
  38. case ERANGE: return "Numerical result out of range";
  39. case ENOSYS: return "Function not implemented";
  40. case EOVERFLOW: return "Value too large for defined data type";
  41. case EOPNOTSUPP: return "Operation not supported";
  42. case ENAMETOOLONG: return "File name too long";
  43. default: return "Unknown error";
  44. }
  45. }