aboutsummaryrefslogtreecommitdiff
path: root/src/common/tuklib_physmem.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2010-01-12 16:18:14 +0200
committerLasse Collin <lasse.collin@tukaani.org>2010-01-12 16:18:14 +0200
commit153c7740c54b3c90129dbd3d6153ac1303c4d605 (patch)
treedf4b8812a8b5c1cf71704134d87f667846b3a07c /src/common/tuklib_physmem.c
parentFix _memconfig() functions. (diff)
downloadxz-153c7740c54b3c90129dbd3d6153ac1303c4d605.tar.xz
Add IRIX-specific code to tuklib_physmem and tuklib_cpucores.
This is untested but it will get tested soon and, if needed, fixed before 5.0.0. Thanks to Stuart Shelton.
Diffstat (limited to '')
-rw-r--r--src/common/tuklib_physmem.c19
1 files changed, 19 insertions, 0 deletions
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)