stat.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Copyright (C) 2016 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. /*
  18. * chmod() changes the mode of the file specified whose pathname is given in
  19. * pathname, which is dereferenced if it is a symbolic link.
  20. * fchmod() changes the mode of the file referred to by the open file
  21. * descriptor fd.
  22. * The new file mode is specified in mode, which is a bit mask created by
  23. * ORing together zero or more of the following:
  24. * S_ISUID (04000) set-user-ID (set process effective user ID on execve(2))
  25. * S_ISGID (02000) set-group-ID (set process effective group ID on execve(2)
  26. * mandatory locking, as described in fcntl(2); take a new file's group from
  27. * parent directory, as described in chown(2) and mkdir(2))
  28. * S_ISVTX (01000) sticky bit (restricted deletion flag, as described in
  29. * unlink(2))
  30. * S_IRUSR (00400) read by owner
  31. * S_IWUSR (00200) write by owner
  32. * S_IXUSR (00100) execute/search by owner ("search" applies for directories
  33. * , and means that entries within the directory can be accessed)
  34. * S_IRGRP (00040) read by group
  35. * S_IWGRP (00020) write by group
  36. * S_IXGRP (00010) execute/search by group
  37. * S_IROTH (00004) read by others
  38. * S_IWOTH (00002) write by others
  39. * S_IXOTH (00001) execute/search by others
  40. */
  41. int chmod(char *pathname, int mode)
  42. {
  43. asm("LOAD R0 R14 0"
  44. "LOAD R1 R14 4"
  45. "CHMOD");
  46. }