@@ -2087,6 +2087,39 @@ mod posix {
2087
2087
#[ pyattr]
2088
2088
const EX_CONFIG : i8 = exitcode:: CONFIG as i8 ;
2089
2089
2090
+ #[ cfg( any(
2091
+ target_os = "linux" ,
2092
+ target_os = "android" ,
2093
+ target_os = "freebsd" ,
2094
+ target_os = "dragonfly" ,
2095
+ target_os = "netbsd"
2096
+ ) ) ]
2097
+ #[ pyattr]
2098
+ const SCHED_RR : i32 = libc:: SCHED_RR ;
2099
+ #[ cfg( any(
2100
+ target_os = "linux" ,
2101
+ target_os = "android" ,
2102
+ target_os = "freebsd" ,
2103
+ target_os = "dragonfly" ,
2104
+ target_os = "netbsd"
2105
+ ) ) ]
2106
+ #[ pyattr]
2107
+ const SCHED_FIFO : i32 = libc:: SCHED_FIFO ;
2108
+ #[ cfg( any(
2109
+ target_os = "linux" ,
2110
+ target_os = "freebsd" ,
2111
+ target_os = "dragonfly" ,
2112
+ target_os = "netbsd"
2113
+ ) ) ]
2114
+ #[ pyattr]
2115
+ const SCHED_OTHER : i32 = libc:: SCHED_OTHER ;
2116
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
2117
+ #[ pyattr]
2118
+ const SCHED_IDLE : i32 = libc:: SCHED_IDLE ;
2119
+ #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
2120
+ #[ pyattr]
2121
+ const SCHED_BATCH : i32 = libc:: SCHED_BATCH ;
2122
+
2090
2123
#[ cfg( any( target_os = "linux" , target_os = "freebsd" , target_os = "macos" ) ) ]
2091
2124
#[ pyattr]
2092
2125
const POSIX_SPAWN_OPEN : i32 = PosixSpawnFileActionIdentifier :: Open as i32 ;
@@ -2369,6 +2402,34 @@ mod posix {
2369
2402
}
2370
2403
}
2371
2404
2405
+ #[ cfg( not( target_os = "redox" ) ) ]
2406
+ #[ pyfunction]
2407
+ fn sched_get_priority_max ( policy : i32 , vm : & VirtualMachine ) -> PyResult < i32 > {
2408
+ let max = unsafe { libc:: sched_get_priority_max ( policy) } ;
2409
+ if max == -1 {
2410
+ Err ( errno_err ( vm) )
2411
+ } else {
2412
+ Ok ( max)
2413
+ }
2414
+ }
2415
+
2416
+ #[ cfg( not( target_os = "redox" ) ) ]
2417
+ #[ pyfunction]
2418
+ fn sched_get_priority_min ( policy : i32 , vm : & VirtualMachine ) -> PyResult < i32 > {
2419
+ let min = unsafe { libc:: sched_get_priority_min ( policy) } ;
2420
+ if min == -1 {
2421
+ Err ( errno_err ( vm) )
2422
+ } else {
2423
+ Ok ( min)
2424
+ }
2425
+ }
2426
+
2427
+ #[ pyfunction]
2428
+ fn sched_yield ( vm : & VirtualMachine ) -> PyResult < ( ) > {
2429
+ let _ = nix:: sched:: sched_yield ( ) . map_err ( |e| e. into_pyexception ( vm) ) ?;
2430
+ Ok ( ( ) )
2431
+ }
2432
+
2372
2433
#[ pyfunction]
2373
2434
fn get_inheritable ( fd : RawFd , vm : & VirtualMachine ) -> PyResult < bool > {
2374
2435
use nix:: fcntl:: fcntl;
0 commit comments