xref: /DragonOS/kernel/src/smp/syscall.rs (revision 415e46ea470ba1dd33e4368c3684c700a75f3be8)
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