cmFSPermissions.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmFSPermissions_h
  4. #define cmFSPermissions_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include "cm_sys_stat.h"
  7. #include <string>
  8. namespace cmFSPermissions {
  9. // Table of permissions flags.
  10. #if defined(_WIN32) && !defined(__CYGWIN__)
  11. static const mode_t mode_owner_read = S_IREAD;
  12. static const mode_t mode_owner_write = S_IWRITE;
  13. static const mode_t mode_owner_execute = S_IEXEC;
  14. static const mode_t mode_group_read = 040;
  15. static const mode_t mode_group_write = 020;
  16. static const mode_t mode_group_execute = 010;
  17. static const mode_t mode_world_read = 04;
  18. static const mode_t mode_world_write = 02;
  19. static const mode_t mode_world_execute = 01;
  20. static const mode_t mode_setuid = 04000;
  21. static const mode_t mode_setgid = 02000;
  22. #else
  23. static const mode_t mode_owner_read = S_IRUSR;
  24. static const mode_t mode_owner_write = S_IWUSR;
  25. static const mode_t mode_owner_execute = S_IXUSR;
  26. static const mode_t mode_group_read = S_IRGRP;
  27. static const mode_t mode_group_write = S_IWGRP;
  28. static const mode_t mode_group_execute = S_IXGRP;
  29. static const mode_t mode_world_read = S_IROTH;
  30. static const mode_t mode_world_write = S_IWOTH;
  31. static const mode_t mode_world_execute = S_IXOTH;
  32. static const mode_t mode_setuid = S_ISUID;
  33. static const mode_t mode_setgid = S_ISGID;
  34. #endif
  35. bool stringToModeT(std::string const& arg, mode_t& permissions);
  36. } // ns
  37. #endif