Skip to content

Commit 9c311b4

Browse files
committed
Auto merge of #3024 - redox-os:redox-0.2.137, r=JohnTitor
redox: long is 32-bits on 32-bit systems This ensures that 32-bit systems use i32 for c_long and u32 for c_ulong. I have also adjusted off_t and time_t to be `long long`, which is what they are in `relibc` now.
2 parents 2eea873 + 73a70cb commit 9c311b4

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/unix/redox/mod.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
pub type c_char = i8;
2-
pub type c_long = i64;
3-
pub type c_ulong = u64;
42
pub type wchar_t = i32;
53

4+
cfg_if! {
5+
if #[cfg(target_pointer_width = "32")] {
6+
pub type c_long = i32;
7+
pub type c_ulong = u32;
8+
}
9+
}
10+
11+
cfg_if! {
12+
if #[cfg(target_pointer_width = "64")] {
13+
pub type c_long = i64;
14+
pub type c_ulong = u64;
15+
}
16+
}
17+
618
pub type blkcnt_t = ::c_ulong;
719
pub type blksize_t = ::c_long;
820
pub type clock_t = ::c_long;
@@ -14,7 +26,7 @@ pub type ino_t = ::c_ulong;
1426
pub type mode_t = ::c_int;
1527
pub type nfds_t = ::c_ulong;
1628
pub type nlink_t = ::c_ulong;
17-
pub type off_t = ::c_long;
29+
pub type off_t = ::c_longlong;
1830
pub type pthread_t = *mut ::c_void;
1931
pub type pthread_attr_t = *mut ::c_void;
2032
pub type pthread_cond_t = *mut ::c_void;
@@ -34,7 +46,7 @@ pub type socklen_t = u32;
3446
pub type speed_t = u32;
3547
pub type suseconds_t = ::c_int;
3648
pub type tcflag_t = u32;
37-
pub type time_t = ::c_long;
49+
pub type time_t = ::c_longlong;
3850

3951
#[cfg_attr(feature = "extra_traits", derive(Debug))]
4052
pub enum timezone {}

0 commit comments

Comments
 (0)