Skip to content

Commit 47f1439

Browse files
committed
Merge pull request rust-lang#90 from alexcrichton/more-constants
Add some constants for learning about cpus
2 parents 6736e10 + cd24bbd commit 47f1439

File tree

6 files changed

+12
-0
lines changed

6 files changed

+12
-0
lines changed

src/unix/bsd/apple/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,8 @@ pub const FD_SETSIZE: usize = 1024;
697697

698698
pub const ST_NOSUID: ::c_ulong = 2;
699699

700+
pub const HW_AVAILCPU: ::c_int = 25;
701+
700702
extern {
701703
pub fn mincore(addr: *const ::c_void, len: ::size_t,
702704
vec: *mut ::c_char) -> ::c_int;

src/unix/bsd/freebsdlike/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,8 @@ pub const FD_SETSIZE: usize = 1024;
543543

544544
pub const ST_NOSUID: ::c_ulong = 2;
545545

546+
pub const HW_AVAILCPU: ::c_int = 25;
547+
546548
extern {
547549
pub fn mincore(addr: *const ::c_void, len: ::size_t,
548550
vec: *mut c_char) -> ::c_int;

src/unix/bsd/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ pub const ST_RDONLY: ::c_ulong = 1;
9898

9999
pub const NI_MAXHOST: ::socklen_t = 1025;
100100

101+
pub const CTL_HW: ::c_int = 6;
102+
pub const HW_NCPU: ::c_int = 3;
103+
101104
f! {
102105
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
103106
let fd = fd as usize;

src/unix/bsd/openbsdlike/bitrig.rs

+2
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
205205
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
206206
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
207207

208+
pub const HW_AVAILCPU: ::c_int = 25;
209+
208210
extern {
209211
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
210212
-> ::c_int;

src/unix/bsd/openbsdlike/openbsd.rs

+2
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
208208
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = 0 as *mut _;
209209
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
210210

211+
pub const HW_AVAILCPU: ::c_int = 25;
212+
211213
extern {
212214
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
213215
-> ::c_int;

src/unix/notbsd/android/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 82;
163163
pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 83;
164164
pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 84;
165165
pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 85;
166+
pub const _SC_NPROCESSORS_ONLN: ::c_int = 97;
166167

167168
pub const PTHREAD_STACK_MIN: ::size_t = 8192;
168169
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {

0 commit comments

Comments
 (0)