Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perlfunc/stat: fix description of S_ENFMT and S_IFMT
S_ENFMT properly belongs to the group of permission bits (like setuid/setgid), not file types. On systems that have it (like AIX), it can be set/cleared with chmod(). (In fact, it usually shares its value with S_ISGID because enforced locking is signaled by the combination of a non-executable file with the setgid bit set.) S_IFMT($mode) directly gives you one of the file types (S_IFREG, S_IFDIR, etc). You don't need to bit-and it further (especially not with the S_IS* functions), contrary to what the comment claims. (The confusion likely stems from the C side of things, where you'd do `mode & S_IFMT` to extract the file type from the mode bits, leading to code like `(mode & S_IFMT) == S_IFDIR`. But even then you could write `S_ISDIR(mode)` without any bit mask trickery.) Most of the symbols in the "S_IF* constants" section don't start with "S_IF", so change to "S_I* constants" everywhere. Most of the symbols in the "S_IF* functions" section don't start with "S_IF" (with the sole exception of S_IFMT, which is only a function in Perl; the C macro is a constant). (Historical note: This section label used to make more sense because it documented S_IFMODE and S_IFMT functions, but the former was just a typo for S_IMODE.)
- Loading branch information