@@ -1396,6 +1396,15 @@ pub mod funcs {
13961396 #[ cfg( target_os = "android" ) ]
13971397 #[ cfg( target_os = "freebsd" ) ]
13981398 unsafe fn readdir ( dirp : * DIR ) -> * dirent_t ;
1399+
1400+ unsafe fn closedir ( dirp : * DIR ) -> c_int ;
1401+ unsafe fn rewinddir ( dirp : * DIR ) ;
1402+ unsafe fn seekdir ( dirp : * DIR , loc : c_long ) ;
1403+ unsafe fn telldir ( dirp : * DIR ) -> c_long ;
1404+ }
1405+
1406+ #[ cfg( target_word_size = "64" ) ]
1407+ pub extern {
13991408 // on OSX (particularly when running with a
14001409 // 64bit kernel), we have an issue where there
14011410 // are separate bindings for opendir and readdir,
@@ -1406,11 +1415,17 @@ pub mod funcs {
14061415 #[ cfg( target_os = "macos" ) ]
14071416 #[ link_name = "readdir$INODE64" ]
14081417 unsafe fn readdir ( dirp : * DIR ) -> * dirent_t ;
1409-
1410- unsafe fn closedir ( dirp : * DIR ) -> c_int ;
1411- unsafe fn rewinddir ( dirp : * DIR ) ;
1412- unsafe fn seekdir ( dirp : * DIR , loc : c_long ) ;
1413- unsafe fn telldir ( dirp : * DIR ) -> c_long ;
1418+ }
1419+ #[ cfg( target_word_size = "32" ) ]
1420+ pub extern {
1421+ // on OSX (particularly when running with a
1422+ // 64bit kernel), we have an issue where there
1423+ // are separate bindings for opendir and readdir,
1424+ // which we have to explicitly link, as below.
1425+ #[ cfg( target_os = "macos" ) ]
1426+ unsafe fn opendir ( dirname : * c_char ) -> * DIR ;
1427+ #[ cfg( target_os = "macos" ) ]
1428+ unsafe fn readdir ( dirp : * DIR ) -> * dirent_t ;
14141429 }
14151430 }
14161431
0 commit comments