Skip to content

Commit 4577f08

Browse files
authored
Auto merge of #416 - kallisti5:master, r=alexcrichton
Haiku: More build fixes
2 parents 68abfad + 573c5fe commit 4577f08

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

src/unix/haiku/b32.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
pub type c_long = i32;
22
pub type c_ulong = u32;
3-
4-
// intentionally not public, only used for fd_set
5-
const ULONG_SIZE: usize = 32;

src/unix/haiku/b64.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
pub type c_ulong = u64;
22
pub type c_long = i64;
3-
4-
// intentionally not public, only used for fd_set
5-
const ULONG_SIZE: usize = 64;

src/unix/haiku/mod.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub type tcflag_t = ::c_uint;
88
pub type speed_t = ::c_uint;
99
pub type c_char = i8;
1010
pub type clock_t = i32;
11+
pub type clockid_t = i32;
1112
pub type time_t = i32;
1213
pub type suseconds_t = i32;
1314
pub type wchar_t = i32;
@@ -280,6 +281,29 @@ s! {
280281
pub sa_flags: ::c_int,
281282
sa_userdata: *mut ::c_void,
282283
}
284+
285+
pub struct sem_t {
286+
pub se_type: i32,
287+
pub se_named_id: i32, // this is actually a union
288+
pub se_unnamed: i32,
289+
pub se_padding: [i32; 4],
290+
}
291+
292+
pub struct pthread_condattr_t {
293+
pub process_shared: bool,
294+
pub clock_id: i32,
295+
}
296+
}
297+
298+
// intentionally not public, only used for fd_set
299+
cfg_if! {
300+
if #[cfg(target_pointer_width = "32")] {
301+
const ULONG_SIZE: usize = 32;
302+
} else if #[cfg(target_pointer_width = "64")] {
303+
const ULONG_SIZE: usize = 64;
304+
} else {
305+
// Unknown target_pointer_width
306+
}
283307
}
284308

285309
pub const EXIT_FAILURE: ::c_int = 1;
@@ -592,6 +616,9 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
592616
waiters: [0 as *mut _; 2],
593617
};
594618

619+
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = 0;
620+
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 1;
621+
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
595622
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 3;
596623

597624
pub const FIOCLEX: c_ulong = 0; // TODO: does not exist on Haiku!
@@ -680,6 +707,10 @@ extern {
680707
pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
681708
stackaddr: *mut *mut ::c_void,
682709
stacksize: *mut ::size_t) -> ::c_int;
710+
pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
711+
clock_id: *mut clockid_t) -> ::c_int;
712+
pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
713+
clock_id: clockid_t) -> ::c_int;
683714
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
684715
pub fn setgroups(ngroups: ::size_t,
685716
ptr: *const ::gid_t) -> ::c_int;

0 commit comments

Comments
 (0)