Suppose I'm creating a file or directory with some name and mode argument using a system call and that operations fails with EEXIST.
Assuming I know my current umask, euid, and egid, how can I tell if that existing file/directory has permissions equivalent to what the system call would have created had the operation succeeded.
AFAIK, for classical permissions, the answer would be true iff .st_gid == egid && .st_uid == euid && (.st_mode & 07777) == (RequestedMode & 07777 & ~CurrentUmask) and the found/expected filetypes match.
How could this be extended to a system with access control lists?