diff options
author | Karel Zak | 2018-12-12 14:25:22 +0100 |
---|---|---|
committer | Karel Zak | 2018-12-12 14:25:22 +0100 |
commit | 6bf071afa2ca3d7853aa76a702415fa77c1719e5 (patch) | |
tree | 5866a89309e7fadafdfd2e5f4032340fcf2c81e1 | |
parent | mkswap: use dd(1) in example rather than fallocate(1) (diff) | |
parent | lscpu: Add aarch32 detection on aarch64 (diff) | |
download | kernel-qcow2-util-linux-6bf071afa2ca3d7853aa76a702415fa77c1719e5.tar.gz kernel-qcow2-util-linux-6bf071afa2ca3d7853aa76a702415fa77c1719e5.tar.xz kernel-qcow2-util-linux-6bf071afa2ca3d7853aa76a702415fa77c1719e5.zip |
Merge branch 'aarch32_on_aarch64' of https://github.com/jlinton/util-linux
* 'aarch32_on_aarch64' of https://github.com/jlinton/util-linux:
lscpu: Add aarch32 detection on aarch64
-rw-r--r-- | sys-utils/lscpu.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 1ff9069f3..245be6e5c 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -33,6 +33,7 @@ #include <stdarg.h> #include <sys/types.h> #include <sys/stat.h> +#include <sys/personality.h> #if (defined(__x86_64__) || defined(__i386__)) # if !defined( __SANITIZE_ADDRESS__) @@ -332,6 +333,19 @@ init_mode(struct lscpu_modifier *mod) defined(__s390x__) || defined(__s390__) || defined(__sparc_v9__) m |= MODE_32BIT; #endif + +#if defined(__aarch64__) + { + /* personality() is the most reliable way (since 4.7) + * to determine aarch32 support */ + int pers = personality(PER_LINUX32); + if (pers != -1) { + personality(pers); + m |= MODE_32BIT; + } + m |= MODE_64BIT; + } +#endif return m; } |