xref: /DragonOS/kernel/src/smp/syscall.rs (revision f049d1af01da7b92f312245ed411b22475b76065)
1 use bitmap::traits::BitMapOps;
2 use system_error::SystemError;
3 
4 use crate::syscall::Syscall;
5 
6 use super::cpu::smp_cpu_manager;
7 
8 impl Syscall {
9     pub fn getaffinity(_pid: i32, set: &mut [u8]) -> Result<usize, SystemError> {
10         let cpu_manager = smp_cpu_manager();
11         let src = unsafe { cpu_manager.possible_cpus().inner().as_bytes() };
12         set[0..src.len()].copy_from_slice(src);
13         Ok(0)
14     }
15 }
16