[PATCH 16/17] setarch: use personality() system call when it is available

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 sys-utils/setarch.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index 468e492..ed2a6a6 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)) {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux