Skip to content

Commit 464b2e2

Browse files
committed
Add libc::consts::os::posix01::PTHREAD_STACK_MIN
Represents the minimum size of a thread's stack. As such, it's both platform and architecture-specific. I put it under posix01 even though it predates POSIX.1-2001 by some years. I believe it was first formalized in SUSv2. I doubt anyone cares, though.
1 parent f910a97 commit 464b2e2

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

src/libstd/libc.rs

+23-3
Original file line numberDiff line numberDiff line change
@@ -2174,7 +2174,7 @@ pub mod consts {
21742174
pub static EDQUOT: c_int = 1133;
21752175
}
21762176
pub mod posix01 {
2177-
use libc::types::os::arch::c95::c_int;
2177+
use libc::types::os::arch::c95::{c_int, size_t};
21782178

21792179
pub static SIGTRAP : c_int = 5;
21802180

@@ -2228,6 +2228,17 @@ pub mod consts {
22282228
pub static PTHREAD_CREATE_JOINABLE: c_int = 0;
22292229
pub static PTHREAD_CREATE_DETACHED: c_int = 1;
22302230

2231+
#[cfg(target_os = "android")]
2232+
pub static PTHREAD_STACK_MIN: size_t = 8192;
2233+
2234+
#[cfg(target_arch = "arm", target_os = "linux")]
2235+
#[cfg(target_arch = "x86", target_os = "linux")]
2236+
#[cfg(target_arch = "x86_64", target_os = "linux")]
2237+
pub static PTHREAD_STACK_MIN: size_t = 16384;
2238+
2239+
#[cfg(target_arch = "mips", target_os = "linux")]
2240+
pub static PTHREAD_STACK_MIN: size_t = 131072;
2241+
22312242
pub static CLOCK_REALTIME: c_int = 0;
22322243
pub static CLOCK_MONOTONIC: c_int = 1;
22332244
}
@@ -2608,7 +2619,7 @@ pub mod consts {
26082619
pub static ELAST : c_int = 99;
26092620
}
26102621
pub mod posix01 {
2611-
use libc::types::os::arch::c95::c_int;
2622+
use libc::types::os::arch::c95::{c_int, size_t};
26122623

26132624
pub static SIGTRAP : c_int = 5;
26142625

@@ -2662,6 +2673,14 @@ pub mod consts {
26622673
pub static PTHREAD_CREATE_JOINABLE: c_int = 0;
26632674
pub static PTHREAD_CREATE_DETACHED: c_int = 1;
26642675

2676+
#[cfg(target_arch = "arm")]
2677+
pub static PTHREAD_STACK_MIN: size_t = 4096;
2678+
2679+
#[cfg(target_arch = "mips")]
2680+
#[cfg(target_arch = "x86")]
2681+
#[cfg(target_arch = "x86_64")]
2682+
pub static PTHREAD_STACK_MIN: size_t = 2048;
2683+
26652684
pub static CLOCK_REALTIME: c_int = 0;
26662685
pub static CLOCK_MONOTONIC: c_int = 4;
26672686
}
@@ -2990,7 +3009,7 @@ pub mod consts {
29903009
pub static ELAST : c_int = 106;
29913010
}
29923011
pub mod posix01 {
2993-
use libc::types::os::arch::c95::c_int;
3012+
use libc::types::os::arch::c95::{c_int, size_t};
29943013

29953014
pub static SIGTRAP : c_int = 5;
29963015

@@ -3043,6 +3062,7 @@ pub mod consts {
30433062

30443063
pub static PTHREAD_CREATE_JOINABLE: c_int = 1;
30453064
pub static PTHREAD_CREATE_DETACHED: c_int = 2;
3065+
pub static PTHREAD_STACK_MIN: size_t = 8192;
30463066
}
30473067
pub mod posix08 {
30483068
}

0 commit comments

Comments
 (0)