On Sat, Aug 27, 2022 at 6:05 AM Jeff King <peff@xxxxxxxx> wrote: > Yeah, I saw that. It's a bit vague, and if the call returns ENOSYS or > EISDIR, that would be perfectly fine. It's the "what happens on the > implementations that do support it..." part that I'm more worried about. :) The history here is that pre-4.2BSD, Unix systems had no mkdir system call. You used mknod() to make a truly empty directory and the link() to create the "." and ".." entries within it, and all three of these operations were restricted to the super-user. There was no rmdir either, so again, unlink() as the super-user was permitted to do the job (with three calls to unlink the "." and ".." entries first and then remove the directory). Unlinking a directory when it still contains "." leaves the link count at 1 and there's no GC, so it sits around occupying an inode. If you have a mkdir() system call and don't need backwards compatibility, you get to have these return EISDIR errors... Chris