diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/tuklib_cpucores.c | 6 | ||||
-rw-r--r-- | src/common/tuklib_physmem.c | 19 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/common/tuklib_cpucores.c b/src/common/tuklib_cpucores.c index 0a8081ff..e35d9bc7 100644 --- a/src/common/tuklib_cpucores.c +++ b/src/common/tuklib_cpucores.c @@ -37,7 +37,13 @@ tuklib_cpucores(void) ret = (uint32_t)cpus; #elif defined(TUKLIB_CPUCORES_SYSCONF) +# ifdef _SC_NPROCESSORS_ONLN + // Most systems const long cpus = sysconf(_SC_NPROCESSORS_ONLN); +# else + // IRIX + const long cpus = sysconf(_SC_NPROC_ONLN); +# endif if (cpus > 0) ret = (uint32_t)cpus; #endif diff --git a/src/common/tuklib_physmem.c b/src/common/tuklib_physmem.c index b2d21283..1536e6e5 100644 --- a/src/common/tuklib_physmem.c +++ b/src/common/tuklib_physmem.c @@ -42,6 +42,10 @@ # endif # include <sys/sysctl.h> +// IRIX +#elif defined(TUKLIB_PHYSMEM_GETINVENT_R) +# include <invent.h> + // This sysinfo() is Linux-specific. #elif defined(TUKLIB_PHYSMEM_SYSINFO) # include <sys/sysinfo.h> @@ -136,6 +140,21 @@ tuklib_physmem(void) ret = mem.u32; } +#elif defined(TUKLIB_PHYSMEM_GETINVENT_R) + inv_state_t *st = NULL; + if (setinvent_r(&st) != -1) { + inventory_t *i; + while ((i = getinvent_r(st)) != NULL) { + if (i->inv_class == INV_MEMORY + && i->inv_type == INV_MAIN_MB) { + ret = (uint64_t)i->inv_state << 20; + break; + } + } + + endinvent_r(st); + } + #elif defined(TUKLIB_PHYSMEM_SYSINFO) struct sysinfo si; if (sysinfo(&si) == 0) |