@@ -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,32 @@ mod posix {
2369
2402
}
2370
2403
}
2371
2404
2405
+ #[ pyfunction]
2406
+ fn sched_get_priority_max ( policy : i32 , vm : & VirtualMachine ) -> PyResult < i32 > {
2407
+ let max = unsafe { libc:: sched_get_priority_max ( policy) } ;
2408
+ if max == -1 {
2409
+ Err ( errno_err ( vm) )
2410
+ } else {
2411
+ Ok ( max)
2412
+ }
2413
+ }
2414
+
2415
+ #[ pyfunction]
2416
+ fn sched_get_priority_min ( policy : i32 , vm : & VirtualMachine ) -> PyResult < i32 > {
2417
+ let min = unsafe { libc:: sched_get_priority_min ( policy) } ;
2418
+ if min == -1 {
2419
+ Err ( errno_err ( vm) )
2420
+ } else {
2421
+ Ok ( min)
2422
+ }
2423
+ }
2424
+
2425
+ #[ pyfunction]
2426
+ fn sched_yield ( vm : & VirtualMachine ) -> PyResult < ( ) > {
2427
+ let _ = nix:: sched:: sched_yield ( ) . map_err ( |e| e. into_pyexception ( vm) ) ?;
2428
+ Ok ( ( ) )
2429
+ }
2430
+
2372
2431
#[ pyfunction]
2373
2432
fn get_inheritable ( fd : RawFd , vm : & VirtualMachine ) -> PyResult < bool > {
2374
2433
use nix:: fcntl:: fcntl;
0 commit comments