File tree Expand file tree Collapse file tree 4 files changed +42
-0
lines changed Expand file tree Collapse file tree 4 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -366,6 +366,9 @@ pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
366
366
pub const _SC_FSYNC : :: c_int = 29 ;
367
367
368
368
pub const KERN_PROC_ARGV : :: c_int = 1 ;
369
+ pub const KERN_PROC_NARGV : :: c_int = 2 ;
370
+ pub const KERN_PROC_ENV : :: c_int = 3 ;
371
+ pub const KERN_PROC_NENV : :: c_int = 4 ;
369
372
370
373
pub const Q_GETQUOTA : :: c_int = 0x300 ;
371
374
pub const Q_SETQUOTA : :: c_int = 0x400 ;
Original file line number Diff line number Diff line change @@ -498,4 +498,10 @@ extern {
498
498
flags : :: c_int ) -> :: c_int ;
499
499
pub fn eventfd ( init : :: c_uint , flags : :: c_int ) -> :: c_int ;
500
500
pub fn ptrace ( request : :: c_uint , ...) -> :: c_long ;
501
+ pub fn pthread_attr_getaffinity_np ( attr : * const :: pthread_attr_t ,
502
+ cpusetsize : :: size_t ,
503
+ cpuset : * mut :: cpu_set_t ) -> :: c_int ;
504
+ pub fn pthread_attr_setaffinity_np ( attr : * mut :: pthread_attr_t ,
505
+ cpusetsize : :: size_t ,
506
+ cpuset : * const :: cpu_set_t ) -> :: c_int ;
501
507
}
Original file line number Diff line number Diff line change 1
1
//! Linux-specific definitions for linux-like values
2
2
3
+ use dox:: mem;
4
+
3
5
pub type useconds_t = u32 ;
4
6
pub type dev_t = u64 ;
5
7
pub type socklen_t = u32 ;
@@ -185,6 +187,31 @@ s! {
185
187
}
186
188
}
187
189
190
+ f ! {
191
+ pub fn CPU_ZERO ( cpuset: & mut cpu_set_t) -> ( ) {
192
+ for slot in cpuset. bits. iter_mut( ) {
193
+ * slot = 0 ;
194
+ }
195
+ }
196
+
197
+ pub fn CPU_SET ( cpu: usize , cpuset: & mut cpu_set_t) -> ( ) {
198
+ let size = mem:: size_of_val( & cpuset. bits[ 0 ] ) ;
199
+ let ( idx, offset) = ( cpu / size, cpu % size) ;
200
+ cpuset. bits[ idx] |= 1 << offset;
201
+ ( )
202
+ }
203
+
204
+ pub fn CPU_ISSET ( cpu: usize , cpuset: & cpu_set_t) -> bool {
205
+ let size = mem:: size_of_val( & cpuset. bits[ 0 ] ) ;
206
+ let ( idx, offset) = ( cpu / size, cpu % size) ;
207
+ 0 != ( cpuset. bits[ idx] & ( 1 << offset) )
208
+ }
209
+
210
+ pub fn CPU_EQUAL ( set1: & cpu_set_t, set2: & cpu_set_t) -> bool {
211
+ set1. bits == set2. bits
212
+ }
213
+ }
214
+
188
215
pub const FILENAME_MAX : :: c_uint = 4096 ;
189
216
pub const L_tmpnam : :: c_uint = 20 ;
190
217
pub const _PC_NAME_MAX: :: c_int = 3 ;
Original file line number Diff line number Diff line change @@ -438,6 +438,12 @@ extern {
438
438
flags : :: c_int ) -> :: c_int ;
439
439
pub fn eventfd ( init : :: c_uint , flags : :: c_int ) -> :: c_int ;
440
440
pub fn ptrace ( request : :: c_uint , ...) -> :: c_long ;
441
+ pub fn pthread_attr_getaffinity_np ( attr : * const :: pthread_attr_t ,
442
+ cpusetsize : :: size_t ,
443
+ cpuset : * mut :: cpu_set_t ) -> :: c_int ;
444
+ pub fn pthread_attr_setaffinity_np ( attr : * mut :: pthread_attr_t ,
445
+ cpusetsize : :: size_t ,
446
+ cpuset : * const :: cpu_set_t ) -> :: c_int ;
441
447
}
442
448
443
449
cfg_if ! {
You can’t perform that action at this time.
0 commit comments