If a particular filesystem supports cheap removal of whole directories (with everything inside), would it be acceptable by POSIX / Linux / de-facto standards to let
rmdir syscall delete a directory successfully even if it was not empty?
Manpage for rmdir(2) syscall specifies an error
ENOTEMPTY can (or should?) be returned.
Best How To :
According to the "official" spec, http://pubs.opengroup.org/onlinepubs/9699919799//functions/rmdir.html , no. It clearly says
"The directory shall be removed only if it is an empty directory.,
If the directory is not an empty directory, rmdir() shall fail and set errno to [EEXIST] or [ENOTEMPTY]..
Anyway, I suspect such a filesystem supporting cheap removal of whole directories is not POSIX-compliant, as a POSIX-compliant filesystem would need to inspect the link count of every file in the tree, making the operation not-that-cheap. So I suppose you could argue that since the filesystem isn't POSIX-compliant anyway, it can have some leeway in the syscall semantics as well..