xref: /DragonOS/kernel/src/smp/syscall.rs (revision 9430523b465b19db4dd476e9fd3038bdc2aa0c8d)
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 {
getaffinity(_pid: i32, set: &mut [u8]) -> Result<usize, SystemError>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