Implement sync.readdir().