diff options
author | Sami Kerola | 2014-09-07 01:16:18 +0200 |
---|---|---|
committer | Sami Kerola | 2014-09-19 20:31:02 +0200 |
commit | 9ed11cc260a28a64de0c1fa5d94d7cd6273781a5 (patch) | |
tree | 9ae7cb9ab81c321e6429a0843985594994af000e /sys-utils/setarch.c | |
parent | setarch: reindent code (diff) | |
download | kernel-qcow2-util-linux-9ed11cc260a28a64de0c1fa5d94d7cd6273781a5.tar.gz kernel-qcow2-util-linux-9ed11cc260a28a64de0c1fa5d94d7cd6273781a5.tar.xz kernel-qcow2-util-linux-9ed11cc260a28a64de0c1fa5d94d7cd6273781a5.zip |
setarch: use personality() system call when it is available
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/setarch.c')
-rw-r--r-- | sys-utils/setarch.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c index 468e49260..ed2a6a64c 100644 --- a/sys-utils/setarch.c +++ b/sys-utils/setarch.c @@ -24,8 +24,7 @@ * sparc32 util by Jakub Jelinek (1998, 1999) */ -#include <syscall.h> -#include <linux/personality.h> +#include <sys/personality.h> #include <unistd.h> #include <stdio.h> #include <string.h> @@ -37,7 +36,10 @@ #include "c.h" #include "closestream.h" -#define set_pers(pers) ((long)syscall(SYS_personality, pers)) +#ifndef HAVE_PERSONALITY +# include <syscall.h> +# define personality(pers) ((long)syscall(SYS_personality, pers)) +#endif /* Options without equivalent short options */ enum { @@ -229,7 +231,7 @@ static int set_arch(const char *pers, unsigned long options, int list) if (transitions[i].perval < 0) errx(EXIT_FAILURE, _("%s: Unrecognized architecture"), pers); pers_value = transitions[i].perval | options; - if (set_pers(pers_value) == -EINVAL) + if (personality(pers_value) == -EINVAL) return 1; uname(&un); if (transitions[i].result_arch && strcmp(un.machine, transitions[i].result_arch)) { |