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