[rtsan] Remove mkfifoat interceptor (#116997)
[llvm-project.git] / libcxx / include / __filesystem / perms.h
blob458f1e6e5348339ec0007f764458924669cdfe30
1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___FILESYSTEM_PERMS_H
11 #define _LIBCPP___FILESYSTEM_PERMS_H
13 #include <__config>
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 # pragma GCC system_header
17 #endif
19 #if _LIBCPP_STD_VER >= 17
21 _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
23 // On Windows, these permission bits map to one single readonly flag per
24 // file, and the executable bit is always returned as set. When setting
25 // permissions, as long as the write bit is set for either owner, group or
26 // others, the readonly flag is cleared.
27 enum class perms : unsigned {
28 none = 0,
30 owner_read = 0400,
31 owner_write = 0200,
32 owner_exec = 0100,
33 owner_all = 0700,
35 group_read = 040,
36 group_write = 020,
37 group_exec = 010,
38 group_all = 070,
40 others_read = 04,
41 others_write = 02,
42 others_exec = 01,
43 others_all = 07,
45 all = 0777,
47 set_uid = 04000,
48 set_gid = 02000,
49 sticky_bit = 01000,
50 mask = 07777,
51 unknown = 0xFFFF,
54 _LIBCPP_HIDE_FROM_ABI inline constexpr perms operator&(perms __lhs, perms __rhs) {
55 return static_cast<perms>(static_cast<unsigned>(__lhs) & static_cast<unsigned>(__rhs));
58 _LIBCPP_HIDE_FROM_ABI inline constexpr perms operator|(perms __lhs, perms __rhs) {
59 return static_cast<perms>(static_cast<unsigned>(__lhs) | static_cast<unsigned>(__rhs));
62 _LIBCPP_HIDE_FROM_ABI inline constexpr perms operator^(perms __lhs, perms __rhs) {
63 return static_cast<perms>(static_cast<unsigned>(__lhs) ^ static_cast<unsigned>(__rhs));
66 _LIBCPP_HIDE_FROM_ABI inline constexpr perms operator~(perms __lhs) {
67 return static_cast<perms>(~static_cast<unsigned>(__lhs));
70 _LIBCPP_HIDE_FROM_ABI inline perms& operator&=(perms& __lhs, perms __rhs) { return __lhs = __lhs & __rhs; }
72 _LIBCPP_HIDE_FROM_ABI inline perms& operator|=(perms& __lhs, perms __rhs) { return __lhs = __lhs | __rhs; }
74 _LIBCPP_HIDE_FROM_ABI inline perms& operator^=(perms& __lhs, perms __rhs) { return __lhs = __lhs ^ __rhs; }
76 _LIBCPP_END_NAMESPACE_FILESYSTEM
78 #endif // _LIBCPP_STD_VER >= 17
80 #endif // _LIBCPP___FILESYSTEM_PERMS_H