RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 21-Feb-2009 20:09:10 Branch: HEAD Handle: 2009022119091000 Modified files: rpm CHANGES configure.ac rpm/rpmio rpmz.c Log: - jbj: rpmz: swipe xz AutoFu to detect physmem/ncpus. Summary: Revision Changes Path 1.2785 +1 -0 rpm/CHANGES 2.339 +88 -0 rpm/configure.ac 1.28 +0 -13 rpm/rpmio/rpmz.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.2784 -r1.2785 CHANGES --- rpm/CHANGES 21 Feb 2009 18:20:47 -0000 1.2784 +++ rpm/CHANGES 21 Feb 2009 19:09:10 -0000 1.2785 @@ -1,5 +1,6 @@ 5.2a2 -> 5.2a3: + - jbj: rpmz: swipe xz AutoFu to detect physmem/ncpus. - jbj: yarn: add to rpmio. - jbj: rpmz: stub in argv[0] processing to set operation mode. - jbj: rpmz: stub in RPMZ envvar option processing. @@ . patch -p0 <<'@@ .' Index: rpm/configure.ac ============================================================================ $ cvs diff -u -r2.338 -r2.339 configure.ac --- rpm/configure.ac 17 Feb 2009 21:25:06 -0000 2.338 +++ rpm/configure.ac 21 Feb 2009 19:09:10 -0000 2.339 @@ -723,6 +723,94 @@ ]) ]) +dnl # Check how to find out the amount of physical memory in the system. The +dnl # xz command line tool uses this to automatically limit its memory usage. +dnl # - sysconf() gives all the needed info on GNU+Linux and Solaris. +dnl # - BSDs use sysctl(). +AC_MSG_CHECKING([how to detect the amount of physical memory]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +#include <unistd.h> +int +main() +{ + long i; + i = sysconf(_SC_PAGESIZE); + i = sysconf(_SC_PHYS_PAGES); + return 0; +} +]])], [ + AC_DEFINE([HAVE_PHYSMEM_SYSCONF], [1], + [Define to 1 if the amount of physical memory can be detected + with sysconf(_SC_PAGESIZE) and sysconf(_SC_PHYS_PAGES).]) + AC_MSG_RESULT([sysconf]) +], [ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +#include <sys/types.h> +#ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +#endif +#include <sys/sysctl.h> +int +main() +{ + int name[2] = { CTL_HW, HW_PHYSMEM }; + unsigned long mem; + size_t mem_ptr_size = sizeof(mem); + sysctl(name, 2, &mem, &mem_ptr_size, NULL, NULL); + return 0; +} +]])], [ + AC_DEFINE([HAVE_PHYSMEM_SYSCTL], [1], + [Define to 1 if the amount of physical memory can be detected + with sysctl().]) + AC_MSG_RESULT([sysctl]) +], [ + AC_MSG_RESULT([unknown]) +])]) + +dnl # Check how to find out the number of available CPU cores in the system. +dnl # sysconf(_SC_NPROCESSORS_ONLN) works on most systems, except that BSDs +dnl # use sysctl(). +AC_MSG_CHECKING([how to detect the number of available CPU cores]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +#include <unistd.h> +int +main() +{ + long i; + i = sysconf(_SC_NPROCESSORS_ONLN); + return 0; +} +]])], [ + AC_DEFINE([HAVE_NCPU_SYSCONF], [1], + [Define to 1 if the number of available CPU cores can be + detected with sysconf(_SC_NPROCESSORS_ONLN).]) + AC_MSG_RESULT([sysconf]) +], [ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +#include <sys/types.h> +#ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +#endif +#include <sys/sysctl.h> +int +main() +{ + int name[2] = { CTL_HW, HW_NCPU }; + int cpus; + size_t cpus_size = sizeof(cpus); + sysctl(name, 2, &cpus, &cpus_size, NULL, NULL); + return 0; +} +]])], [ + AC_DEFINE([HAVE_NCPU_SYSCTL], [1], + [Define to 1 if the number of available CPU cores can be + detected with sysctl().]) + AC_MSG_RESULT([sysctl]) +], [ + AC_MSG_RESULT([unknown]) +])]) + dnl ## dnl ## ==== THIRD-PARTY LIBRARIES (1/2) ==== dnl ## @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmz.c ============================================================================ $ cvs diff -u -r1.27 -r1.28 rpmz.c --- rpm/rpmio/rpmz.c 21 Feb 2009 18:20:00 -0000 1.27 +++ rpm/rpmio/rpmz.c 21 Feb 2009 19:09:10 -0000 1.28 @@ -262,12 +262,6 @@ } /*==============================================================*/ -#if linux -#define HAVE_PHYSMEM_SYSCONF 1 /* XXX hotwired for linux */ -#endif -#if defined(__APPLE__) && defined(__MACH__) -#define HAVE_PHYSMEM_SYSCTL 1 /* XXX hotwired for darwin */ -#endif #if defined(HAVE_PHYSMEM_SYSCTL) /* HAVE_SYS_SYSCTL_H */ #include <sys/sysctl.h> @@ -301,13 +295,6 @@ return ret; } -#if linux -#define HAVE_NCPU_SYSCONF 1 /* XXX hotwired for linux */ -#endif -#if defined(__APPLE__) && defined(__MACH__) -#define HAVE_NCPU_SYSCTL 1 /* XXX hotwired for darwin */ -#endif - #if defined(HAVE_NCPU_SYSCTL) /* HAVE_SYS_SYSCTL_H */ #include <sys/sysctl.h> #endif @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org