diff options
author | bors <bors@rust-lang.org> | 2018-10-31 13:32:31 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2018-10-31 13:32:31 +0000 |
commit | 9525816b1062eefd6ce9f7b0d26b7c47183fb07f (patch) | |
tree | a062c78cc71260c9951cccd146b2474b2ce34318 | |
parent | 87ea744b3aef04286b720ad3900a7e1c5478c3d6 (diff) | |
parent | 7cd5d11494c6aa529bef08154534d95a96709d4b (diff) | |
download | rust-libc-9525816b1062eefd6ce9f7b0d26b7c47183fb07f.tar.gz |
Auto merge of #1108 - jakllsch:netbsd-pthread-types, r=alexcrichton
NetBSD: fix pthread types on arm and powerpc
-rw-r--r-- | ci/style.rs | 3 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/netbsd/aarch64.rs | 1 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/netbsd/arm.rs | 1 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/netbsd/mod.rs | 25 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/netbsd/powerpc.rs | 1 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/netbsd/sparc64.rs | 1 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/netbsd/x86.rs | 1 | ||||
-rw-r--r-- | src/unix/bsd/netbsdlike/netbsd/x86_64.rs | 1 |
8 files changed, 26 insertions, 8 deletions
diff --git a/ci/style.rs b/ci/style.rs index bf31576b90..6671d1c417 100644 --- a/ci/style.rs +++ b/ci/style.rs @@ -128,7 +128,8 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) { err.error(path, i, "use `extern` instead of `extern \"C\""); } if line.contains("#[cfg(") && !line.contains(" if ") - && !line.contains("target_endian") + && !(line.contains("target_endian") || + line.contains("target_arch")) { if state != State::Structs { err.error(path, i, "use cfg_if! and submodules \ diff --git a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs index fe05721923..66f33016b1 100644 --- a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs @@ -3,6 +3,7 @@ use PT_FIRSTMACH; pub type c_long = i64; pub type c_ulong = u64; pub type c_char = u8; +pub type __cpu_simple_lock_nv_t = ::c_uchar; pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0; pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1; diff --git a/src/unix/bsd/netbsdlike/netbsd/arm.rs b/src/unix/bsd/netbsdlike/netbsd/arm.rs index d4e33a8a20..9e673166d6 100644 --- a/src/unix/bsd/netbsdlike/netbsd/arm.rs +++ b/src/unix/bsd/netbsdlike/netbsd/arm.rs @@ -3,6 +3,7 @@ use PT_FIRSTMACH; pub type c_long = i32; pub type c_ulong = u32; pub type c_char = u8; +pub type __cpu_simple_lock_nv_t = ::c_int; pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 915505d14b..19897aa3ef 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -8,6 +8,7 @@ pub type fsblkcnt_t = ::uint64_t; pub type fsfilcnt_t = ::uint64_t; pub type idtype_t = ::c_int; pub type mqd_t = ::c_int; +type __pthread_spin_t = __cpu_simple_lock_nv_t; s! { pub struct aiocb { @@ -160,9 +161,14 @@ s! { pub struct pthread_mutex_t { ptm_magic: ::c_uint, - ptm_errorcheck: ::c_uchar, + ptm_errorcheck: __pthread_spin_t, + #[cfg(any(target_arch = "sparc", target_arch = "sparc64", + target_arch = "x86", target_arch = "x86_64"))] ptm_pad1: [u8; 3], - ptm_interlock: ::c_uchar, + // actually a union with a non-unused, 0-initialized field + ptm_unused: __pthread_spin_t, + #[cfg(any(target_arch = "sparc", target_arch = "sparc64", + target_arch = "x86", target_arch = "x86_64"))] ptm_pad2: [u8; 3], ptm_owner: ::pthread_t, ptm_waiters: *mut u8, @@ -182,7 +188,7 @@ s! { pub struct pthread_cond_t { ptc_magic: ::c_uint, - ptc_lock: ::c_uchar, + ptc_lock: __pthread_spin_t, ptc_waiters_first: *mut u8, ptc_waiters_last: *mut u8, ptc_mutex: *mut ::pthread_mutex_t, @@ -196,7 +202,7 @@ s! { pub struct pthread_rwlock_t { ptr_magic: ::c_uint, - ptr_interlock: ::c_uchar, + ptr_interlock: __pthread_spin_t, ptr_rblocked_first: *mut u8, ptr_rblocked_last: *mut u8, ptr_wblocked_first: *mut u8, @@ -698,14 +704,19 @@ pub const ST_NOSUID: ::c_ulong = 8; pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { ptm_magic: 0x33330003, ptm_errorcheck: 0, - ptm_interlock: 0, - ptm_waiters: 0 as *mut _, - ptm_owner: 0, + #[cfg(any(target_arch = "sparc", target_arch = "sparc64", + target_arch = "x86", target_arch = "x86_64"))] ptm_pad1: [0; 3], + ptm_unused: 0, + #[cfg(any(target_arch = "sparc", target_arch = "sparc64", + target_arch = "x86", target_arch = "x86_64"))] ptm_pad2: [0; 3], + ptm_waiters: 0 as *mut _, + ptm_owner: 0, ptm_recursed: 0, ptm_spare2: 0 as *mut _, }; + pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { ptc_magic: 0x55550005, ptc_lock: 0, diff --git a/src/unix/bsd/netbsdlike/netbsd/powerpc.rs b/src/unix/bsd/netbsdlike/netbsd/powerpc.rs index 4937dd9a6b..54d069e607 100644 --- a/src/unix/bsd/netbsdlike/netbsd/powerpc.rs +++ b/src/unix/bsd/netbsdlike/netbsd/powerpc.rs @@ -3,6 +3,7 @@ use PT_FIRSTMACH; pub type c_long = i32; pub type c_ulong = u32; pub type c_char = u8; +pub type __cpu_simple_lock_nv_t = ::c_int; pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0; pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; diff --git a/src/unix/bsd/netbsdlike/netbsd/sparc64.rs b/src/unix/bsd/netbsdlike/netbsd/sparc64.rs index 27b9412668..db8f2a94c5 100644 --- a/src/unix/bsd/netbsdlike/netbsd/sparc64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/sparc64.rs @@ -1,3 +1,4 @@ pub type c_long = i64; pub type c_ulong = u64; pub type c_char = i8; +pub type __cpu_simple_lock_nv_t = ::c_uchar; diff --git a/src/unix/bsd/netbsdlike/netbsd/x86.rs b/src/unix/bsd/netbsdlike/netbsd/x86.rs index a00e3337ef..8bd105841d 100644 --- a/src/unix/bsd/netbsdlike/netbsd/x86.rs +++ b/src/unix/bsd/netbsdlike/netbsd/x86.rs @@ -1,3 +1,4 @@ pub type c_long = i32; pub type c_ulong = u32; pub type c_char = i8; +pub type __cpu_simple_lock_nv_t = ::c_uchar; diff --git a/src/unix/bsd/netbsdlike/netbsd/x86_64.rs b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs index 3bc7f52471..8d3de8453a 100644 --- a/src/unix/bsd/netbsdlike/netbsd/x86_64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs @@ -3,6 +3,7 @@ use PT_FIRSTMACH; pub type c_long = i64; pub type c_ulong = u64; pub type c_char = i8; +pub type __cpu_simple_lock_nv_t = ::c_uchar; pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0; pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; |