27 Input/output library [input.output]

27.10 File systems [filesystems]

27.10.15 Filesystem operation functions [fs.op.funcs]

27.10.15.26 Permissions [fs.op.permissions]

void permissions(const path& p, perms prms); void permissions(const path& p, perms prms, error_code& ec);

Requires: !((prms & perms::add_perms) != perms::none && (prms & perms::remove_perms) != perms::none).

Effects: Applies the effective permissions bits from prms to the file p resolves to, or if that file is a symbolic link and symlink_nofollow is not set in prms, the file that it points to, as if by POSIX fchmodat(). The effective permission bits are determined as specified in Table [tab:fs.op.permissions], where s is the result of (prms & perms::symlink_nofollow) != perms::none ? symlink_status(p) : status(p).

Table 127 — Effects of permission bits
Bits present in prmsEffective bits applied
Neither add_perms nor remove_perms prms & perms::mask
add_perms s.permissions() | (prms & perms::mask)
remove_perms s.permissions() & ~(prms & perms::mask)

Note: Conceptually permissions are viewed as bits, but the actual implementation may use some other mechanism.  — end note ]

Throws: As specified in [fs.err.report].