core_affinity: freebsd constants are included in libc now. (#1170)
This commit is contained in:
parent
76e4f6031d
commit
c9ea6ee6aa
@ -654,14 +654,11 @@ mod freebsd {
|
|||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use std::{mem, thread::available_parallelism};
|
use std::{mem, thread::available_parallelism};
|
||||||
|
|
||||||
use libc::{cpuset_setaffinity, cpuset_t, CPU_SET};
|
use libc::{cpuset_setaffinity, cpuset_t, CPU_LEVEL_WHICH, CPU_SET, CPU_WHICH_PID};
|
||||||
|
|
||||||
use super::CoreId;
|
use super::CoreId;
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
|
|
||||||
const CPU_LEVEL_WHICH: libc::c_int = 3;
|
|
||||||
const CPU_WHICH_PID: libc::c_int = 2;
|
|
||||||
|
|
||||||
#[allow(trivial_numeric_casts)]
|
#[allow(trivial_numeric_casts)]
|
||||||
pub fn get_core_ids() -> Result<Vec<CoreId>, Error> {
|
pub fn get_core_ids() -> Result<Vec<CoreId>, Error> {
|
||||||
Ok((0..(usize::from(available_parallelism()?)))
|
Ok((0..(usize::from(available_parallelism()?)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user