use core::ffi::{c_int, c_long};
use crate::ctypes;
const PAGE_SIZE_4K: usize = 4096;
pub fn sys_sysconf(name: c_int) -> c_long {
debug!("sys_sysconf <= {}", name);
syscall_body!(sys_sysconf, {
match name as u32 {
ctypes::_SC_PAGE_SIZE => Ok(PAGE_SIZE_4K),
ctypes::_SC_PHYS_PAGES => Ok(axconfig::PHYS_MEMORY_SIZE / PAGE_SIZE_4K),
ctypes::_SC_NPROCESSORS_ONLN => Ok(axconfig::SMP),
#[cfg(feature = "alloc")]
ctypes::_SC_AVPHYS_PAGES => Ok(axalloc::global_allocator().available_pages()),
#[cfg(feature = "fd")]
ctypes::_SC_OPEN_MAX => Ok(super::fd_ops::AX_FILE_LIMIT),
_ => Ok(0),
}
})
}