Merge branch 'sysconf-heads' into 'master'

Add sysconf posix constants

See merge request redox-os/relibc!1143
This commit is contained in:
Jeremy Soller
2026-03-29 16:21:12 -06:00
+27
View File
@@ -23,6 +23,10 @@ pub const _SC_OPEN_MAX: c_int = 4;
pub const _SC_STREAM_MAX: c_int = 5;
pub const _SC_TZNAME_MAX: c_int = 6;
// ...
pub const _SC_TIMERS: c_int = 11;
// ...
pub const _SC_SHARED_MEMORY_OBJECTS: c_int = 22;
// ...
pub const _SC_VERSION: c_int = 29;
pub const _SC_PAGESIZE: c_int = 30;
pub const _SC_PAGE_SIZE: c_int = 30;
@@ -35,11 +39,24 @@ pub const _SC_PHYS_PAGES: c_int = 59;
pub const _SC_AVPHYS_PAGES: c_int = 60;
// ...
pub const _SC_THREADS: c_int = 67;
pub const _SC_GETGR_R_SIZE_MAX: c_int = 69;
pub const _SC_GETPW_R_SIZE_MAX: c_int = 70;
pub const _SC_LOGIN_NAME_MAX: c_int = 71;
pub const _SC_TTY_NAME_MAX: c_int = 72;
// ...
pub const _SC_THREAD_ATTR_STACKADDR: c_int = 77;
pub const _SC_THREAD_ATTR_STACKSIZE: c_int = 78;
// ...
pub const _SC_MONOTONIC_CLOCK: c_int = 149;
pub const _SC_SEMAPHORES: c_int = 21;
// ...
pub const _SC_BARRIERS: c_int = 133;
// ...
pub const _SC_SHELL: c_int = 157;
// ...
pub const _SC_TIMEOUTS: c_int = 164;
// ...
pub const _SC_SYMLOOP_MAX: c_int = 173;
// ...
pub const _SC_HOST_NAME_MAX: c_int = 180;
@@ -65,6 +82,16 @@ pub(super) fn sysconf_impl(name: c_int) -> c_long {
_SC_GETPW_R_SIZE_MAX => -1,
_SC_LOGIN_NAME_MAX => 256,
_SC_TTY_NAME_MAX => 32,
_SC_MONOTONIC_CLOCK => 200112,
_SC_SEMAPHORES => 200112,
_SC_BARRIERS => 202405,
_SC_SHELL => 1,
_SC_SHARED_MEMORY_OBJECTS => 200112,
_SC_THREADS => 202405,
_SC_THREAD_ATTR_STACKADDR => 202405,
_SC_THREAD_ATTR_STACKSIZE => 202405,
_SC_TIMEOUTS => 202405,
_SC_TIMERS => 202405,
_SC_SYMLOOP_MAX => -1,
_SC_HOST_NAME_MAX => 64,
_SC_NPROCESSORS_CONF => get_cpu_count().unwrap_or(None).unwrap_or(1),