about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-06-20 11:35:34 -0700
committerbors <bors@rust-lang.org>2013-06-20 11:35:34 -0700
commitf348465283d6cd85b69bcdc1711d14985d154c39 (patch)
tree2bd582132e82b3b0acb879311394913144da1ea8 /src/libstd
parentadeb7e77ccff938c0afb105a14a2ff4df4c7efc8 (diff)
parentb82370cec65b17456b1d5b98a283d3f46a8ab09a (diff)
downloadrust-f348465283d6cd85b69bcdc1711d14985d154c39.tar.gz
rust-f348465283d6cd85b69bcdc1711d14985d154c39.zip
auto merge of #7128 : yichoi/rust/fix_sometc, r=brson
- Fix stat struct for Android (found by SEGV at run-pass/stat.rs)
- Adjust some test cases to rpass for Android 
- Modify some script to rpass for Android
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/libc.rs50
-rw-r--r--src/libstd/path.rs30
2 files changed, 78 insertions, 2 deletions
diff --git a/src/libstd/libc.rs b/src/libstd/libc.rs
index 07b2ac6ed01..988fb5cc9b1 100644
--- a/src/libstd/libc.rs
+++ b/src/libstd/libc.rs
@@ -257,6 +257,8 @@ pub mod types {
                 pub type intptr_t = int;
                 pub type uintptr_t = uint;
             }
+            #[cfg(target_arch = "x86")]
+            #[cfg(target_arch = "mips")]
             pub mod posix88 {
                 pub type off_t = i32;
                 pub type dev_t = u64;
@@ -268,6 +270,20 @@ pub mod types {
                 pub type mode_t = u32;
                 pub type ssize_t = i32;
             }
+            #[cfg(target_arch = "arm")]
+            pub mod posix88 {
+                pub type off_t = i32;
+                pub type dev_t = u32;
+                pub type ino_t = u32;
+                pub type pid_t = i32;
+                pub type uid_t = u32;
+                pub type gid_t = u32;
+                pub type useconds_t = u32;
+                pub type mode_t = u16;
+                pub type ssize_t = i32;
+            }
+            #[cfg(target_arch = "x86")]
+            #[cfg(target_arch = "mips")]
             pub mod posix01 {
                 use libc::types::os::arch::c95::{c_short, c_long, c_ulong, time_t};
                 use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t};
@@ -279,7 +295,6 @@ pub mod types {
                 pub type blkcnt_t = i32;
 
                 #[cfg(target_arch = "x86")]
-                #[cfg(target_arch = "arm")]
                 pub struct stat {
                     st_dev: dev_t,
                     __pad1: c_short,
@@ -327,6 +342,39 @@ pub mod types {
                     st_pad5: [c_long, ..14],
                 }
             }
+            #[cfg(target_arch = "arm")]
+            pub mod posix01 {
+                use libc::types::os::arch::c95::{c_uchar, c_uint, c_ulong, time_t};
+                use libc::types::os::arch::c99::{c_longlong, c_ulonglong};
+                use libc::types::os::arch::posix88::{uid_t, gid_t, ino_t};
+                use libc::types::os::arch::posix88::{uid_t};
+
+                pub type nlink_t = u16;
+                pub type blksize_t = u32;
+                pub type blkcnt_t = u32;
+
+                pub struct stat {
+                    st_dev: c_ulonglong,
+                    __pad0: [c_uchar, ..4],
+                    __st_ino: ino_t,
+                    st_mode: c_uint,
+                    st_nlink: c_uint,
+                    st_uid: uid_t,
+                    st_gid: gid_t,
+                    st_rdev: c_ulonglong,
+                    __pad3: [c_uchar, ..4],
+                    st_size: c_longlong,
+                    st_blksize: blksize_t,
+                    st_blocks: c_ulonglong,
+                    st_atime: time_t,
+                    st_atime_nsec: c_ulong,
+                    st_mtime: time_t,
+                    st_mtime_nsec: c_ulong,
+                    st_ctime: time_t,
+                    st_ctime_nsec: c_ulong,
+                    st_ino: c_ulonglong
+                }
+            }
             pub mod posix08 {}
             pub mod bsd44 {}
             pub mod extra {}
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 9c51526aa7f..d7812bf49c2 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -128,7 +128,6 @@ pub trait GenericPath {
 #[cfg(target_os = "android")]
 mod stat {
     #[cfg(target_arch = "x86")]
-    #[cfg(target_arch = "arm")]
     pub mod arch {
         use libc;
 
@@ -158,6 +157,35 @@ mod stat {
         }
     }
 
+    #[cfg(target_arch = "arm")]
+    pub mod arch {
+        use libc;
+
+        pub fn default_stat() -> libc::stat {
+            libc::stat {
+                st_dev: 0,
+                __pad0: [0, ..4],
+                __st_ino: 0,
+                st_mode: 0,
+                st_nlink: 0,
+                st_uid: 0,
+                st_gid: 0,
+                st_rdev: 0,
+                __pad3: [0, ..4],
+                st_size: 0,
+                st_blksize: 0,
+                st_blocks: 0,
+                st_atime: 0,
+                st_atime_nsec: 0,
+                st_mtime: 0,
+                st_mtime_nsec: 0,
+                st_ctime: 0,
+                st_ctime_nsec: 0,
+                st_ino: 0
+            }
+        }
+    }
+
     #[cfg(target_arch = "mips")]
     pub mod arch {
         use libc;