summaryrefslogtreecommitdiffstats
path: root/sys-utils/setarch.c
diff options
context:
space:
mode:
authorBen Hutchings2011-08-23 08:00:01 +0200
committerKarel Zak2011-08-29 11:16:25 +0200
commit70eebc40e2cb3718e02b8543e5f2a1624b3eda69 (patch)
tree1b85401b6c4bfd989361f4cacf92a3d448cd3a41 /sys-utils/setarch.c
parentflock: fix example in man page (diff)
downloadkernel-qcow2-util-linux-70eebc40e2cb3718e02b8543e5f2a1624b3eda69.tar.gz
kernel-qcow2-util-linux-70eebc40e2cb3718e02b8543e5f2a1624b3eda69.tar.xz
kernel-qcow2-util-linux-70eebc40e2cb3718e02b8543e5f2a1624b3eda69.zip
setarch: add --uname-2.6 option for personality flag UNAME26
[kzak@redhat.com: - minor change in usage()] Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/setarch.c')
-rw-r--r--sys-utils/setarch.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index 35efca4a9..a33be70d7 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -38,9 +38,11 @@
#define set_pers(pers) ((long)syscall(SYS_personality, pers))
-/* Option --4gb has no equivalent short option, use a non-character as a
- pseudo short option. */
-#define OPT_4GB (CHAR_MAX+1)
+/* Options without equivalent short options */
+enum {
+ OPT_4GB = CHAR_MAX + 1,
+ OPT_UNAME26
+};
#define turn_on(_flag, _opts) \
do { \
@@ -50,6 +52,9 @@
} while(0)
+#if !HAVE_DECL_UNAME26
+# define UNAME26 0x0020000
+#endif
#if !HAVE_DECL_ADDR_NO_RANDOMIZE
# define ADDR_NO_RANDOMIZE 0x0040000
#endif
@@ -98,6 +103,7 @@ static const struct option longopts[] =
{ "sticky-timeouts", 0, 0, 'T' },
{ "3gb", 0, 0, '3' },
{ "4gb", 0, 0, OPT_4GB },
+ { "uname-2.6", 0, 0, OPT_UNAME26 },
{ NULL, 0, 0, 0 }
};
@@ -127,6 +133,9 @@ show_help(void)
" -3, --3gb limits the used address space to a maximum of 3 GB\n"
" --4gb ignored (for backward compatibility only)\n"));
+ printf(_(
+ " --uname-2.6 turns on UNAME26\n"));
+
printf(_("\nFor more information see setarch(8).\n"));
exit(EXIT_SUCCESS);
}
@@ -306,6 +315,9 @@ int main(int argc, char *argv[])
break;
case OPT_4GB: /* just ignore this one */
break;
+ case OPT_UNAME26:
+ turn_on(UNAME26, options);
+ break;
}
}