>> From source inspection, Net and Free appear to allow read(2) of >> dirs to succeed. However, since Linux, Mac OS X and Solaris have >> the EISDIR behavior I think it is probably safe from a portability >> standpoint.
I want to explain why I chose the semantic of "read returns 0", about 20 years ago I guess. All of those systems already have that semantic on NFS directories -- directory fd reads return 0. Therefore, it seemed reasonable to assume that all programs could already handle that case properly. Sun and CSRG had done the auditing work on the base utilities during the 90's, so applying the same rule to native filesystem seemed sound. It was simply impossible to add a new error condition to system call #4, without auditing everything. Maybe some of these vendors continued their utility audit and switched to EISDIR on native filesystems. Well.... we haven't done that work yet.