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