commit 60835b20180c1be351ff95fa8c8d930afada0e4c Author: Kirill A. Shutemov Date: Mon Jul 1 03:25:32 2013 +0300 Use getauxval(3) to read auxv data glibc >= 2.16 provides getauxval(): a reliable way to retrieve a value from the auxiliary vector. It doesn't rely on /proc filesystem. Let's switch to it and get rid of /proc dependency. Signed-off-by: Kirill A. Shutemov Signed-off-by: Panu Matilainen --- configure.ac.orig 2013-07-12 12:25:38.000000000 +0000 +++ configure.ac 2013-07-12 12:35:18.000000000 +0000 @@ -518,6 +518,7 @@ dnl Checks for library functions. AC_CHECK_FUNCS(putenv) AC_CHECK_FUNCS(mempcpy) AC_CHECK_FUNCS(fdatasync) +AC_CHECK_FUNCS(getauxval) AC_REPLACE_FUNCS(stpcpy stpncpy) --- lib/rpmrc.c.orig 2013-07-12 12:25:38.000000000 +0000 +++ lib/rpmrc.c 2013-07-12 12:34:34.000000000 +0000 @@ -20,6 +20,10 @@ #define __power_pc() 0 #endif +#ifdef HAVE_GETAUXVAL +#include +#endif + #include /* RPM_MACTABLE*, Rc-prototypes */ #include #include @@ -922,13 +926,19 @@ static int is_geode(void) #if defined(__linux__) && defined(__powerpc__) /** - * Populate rpmat structure with parsed info from /proc/self/auxv + * Populate rpmat structure with auxv values */ -static void parse_auxv(void) +static void read_auxv(void) { static int oneshot = 1; if (oneshot) { +#ifdef HAVE_GETAUXVAL + rpmat.platform = (char *) getauxval(AT_PLATFORM); + if (!rpmat.platform) + rpmat.platform = ""; + rpmat.hwcap = getauxval(AT_HWCAP); +#else rpmat.platform = ""; int fd = open("/proc/self/auxv", O_RDONLY); @@ -953,6 +963,7 @@ static void parse_auxv(void) } close(fd); } +#endif oneshot = 0; /* only try once even if it fails */ } return; @@ -972,7 +983,7 @@ static void defaultMachine(const char ** #if defined(__linux__) && defined(__powerpc__) /* Populate rpmat struct with hw info */ - parse_auxv(); + read_auxv(); #endif while (!gotDefaults) {