I've learned that besides the standard *nix file permissions, macOS also has file flags, and that they originated with BSD Unix. macOS's set of such flags is:
UF_NODUMP Do not dump the file. UF_IMMUTABLE The file may not be changed. UF_APPEND The file may only be appended to. UF_OPAQUE The directory is opaque when viewed through a union stack. UF_HIDDEN The file or directory is not intended to be dis-played displayed played to the user. SF_ARCHIVED The file has been archived. SF_IMMUTABLE The file may not be changed. SF_APPEND The file may only be appended to.
You can see these extra flags with an extra switch to ls, though the switch varies:
ls -lo- BSD and perhaps older versions of macOS
ls -lO- current versions of macOS
You can change the flags with the commands the
chflags command: FreeBSD man page
There are corresponding system calls
fchflags to change these flags: macOS man page
But I can't seem to find a system call to read the flags. Surely
ls calls some function to get them? The syscalls that can change them don't seem to be able to also return their current state.
What am I missing?
(If this belongs on StackOverflow then please feel free to move it there.)