@@ -1396,6 +1396,15 @@ pub mod funcs {
1396
1396
#[ cfg( target_os = "android" ) ]
1397
1397
#[ cfg( target_os = "freebsd" ) ]
1398
1398
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 {
1399
1408
// on OSX (particularly when running with a
1400
1409
// 64bit kernel), we have an issue where there
1401
1410
// are separate bindings for opendir and readdir,
@@ -1406,11 +1415,17 @@ pub mod funcs {
1406
1415
#[ cfg( target_os = "macos" ) ]
1407
1416
#[ link_name = "readdir$INODE64" ]
1408
1417
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 ;
1414
1429
}
1415
1430
}
1416
1431
0 commit comments