diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2004-08-04 05:58:43 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2004-08-04 05:58:43 +0000 |
commit | f37e35485f42813399865dec89599f062d6466be (patch) | |
tree | 632f41b5816a5651c1b5bcef7f0daa10b9fbbfc0 /src | |
parent | 28e596787954ef0ea22a6a311c72faf88d090ddb (diff) | |
download | coreutils-f37e35485f42813399865dec89599f062d6466be.tar.xz |
Do not depend on HAVE_SYSCTL when deciding
whether to include files. Include <sys/param.h> if
HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
(main) [defined __POWERPC__]: Add a kludge to work around a
Mac OS X bug, so that uname -p defaults to "powerpc" if
sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
fails. Problem reported by Petter Reinholdtsen in:
http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
Diffstat (limited to 'src')
-rw-r--r-- | src/uname.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/uname.c b/src/uname.c index 834440b50..9e7026ac2 100644 --- a/src/uname.c +++ b/src/uname.c @@ -29,8 +29,10 @@ # include <sys/systeminfo.h> #endif -#if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H -# include <sys/param.h> /* needed for OpenBSD 3.0 */ +#if HAVE_SYS_SYSCTL_H +# if HAVE_SYS_PARAM_H +# include <sys/param.h> /* needed for OpenBSD 3.0 */ +# endif # include <sys/sysctl.h> # ifdef HW_MODEL # ifdef HW_MACHINE_ARCH @@ -260,6 +262,11 @@ main (int argc, char **argv) static int mib[] = { CTL_HW, UNAME_PROCESSOR }; if (sysctl (mib, 2, processor, &s, 0, 0) >= 0) element = processor; +# ifdef __POWERPC__ + /* This kludge works around a bug in Mac OS X. */ + if (element == unknown) + element = "powerpc"; +# endif } #endif print_element (element); |