summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-02-21 05:42:02 +0000
committerMike Frysinger <vapier@gentoo.org>2006-02-21 05:42:02 +0000
commitc7929ee5468008d0dfbc7c3a0f1e053edb0843ce (patch)
treea49b5bf055c407165f8bcde39ce1ba4c39d03869 /sys-apps/setarch
parentadd support for a -h (help) option (diff)
downloadgentoo-2-c7929ee5468008d0dfbc7c3a0f1e053edb0843ce.tar.gz
gentoo-2-c7929ee5468008d0dfbc7c3a0f1e053edb0843ce.tar.bz2
gentoo-2-c7929ee5468008d0dfbc7c3a0f1e053edb0843ce.zip
if setting 64bit mode failed, retry with 32bit mem limit enforced
(Portage version: 2.1_pre4-r1)
Diffstat (limited to 'sys-apps/setarch')
-rw-r--r--sys-apps/setarch/files/setarch-1.8-switch-64bit-fallback.patch26
-rw-r--r--sys-apps/setarch/setarch-1.8.ebuild3
2 files changed, 28 insertions, 1 deletions
diff --git a/sys-apps/setarch/files/setarch-1.8-switch-64bit-fallback.patch b/sys-apps/setarch/files/setarch-1.8-switch-64bit-fallback.patch
new file mode 100644
index 000000000000..bd571ebdeb63
--- /dev/null
+++ b/sys-apps/setarch/files/setarch-1.8-switch-64bit-fallback.patch
@@ -0,0 +1,26 @@
+--- setarch.c
++++ setarch.c
+@@ -98,6 +98,7 @@
+ }
+
+ pers_value = transitions[i].perval | options;
++retry_set_pers:
+ res = set_pers(pers_value);
+ if(res == -EINVAL)
+ return 1;
+@@ -112,6 +113,15 @@
+ && strcmp(un.machine, "i686")
+ && strcmp(un.machine, "athlon")))
+ {
++ /* if we are switching to 64bit mode and it failed,
++ * see if it was because we need to enforce the 32bit
++ * memory limit (-B) ... */
++ if(pers_value == PER_LINUX)
++ {
++ fprintf(stderr, "Unable to set arch to %s, retrying with 32bit memory limit (-B) ...\n", pers);
++ pers_value = PER_LINUX_32BIT;
++ goto retry_set_pers;
++ }
+ fprintf(stderr, "Unable to set arch to %s\n", pers);
+ exit(1);
+ }
diff --git a/sys-apps/setarch/setarch-1.8.ebuild b/sys-apps/setarch/setarch-1.8.ebuild
index b0d6b89f9ca1..b542063c8cbf 100644
--- a/sys-apps/setarch/setarch-1.8.ebuild
+++ b/sys-apps/setarch/setarch-1.8.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/setarch/setarch-1.8.ebuild,v 1.2 2006/02/21 05:31:21 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/setarch/setarch-1.8.ebuild,v 1.3 2006/02/21 05:42:02 vapier Exp $
inherit eutils
@@ -28,6 +28,7 @@ src_unpack() {
epatch "${FILESDIR}"/${P}-better-error.patch
epatch "${FILESDIR}"/${P}-links.patch
epatch "${FILESDIR}"/${P}-help.patch
+ epatch "${FILESDIR}"/${P}-switch-64bit-fallback.patch
}
src_install() {