[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

32-bit uname with 64-bit kernel



I found this problem when running uname inside a 32-bit chroot, 'uname
-m' prints amd64! This often breaks configure scripts and build
systems.

With this glibc patch, uname corrects the output after it has been
obtained with sysctl.

Can I commit this? Is glibc-bsd/glibc-ports/kfreebsd/uname.c the right
place, or should I send it in a bug report?
Index: glibc-ports/kfreebsd/uname.c
===================================================================
--- glibc-ports/kfreebsd/uname.c	(revision 3110)
+++ glibc-ports/kfreebsd/uname.c	(working copy)
@@ -101,6 +101,12 @@
       if (len < sizeof (name->machine))
         name->machine[len] = '\0';
     }
+
+# ifdef __i386__
+  /* Running 32-bit uname on 64-bit kernel.  */
+  if (!strcmp (name->machine, "amd64"))
+    strcpy (name->machine, "i686");
+# endif
 #endif
 
   return 0;

Reply to: