Skip to content

Commit 2ca0849

Browse files
committed
Fix pthread related definitions for emscripten
1 parent 0547ddf commit 2ca0849

File tree

6 files changed

+18
-8
lines changed

6 files changed

+18
-8
lines changed

src/unix/notbsd/linux/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,20 @@ s! {
6868

6969
pub struct pthread_mutex_t {
7070
#[cfg(any(target_arch = "mips", target_arch = "arm",
71-
target_arch = "powerpc"))]
71+
target_arch = "powerpc", target_os = "emscripten"))]
7272
__align: [::c_long; 0],
7373
#[cfg(not(any(target_arch = "mips", target_arch = "arm",
74-
target_arch = "powerpc")))]
74+
target_arch = "powerpc", target_os = "emscripten")))]
7575
__align: [::c_longlong; 0],
7676
size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
7777
}
7878

7979
pub struct pthread_rwlock_t {
8080
#[cfg(any(target_arch = "mips", target_arch = "arm",
81-
target_arch = "powerpc"))]
81+
target_arch = "powerpc", target_os = "emscripten"))]
8282
__align: [::c_long; 0],
8383
#[cfg(not(any(target_arch = "mips", target_arch = "arm",
84-
target_arch = "powerpc")))]
84+
target_arch = "powerpc", target_os = "emscripten")))]
8585
__align: [::c_longlong; 0],
8686
size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
8787
}
@@ -99,9 +99,9 @@ s! {
9999
}
100100

101101
pub struct pthread_cond_t {
102-
#[cfg(any(target_env = "musl"))]
102+
#[cfg(any(target_env = "musl", target_os = "emscripten"))]
103103
__align: [*const ::c_void; 0],
104-
#[cfg(not(any(target_env = "musl")))]
104+
#[cfg(not(any(target_env = "musl", target_os = "emscripten")))]
105105
__align: [::c_longlong; 0],
106106
size: [u8; __SIZEOF_PTHREAD_COND_T],
107107
}

src/unix/notbsd/linux/musl/b32/arm.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ s! {
109109
}
110110
}
111111

112+
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
113+
112114
pub const O_DIRECT: ::c_int = 0x4000;
113115
pub const O_DIRECTORY: ::c_int = 0x10000;
114116
pub const O_NOFOLLOW: ::c_int = 0x20000;

src/unix/notbsd/linux/musl/b32/asmjs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ s! {
109109
}
110110
}
111111

112+
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28;
113+
112114
pub const O_DIRECT: ::c_int = 0x4000;
113115
pub const O_DIRECTORY: ::c_int = 0x10000;
114116
pub const O_NOFOLLOW: ::c_int = 0x20000;

src/unix/notbsd/linux/musl/b32/mips.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ s! {
117117
}
118118
}
119119

120+
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28;
121+
120122
pub const O_DIRECT: ::c_int = 0o100000;
121123
pub const O_DIRECTORY: ::c_int = 0o200000;
122124
pub const O_NOFOLLOW: ::c_int = 0o400000;

src/unix/notbsd/linux/musl/b32/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ pub type nlink_t = u32;
44

55
s! {
66
pub struct pthread_attr_t {
7-
__size: [u32; 9]
7+
#[cfg(target_os = "emscripten")]
8+
__size: [u32; 11],
9+
#[cfg(not(target_os = "emscripten"))]
10+
__size: [u32; 9],
811
}
912

1013
pub struct sigset_t {
@@ -33,7 +36,6 @@ s! {
3336
}
3437

3538
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
36-
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
3739

3840
cfg_if! {
3941
if #[cfg(any(target_arch = "x86"))] {

src/unix/notbsd/linux/musl/b32/x86.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ s! {
122122
}
123123
}
124124

125+
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
126+
125127
pub const O_DIRECT: ::c_int = 0x4000;
126128
pub const O_DIRECTORY: ::c_int = 0x10000;
127129
pub const O_NOFOLLOW: ::c_int = 0x20000;

0 commit comments

Comments
 (0)