diff options
author | ro <ro@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-02-21 20:33:50 +0000 |
---|---|---|
committer | ro <ro@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-02-21 20:33:50 +0000 |
commit | 622d92fb75601a7635181acdeb068b83cb6ba515 (patch) | |
tree | 6c552af30d13caf2270655116cccc34ae08607c6 /libiberty/physmem.c | |
parent | 6914c51f8feb89890d293072e20813446c18c4d9 (diff) | |
download | gcc-622d92fb75601a7635181acdeb068b83cb6ba515.tar.gz |
* physmem.c (physmem_total) [HAVE_GETSYSINFO]: Use getsysinfo on
Tru64 UNIX.
(physmem_available) [HAVE_TABLE && HAVE_SYS_TABLE_H]: Use table on
Tru64 UNIX.
* configure.in (AC_CHECK_HEADERS): Check for sys/sysinfo.h,
machine/hal_sysinfo.h, sys/table.h.
(checkfuncs, AC_CHECKFUNCS): Check for getsysinfo, table.
* configure, config.in: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63241 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/physmem.c')
-rw-r--r-- | libiberty/physmem.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libiberty/physmem.c b/libiberty/physmem.c index 52b9c8adfc2..2011f0251bd 100644 --- a/libiberty/physmem.c +++ b/libiberty/physmem.c @@ -33,6 +33,15 @@ #include <sys/sysmp.h> #endif +#if HAVE_SYS_SYSINFO_H && HAVE_MACHINE_HAL_SYSINFO_H +# include <sys/sysinfo.h> +# include <machine/hal_sysinfo.h> +#endif + +#if HAVE_SYS_TABLE_H +# include <sys/table.h> +#endif + #include "libiberty.h" /* Return the total amount of physical memory. */ @@ -74,6 +83,21 @@ physmem_total () } #endif +#if HAVE_GETSYSINFO + { /* This works on Tru64 UNIX V4/5. */ + int physmem; + + if (getsysinfo (GSI_PHYSMEM, (caddr_t) &physmem, sizeof (physmem), + NULL, NULL, NULL) == 1) + { + double kbytes = physmem; + + if (0 <= kbytes) + return kbytes * 1024.0; + } + } +#endif + /* Return 0 if we can't determine the value. */ return 0; } @@ -119,6 +143,21 @@ physmem_available () } #endif +#if HAVE_TABLE && HAVE_SYS_TABLE_H + { /* This works on Tru64 UNIX V4/5. */ + struct tbl_vmstats vmstats; + + if (table (TBL_VMSTATS, 0, &vmstats, 1, sizeof (vmstats)) == 1) + { + double pages = vmstats.free_count; + double pagesize = vmstats.pagesize; + + if (0 <= pages && 0 <= pagesize) + return pages * pagesize; + } + } +#endif + /* Guess 25% of physical memory. */ return physmem_total () / 4; } |