stat.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* Copyright (C) 2020 Jeremiah Orians
  2. * This file is part of M2-Planet.
  3. *
  4. * M2-Planet 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) any later version.
  8. *
  9. * M2-Planet is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef _SYS_STAT_C
  18. #define _SYS_STAT_C
  19. #include <sys/types.h>
  20. #define S_IRWXU 00700
  21. #define S_IXUSR 00100
  22. #define S_IWUSR 00200
  23. #define S_IRUSR 00400
  24. #define S_ISUID 04000
  25. #define S_ISGID 02000
  26. #define S_IXGRP 00010
  27. #define S_IXOTH 00001
  28. #define S_IRGRP 00040
  29. #define S_IROTH 00004
  30. #define S_IWGRP 00020
  31. #define S_IWOTH 00002
  32. #define S_IRWXG 00070
  33. #define S_IRWXO 00007
  34. int chmod(char *pathname, int mode)
  35. {
  36. asm("LOAD R0 R14 0"
  37. "LOAD R1 R14 4"
  38. "SYS_CHMOD");
  39. }
  40. int fchmod(int a, mode_t b)
  41. {
  42. asm("LOAD R0 R14 0"
  43. "LOAD R1 R14 4"
  44. "SYS_FCHMOD");
  45. }
  46. int mkdir(char const* a, mode_t b)
  47. {
  48. asm("LOAD R0 R14 0"
  49. "LOAD R1 R14 4"
  50. "SYS_MKDIR");
  51. }
  52. int mknod(char const* a, mode_t b, dev_t c)
  53. {
  54. asm("LOAD R0 R14 0"
  55. "LOAD R1 R14 4"
  56. "LOAD R2 R14 8"
  57. "SYS_MKNOD");
  58. }
  59. mode_t umask(mode_t m)
  60. {
  61. asm("LOAD R0 R14 0"
  62. "SYS_UMASK");
  63. }
  64. #endif