Illumos/Solaris don't have the type in dirent, a protable method should be used
Illumos/Solaris don't have some error codes defined