man rmdir(2) : add EINVAL to the error section
rmdir can return EINVAL if the directory is a mount point :
* Do not allow directories representing mount points to be
* deleted, even if empty. Check write perms on mount point
* in case the vnode is aliased (aka nullfs).
if (nd->nl_nch.ncp->nc_flag & (NCF_ISMOUNTPT))
#1 Updated by swildner about 4 years ago
POSIX has this to say about EINVAL and EBUSY:
The directory to be removed is currently in use by the system or some process and the implementation considers this to be an error.
The path argument contains a last component that is dot.
So I think that we should actually return EBUSY instead of EINVAL for the attempt to rmdir() a directory that is a mount point.
Also, I'm not sure if we handle the "last component that is dot" case correctly yet.