diff options
author | Ruediger Meier | 2014-05-29 02:53:18 +0200 |
---|---|---|
committer | Karel Zak | 2014-05-29 09:52:26 +0200 |
commit | ae2c3b5bee7036da76b247f563172b72eaf69cb0 (patch) | |
tree | a425c5e81a62fe2b8f9afe9d38d5dd14d063fed3 /sys-utils | |
parent | build-sys: fix typo, set HAVE_LIBUUID (diff) | |
download | kernel-qcow2-util-linux-ae2c3b5bee7036da76b247f563172b72eaf69cb0.tar.gz kernel-qcow2-util-linux-ae2c3b5bee7036da76b247f563172b72eaf69cb0.tar.xz kernel-qcow2-util-linux-ae2c3b5bee7036da76b247f563172b72eaf69cb0.zip |
setarch: add generic support for setarch $(uname -m) ...
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/setarch.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c index 8e2b6e531..4cce877be 100644 --- a/sys-utils/setarch.c +++ b/sys-utils/setarch.c @@ -202,9 +202,25 @@ set_arch(const char *pers, unsigned long options, int list) {PER_LINUX, "alphaev6", "alpha"}, {PER_LINUX, "alphaev67", "alpha"}, #endif + {-1, NULL, NULL}, /* place holder, eventually filled up at runtime */ {-1, NULL, NULL} }; + /* Add the trivial transition {PER_LINUX, machine, machine} if no such + target_arch is hardcoded yet. */ + uname(&un); + for (i = 0; transitions[i].perval >= 0; i++) + if(!strcmp(un.machine, transitions[i].target_arch)) + break; + if (transitions[i].perval < 0) { + unsigned long wrdsz = CHAR_BIT * sizeof(void*); + if (wrdsz == 32 || wrdsz == 64) { + transitions[i].perval = wrdsz == 32 ? PER_LINUX32 : PER_LINUX; + transitions[i].target_arch = un.machine; + transitions[i].result_arch = un.machine; + } + } + if (list) { for(i = 0; transitions[i].target_arch != NULL; i++) printf("%s\n", transitions[i].target_arch); |