errno.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* Copyright (C) 2021 Rain */
  2. /* This file is part of Cunix. */
  3. /*
  4. Cunix is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) and later version.
  8. */
  9. /*
  10. Cunix is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. */
  15. /*
  16. You should have received a copy of the GNU General Public License
  17. along with Cunix. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. #ifndef INCLUDED_ERRNO_H
  20. #define INCLUDED_ERRNO_H
  21. typedef __uint32_t errno_t;
  22. /* error in kernel */
  23. #define E_KERROR 0x20000000
  24. /* error io port */
  25. #define E_IOERROR 0x00000001 | E_KERROR
  26. /* no enough memory for this call */
  27. #define E_NOMEM 0x00000002 | E_KERROR
  28. /* call interrupted by signal */
  29. #define E_SIGNAL 0x00000003 | E_KERROR
  30. /* kernel not supported */
  31. #define E_NOSUPP 0x00000004 | E_KERROR
  32. /* no permision */
  33. #define E_DENIED 0x40000000
  34. /* need root to call this */
  35. #define E_NDROOT 0x00000001 | E_DENIED
  36. /* no io passport */
  37. #define E_IODND 0x00000002 | E_DENIED
  38. /* need hardware super 0 */
  39. #define E_HARDSP 0x00000003 | E_DENIED
  40. /* hardware no support */
  41. #define E_HNOSUP 0x00000004 | E_DENIED
  42. /* user error (caller) */
  43. #define E_UERROR 0x80000000
  44. /* syntax error for this call (invalid argument) */
  45. #define E_SYNERR 0x00000001 | E_UERROR
  46. /* error because address is invalid */
  47. #define E_ADDRE 0x00000002 | E_UERROR
  48. /* call out of range */
  49. #define E_OUTRAG 0x00000003 | E_UERROR
  50. #endif