Improve directory execute permission check in access_euid(). #4402

When checking whether the current euid has execute permission on a
directory, attempt the operation instead of manually examining bits in
the inode. We do this for read and write permissions, and it takes into
account all ways in which the operation may be permitted, including
supplemental groups and POSIX ACLs.
Lean on OS for access() with euid when possible. #4402

access() does file permission checks using the process's real uid. We
want to do checks with the effective uid, so we wrote our own
access_euid(). Recent versions of linux now provide euidaccess(), which
does what we want and should do it better than us. Use it when it's
available.