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