Skip to content

Commit 3a207a8

Browse files
committed
Move wasm32 definitions back to b64
1 parent 38b61a1 commit 3a207a8

File tree

5 files changed

+39
-129
lines changed

5 files changed

+39
-129
lines changed

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

Lines changed: 34 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,47 @@
11
use crate::prelude::*;
22

3-
cfg_if! {
4-
if #[cfg(not(target_arch = "wasm32"))] {
5-
pub type c_long = i32;
6-
pub type c_ulong = u32;
7-
pub type nlink_t = u32;
8-
pub type blksize_t = c_long;
9-
pub type __u64 = c_ulonglong;
10-
pub type __s64 = c_longlong;
11-
pub type regoff_t = c_int;
12-
13-
s! {
14-
pub struct pthread_attr_t {
15-
__size: [u32; 9],
16-
}
17-
18-
pub struct sigset_t {
19-
__val: [c_ulong; 32],
20-
}
21-
22-
pub struct msghdr {
23-
pub msg_name: *mut c_void,
24-
pub msg_namelen: crate::socklen_t,
25-
pub msg_iov: *mut crate::iovec,
26-
pub msg_iovlen: c_int,
27-
pub msg_control: *mut c_void,
28-
pub msg_controllen: crate::socklen_t,
29-
pub msg_flags: c_int,
30-
}
31-
32-
pub struct cmsghdr {
33-
pub cmsg_len: crate::socklen_t,
34-
pub cmsg_level: c_int,
35-
pub cmsg_type: c_int,
36-
}
37-
38-
pub struct sem_t {
39-
__val: [c_int; 4],
40-
}
41-
}
42-
43-
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
44-
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
45-
pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 20;
3+
pub type c_long = i32;
4+
pub type c_ulong = u32;
5+
pub type nlink_t = u32;
6+
pub type blksize_t = c_long;
7+
pub type __u64 = c_ulonglong;
8+
pub type __s64 = c_longlong;
9+
pub type regoff_t = c_int;
10+
11+
s! {
12+
pub struct pthread_attr_t {
13+
__size: [u32; 9],
4614
}
47-
else {
48-
pub type c_long = i64;
49-
pub type c_ulong = u64;
50-
pub type regoff_t = c_long;
51-
52-
s! {
53-
pub struct stack_t {
54-
pub ss_sp: *mut c_void,
55-
pub ss_flags: c_int,
56-
pub ss_size: size_t,
57-
}
5815

59-
pub struct pthread_attr_t {
60-
__size: [u64; 7],
61-
}
62-
63-
pub struct sigset_t {
64-
__val: [c_ulong; 16],
65-
}
66-
67-
pub struct shmid_ds {
68-
pub shm_perm: crate::ipc_perm,
69-
pub shm_segsz: size_t,
70-
pub shm_atime: crate::time_t,
71-
pub shm_dtime: crate::time_t,
72-
pub shm_ctime: crate::time_t,
73-
pub shm_cpid: crate::pid_t,
74-
pub shm_lpid: crate::pid_t,
75-
pub shm_nattch: c_ulong,
76-
__pad1: c_ulong,
77-
__pad2: c_ulong,
78-
}
79-
80-
pub struct msqid_ds {
81-
pub msg_perm: crate::ipc_perm,
82-
pub msg_stime: crate::time_t,
83-
pub msg_rtime: crate::time_t,
84-
pub msg_ctime: crate::time_t,
85-
__msg_cbytes: c_ulong,
86-
pub msg_qnum: crate::msgqnum_t,
87-
pub msg_qbytes: crate::msglen_t,
88-
pub msg_lspid: crate::pid_t,
89-
pub msg_lrpid: crate::pid_t,
90-
__pad1: c_ulong,
91-
__pad2: c_ulong,
92-
}
93-
94-
pub struct msghdr {
95-
pub msg_name: *mut c_void,
96-
pub msg_namelen: crate::socklen_t,
97-
pub msg_iov: *mut crate::iovec,
98-
#[cfg(target_endian = "big")]
99-
__pad1: c_int,
100-
pub msg_iovlen: c_int,
101-
#[cfg(target_endian = "little")]
102-
__pad1: c_int,
103-
pub msg_control: *mut c_void,
104-
#[cfg(target_endian = "big")]
105-
__pad2: c_int,
106-
pub msg_controllen: crate::socklen_t,
107-
#[cfg(target_endian = "little")]
108-
__pad2: c_int,
109-
pub msg_flags: c_int,
110-
}
16+
pub struct sigset_t {
17+
__val: [c_ulong; 32],
18+
}
11119

112-
pub struct cmsghdr {
113-
#[cfg(target_endian = "big")]
114-
pub __pad1: c_int,
115-
pub cmsg_len: crate::socklen_t,
116-
#[cfg(target_endian = "little")]
117-
pub __pad1: c_int,
118-
pub cmsg_level: c_int,
119-
pub cmsg_type: c_int,
120-
}
20+
pub struct msghdr {
21+
pub msg_name: *mut c_void,
22+
pub msg_namelen: crate::socklen_t,
23+
pub msg_iov: *mut crate::iovec,
24+
pub msg_iovlen: c_int,
25+
pub msg_control: *mut c_void,
26+
pub msg_controllen: crate::socklen_t,
27+
pub msg_flags: c_int,
28+
}
12129

122-
pub struct sem_t {
123-
__val: [c_int; 8],
124-
}
125-
}
126-
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
127-
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
128-
pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32;
30+
pub struct cmsghdr {
31+
pub cmsg_len: crate::socklen_t,
32+
pub cmsg_level: c_int,
33+
pub cmsg_type: c_int,
34+
}
12935

130-
extern "C" {
131-
pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t;
132-
}
36+
pub struct sem_t {
37+
__val: [c_int; 4],
13338
}
13439
}
13540

41+
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
42+
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
43+
pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 20;
44+
13645
cfg_if! {
13746
if #[cfg(any(target_arch = "x86"))] {
13847
mod x86;
@@ -152,9 +61,6 @@ cfg_if! {
15261
} else if #[cfg(any(target_arch = "riscv32"))] {
15362
mod riscv32;
15463
pub use self::riscv32::*;
155-
} else if #[cfg(any(target_arch = "wasm32"))] {
156-
mod wasm32;
157-
pub use self::wasm32::*;
15864
} else {
15965
// Unknown target_arch
16066
}

src/unix/linux_like/linux/musl/b64/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ cfg_if! {
109109
} else if #[cfg(any(target_arch = "loongarch64"))] {
110110
mod loongarch64;
111111
pub use self::loongarch64::*;
112+
} else if #[cfg(any(target_arch = "wasm32"))] {
113+
mod wasm32;
114+
pub use self::wasm32::*;
112115
} else {
113116
// Unknown target_arch
114117
}
File renamed without changes.
File renamed without changes.

src/unix/linux_like/linux/musl/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,8 @@ cfg_if! {
10041004
target_arch = "s390x",
10051005
target_arch = "riscv64",
10061006
target_arch = "loongarch64",
1007+
// musl-linux ABI for wasm32 follows b64 convention
1008+
target_arch = "wasm32",
10071009
))] {
10081010
mod b64;
10091011
pub use self::b64::*;
@@ -1014,7 +1016,6 @@ cfg_if! {
10141016
target_arch = "hexagon",
10151017
target_arch = "riscv32",
10161018
target_arch = "arm",
1017-
target_arch = "wasm32",
10181019
))] {
10191020
mod b32;
10201021
pub use self::b32::*;

0 commit comments

Comments
 (0)