errno.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* Copyright (C) 2021 Rain */
  2. /* This file is part of XNIX. */
  3. /*
  4. XNIX 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. XNIX 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 XNIX. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. #ifndef INCLUDED_ERRNO_H
  20. #define INCLUDED_ERRNO_H
  21. #include <kernel/types.h>
  22. typedef __uint32_t errno_t;
  23. /* error in kernel */
  24. #define E_KERROR 0x20000000
  25. /* error io port */
  26. #define E_IOERROR 0x00000001 | E_KERROR
  27. /* no enough memory for this call */
  28. #define E_NOMEM 0x00000002 | E_KERROR
  29. /* call interrupted by signal */
  30. #define E_SIGNAL 0x00000003 | E_KERROR
  31. /* kernel not supported */
  32. #define E_NOSUPP 0x00000004 | E_KERROR
  33. /* no permision */
  34. #define E_DENIED 0x40000000
  35. /* need root to call this */
  36. #define E_NDROOT 0x00000001 | E_DENIED
  37. /* no io passport */
  38. #define E_IODND 0x00000002 | E_DENIED
  39. /* need hardware super 0 */
  40. #define E_HARDSP 0x00000003 | E_DENIED
  41. /* hardware no support */
  42. #define E_HNOSUP 0x00000004 | E_DENIED
  43. /* user error (caller) */
  44. #define E_UERROR 0x80000000
  45. /* syntax error for this call (invalid argument) */
  46. #define E_SYNERR 0x00000001 | E_UERROR
  47. /* error because address is invalid */
  48. #define E_ADDRE 0x00000002 | E_UERROR
  49. /* call out of range */
  50. #define E_OUTRAG 0x00000003 | E_UERROR
  51. #endif