Skip to content

Commit 97b75c3

Browse files
japaricchenx97
authored andcommitted
fix the size of posix_spawn{_file_actions_t,attr_t} on Linux
1 parent 548fb14 commit 97b75c3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/unix/linux_like/mod.rs

+30
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,36 @@ pub type timer_t = *mut ::c_void;
66
pub type key_t = ::c_int;
77
pub type id_t = ::c_uint;
88

9+
cfg_if! {
10+
if #[cfg(target_os = "android")] {
11+
// these structs sit behind a heap allocation on Android
12+
pub type posix_spawn_file_actions_t = *mut ::c_void;
13+
pub type posix_spawnattr_t = *mut ::c_void;
14+
} else if #[cfg(not(target_os = "emscripten"))] {
15+
s! {
16+
pub struct posix_spawn_file_actions_t {
17+
__allocated: ::c_int,
18+
__used: ::c_int,
19+
__actions: *mut ::c_int,
20+
__pad: [::c_int; 16],
21+
}
22+
23+
pub struct posix_spawnattr_t {
24+
__flags: ::c_short,
25+
__pgrp: ::pid_t,
26+
__sd: ::sigset_t,
27+
__ss: ::sigset_t,
28+
#[cfg(any(target_env = "musl", target_env = "ohos"))]
29+
__prio: ::c_int,
30+
#[cfg(not(any(target_env = "musl", target_env = "ohos")))]
31+
__sp: ::sched_param,
32+
__policy: ::c_int,
33+
__pad: [::c_int; 16],
34+
}
35+
}
36+
}
37+
}
38+
939
missing! {
1040
#[cfg_attr(feature = "extra_traits", derive(Debug))]
1141
pub enum timezone {}

0 commit comments

Comments
 (0)