This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Call for testers: libiberty/physmem.c


 > From: David Edelsohn <dje at watson dot ibm dot com>
 > 
 > One query the total physical memory in the system through the
 > _system_configuration implicitly exported symbol which returns the
 > number of bytes of physical memory as a long long int:
 > 
 > Available memory requires querying the VMM system which is privileged.

Luckily we don't need available mem...

Does this patch work?

(You'll need to apply the BSD patch before this one.)
http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01894.html

		--Kaveh



2003-02-21  Kaveh R. Ghazi  <ghazi at caip dot rutgers dot edu>

	* configure.in: Check for sys/systemcfg.h and
	_system_configuration.
	* physmem.c: Add support for AIX.

diff -rup orig/egcc-CVS20030221/libiberty/configure.in egcc-CVS20030221/libiberty/configure.in
--- orig/egcc-CVS20030221/libiberty/configure.in	2003-02-21 21:42:38.315670852 -0500
+++ egcc-CVS20030221/libiberty/configure.in	2003-02-21 21:38:40.351479712 -0500
@@ -142,7 +142,7 @@ AC_SUBST_FILE(host_makefile_frag)
 # It's OK to check for header files.  Although the compiler may not be
 # able to link anything, it had better be able to at least compile
 # something.
-AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h)
+AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h)
 AC_HEADER_SYS_WAIT
 AC_HEADER_TIME
 
@@ -204,7 +204,7 @@ funcs="$funcs waitpid"
 
 # Also in the old function.def file: alloca, vfork, getopt.
 
-vars="sys_errlist sys_nerr sys_siglist"
+vars="sys_errlist sys_nerr sys_siglist _system_configuration"
 
 checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk gettimeofday"
 checkfuncs="$checkfuncs realpath canonicalize_file_name pstat_getstatic pstat_getdynamic sysmp"
@@ -225,6 +225,7 @@ if test "x" = "y"; then
   AC_DEFINE(HAVE_SYS_ERRLIST, 1, [Define if you have the sys_errlist variable.])
   AC_DEFINE(HAVE_SYS_NERR,    1, [Define if you have the sys_nerr variable.])
   AC_DEFINE(HAVE_SYS_SIGLIST, 1, [Define if you have the sys_siglist variable.])
+  AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1, [Define if you have the _system_configuration variable.])
 fi
 
 # For each of these functions, if the host does not provide the
diff -rup orig/egcc-CVS20030221/libiberty/physmem.c egcc-CVS20030221/libiberty/physmem.c
--- orig/egcc-CVS20030221/libiberty/physmem.c	2003-02-21 21:42:38.315670852 -0500
+++ egcc-CVS20030221/libiberty/physmem.c	2003-02-21 21:42:10.167475672 -0500
@@ -52,6 +52,10 @@
 #include <sys/sysctl.h>
 #endif
 
+#if HAVE_SYS_SYSTEMCFG_H
+#include <sys/systemcfg.h>
+#endif
+
 #include "libiberty.h"
 
 /* Return the total amount of physical memory.  */
@@ -123,6 +127,11 @@ physmem_total ()
   }
 #endif
 
+#if HAVE__SYSTEM_CONFIGURATION
+  /* This works on AIX.  */
+  return _system_configuration.physmem;
+#endif
+
   /* Return 0 if we can't determine the value.  */
   return 0;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]