[system] Fix crash from readdir() on 64bit Mac OS X.

We wrap the readdir and related calls in C so that we allow
the aliases that are set up in the header files to be used. This
keeps everything consistent and using the versions offering 64 bit
inodes and the new versions of the struct dirent.

At the same time, we move dirent-name() to C to keep it consistent
as well and slightly less magical.
Merge pull request #705 from waywardmonkeys/fix-64-bit-os-x-readdir

[system] Fix crash from readdir() on 64bit Mac OS X.