core_affinity: freebsd constants are included in libc now. (#1170)

This commit is contained in:
David CARLIER 2023-03-22 23:11:02 +00:00 committed by GitHub
parent 76e4f6031d
commit c9ea6ee6aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -654,14 +654,11 @@ mod freebsd {
use alloc::vec::Vec;
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 crate::Error;
const CPU_LEVEL_WHICH: libc::c_int = 3;
const CPU_WHICH_PID: libc::c_int = 2;
#[allow(trivial_numeric_casts)]
pub fn get_core_ids() -> Result<Vec<CoreId>, Error> {
Ok((0..(usize::from(available_parallelism()?)))