32-bit uname with 64-bit kernel
- To: debian-bsd <debian-bsd@lists.debian.org>
- Subject: 32-bit uname with 64-bit kernel
- From: Tuco <tuco.xyz@gmail.com>
- Date: Thu, 5 Aug 2010 13:16:21 -0400
- Message-id: <AANLkTinL=_6Wv8kSFMfDPrCWHbyOm9oQ1TbJV+_OvJth@mail.gmail.com>
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: