@@ -326,15 +326,16 @@ mod sched_priority {
326
326
use crate :: errno:: Errno ;
327
327
use crate :: unistd:: Pid ;
328
328
use crate :: Result ;
329
- use libc:: { self , c_int } ;
329
+ use libc;
330
330
331
331
#[ repr( C ) ]
332
+ #[ derive( Debug , Clone , Copy , PartialEq , Eq , PartialOrd , Ord ) ]
332
333
pub struct SchedParam {
333
- pub sched_priority : c_int ,
334
+ pub sched_priority : libc :: c_int ,
334
335
}
335
336
336
337
impl SchedParam {
337
- pub fn from_priority ( priority : c_int ) -> Self {
338
+ pub fn from_priority ( priority : libc :: c_int ) -> Self {
338
339
SchedParam {
339
340
sched_priority : priority,
340
341
}
@@ -357,6 +358,7 @@ mod sched_priority {
357
358
}
358
359
359
360
libc_enum ! {
361
+ #[ repr( i32 ) ]
360
362
pub enum Scheduler {
361
363
SCHED_OTHER ,
362
364
SCHED_FIFO ,
@@ -365,17 +367,17 @@ mod sched_priority {
365
367
SCHED_IDLE ,
366
368
SCHED_DEADLINE ,
367
369
}
368
- impl TryFrom <c_int>
370
+ impl TryFrom <libc :: c_int>
369
371
}
370
372
371
- pub fn sched_get_priority_max ( sched : Scheduler ) -> Result < c_int > {
372
- let res = unsafe { libc:: sched_get_priority_max ( sched as c_int ) } ;
373
- Errno :: result ( res) . map ( |int| int as c_int )
373
+ pub fn sched_get_priority_max ( sched : Scheduler ) -> Result < libc :: c_int > {
374
+ let res = unsafe { libc:: sched_get_priority_max ( sched as libc :: c_int ) } ;
375
+ Errno :: result ( res) . map ( |int| int as libc :: c_int )
374
376
}
375
377
376
- pub fn sched_get_priority_min ( sched : Scheduler ) -> Result < c_int > {
377
- let res = unsafe { libc:: sched_get_priority_min ( sched as c_int ) } ;
378
- Errno :: result ( res) . map ( |int| int as c_int )
378
+ pub fn sched_get_priority_min ( sched : Scheduler ) -> Result < libc :: c_int > {
379
+ let res = unsafe { libc:: sched_get_priority_min ( sched as libc :: c_int ) } ;
380
+ Errno :: result ( res) . map ( |int| int as libc :: c_int )
379
381
}
380
382
381
383
pub fn sched_getscheduler ( pid : Pid ) -> Result < Scheduler > {
@@ -391,7 +393,7 @@ mod sched_priority {
391
393
) -> Result < ( ) > {
392
394
let param: libc:: sched_param = param. into ( ) ;
393
395
let res = unsafe {
394
- libc:: sched_setscheduler ( pid. into ( ) , sched as c_int , & param)
396
+ libc:: sched_setscheduler ( pid. into ( ) , sched as libc :: c_int , & param)
395
397
} ;
396
398
397
399
Errno :: result ( res) . map ( drop)
0 commit comments