Skip to content

Commit

Permalink
Auto merge of rust-lang#1108 - jakllsch:netbsd-pthread-types, r=alexc…
Browse files Browse the repository at this point in the history
…richton

NetBSD: fix pthread types on arm and powerpc
  • Loading branch information
bors committed Oct 31, 2018
2 parents 87ea744 + 7cd5d11 commit 9525816
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 8 deletions.
3 changes: 2 additions & 1 deletion ci/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions src/unix/bsd/netbsdlike/netbsd/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/unix/bsd/netbsdlike/netbsd/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
25 changes: 18 additions & 7 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/unix/bsd/netbsdlike/netbsd/powerpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/unix/bsd/netbsdlike/netbsd/sparc64.rs
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions src/unix/bsd/netbsdlike/netbsd/x86.rs
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions src/unix/bsd/netbsdlike/netbsd/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9525816

Please sign in to comment.