Skip to content

Commit fab2c13

Browse files
committed
---
yaml --- r: 138959 b: refs/heads/try2 c: 0ad3a11 h: refs/heads/master i: 138957: aefeb00 138955: dd58783 138951: e99ad57 138943: d2b88e2 v: v3
1 parent 9e866af commit fab2c13

File tree

5 files changed

+49
-38
lines changed

5 files changed

+49
-38
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: b60c3bfa4a95fecae2f28929f22f38865d7e5f79
8+
refs/heads/try2: 0ad3a110be9070b87ecd7e1c71d20a02660d8959
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libcore/libc.rs

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,48 +1385,30 @@ pub mod funcs {
13851385
use libc::types::common::posix88::{DIR, dirent_t};
13861386
use libc::types::os::arch::c95::{c_char, c_int, c_long};
13871387

1388-
pub extern {
1389-
// default bindings for opendir and readdir in
1390-
// non-macos unix
1391-
#[cfg(target_os = "linux")]
1392-
#[cfg(target_os = "android")]
1393-
#[cfg(target_os = "freebsd")]
1394-
unsafe fn opendir(dirname: *c_char) -> *DIR;
1395-
#[cfg(target_os = "linux")]
1396-
#[cfg(target_os = "android")]
1397-
#[cfg(target_os = "freebsd")]
1398-
unsafe fn readdir(dirp: *DIR) -> *dirent_t;
1388+
// NOTE: On OS X opendir and readdir have two versions,
1389+
// one for 32-bit kernelspace and one for 64.
1390+
// We should be linking to the 64-bit ones, called
1391+
// opendir$INODE64, etc. but for some reason rustc
1392+
// doesn't link it correctly on i686, so we're going
1393+
// through a C function that mysteriously does work.
1394+
pub unsafe fn opendir(dirname: *c_char) -> *DIR {
1395+
rust_opendir(dirname)
1396+
}
1397+
pub unsafe fn readdir(dirp: *DIR) -> *dirent_t {
1398+
rust_readdir(dirp)
1399+
}
1400+
1401+
extern {
1402+
unsafe fn rust_opendir(dirname: *c_char) -> *DIR;
1403+
unsafe fn rust_readdir(dirp: *DIR) -> *dirent_t;
1404+
}
13991405

1406+
pub extern {
14001407
unsafe fn closedir(dirp: *DIR) -> c_int;
14011408
unsafe fn rewinddir(dirp: *DIR);
14021409
unsafe fn seekdir(dirp: *DIR, loc: c_long);
14031410
unsafe fn telldir(dirp: *DIR) -> c_long;
14041411
}
1405-
1406-
#[cfg(target_word_size = "64")]
1407-
pub extern {
1408-
// on OSX (particularly when running with a
1409-
// 64bit kernel), we have an issue where there
1410-
// are separate bindings for opendir and readdir,
1411-
// which we have to explicitly link, as below.
1412-
#[cfg(target_os = "macos")]
1413-
#[link_name = "opendir$INODE64"]
1414-
unsafe fn opendir(dirname: *c_char) -> *DIR;
1415-
#[cfg(target_os = "macos")]
1416-
#[link_name = "readdir$INODE64"]
1417-
unsafe fn readdir(dirp: *DIR) -> *dirent_t;
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;
1429-
}
14301412
}
14311413

14321414
#[nolink]

branches/try2/src/libuv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 218ab86721eefd7b7e97fa6d9f95a80a1fa8686c
1+
Subproject commit 576ab1db8ea03889eb7b2274654afe7c5c867230

branches/try2/src/rt/rust_builtin.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,33 @@ rust_dec_kernel_live_count() {
818818
task->kernel->dec_live_count();
819819
}
820820

821+
#ifndef _WIN32
822+
#include <sys/types.h>
823+
#include <dirent.h>
824+
825+
extern "C" DIR*
826+
rust_opendir(char *dirname) {
827+
return opendir(dirname);
828+
}
829+
830+
extern "C" dirent*
831+
rust_readdir(DIR *dirp) {
832+
return readdir(dirp);
833+
}
834+
835+
#else
836+
837+
extern "C" void
838+
rust_opendir() {
839+
}
840+
841+
extern "C" void
842+
rust_readdir() {
843+
}
844+
845+
#endif
846+
847+
821848
//
822849
// Local Variables:
823850
// mode: C++

branches/try2/src/rt/rustrt.def.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,5 @@ rust_dec_kernel_live_count
194194
rust_get_exchange_count_ptr
195195
rust_get_sched_tls_key
196196
swap_registers
197+
rust_readdir
198+
rust_opendir

0 commit comments

Comments
 (0)