From: Ben Hutchings Date: Tue, 23 Aug 2011 06:00:01 +0000 (+0100) Subject: setarch: add --uname-2.6 option for personality flag UNAME26 X-Git-Tag: v2.20~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=70eebc40e2cb3718e02b8543e5f2a1624b3eda69;p=thirdparty%2Futil-linux.git setarch: add --uname-2.6 option for personality flag UNAME26 [kzak@redhat.com: - minor change in usage()] Signed-off-by: Ben Hutchings Signed-off-by: Karel Zak --- diff --git a/configure.ac b/configure.ac index 0d3b889312..51d06fdd59 100644 --- a/configure.ac +++ b/configure.ac @@ -792,6 +792,7 @@ AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,, [#include ]) AC_CHECK_DECLS([ + UNAME26, ADDR_NO_RANDOMIZE, FDPIC_FUNCPTRS, MMAP_PAGE_ZERO, diff --git a/sys-utils/setarch.8 b/sys-utils/setarch.8 index 0764a455b2..b6f5b776c7 100644 --- a/sys-utils/setarch.8 +++ b/sys-utils/setarch.8 @@ -29,6 +29,9 @@ Be verbose. .I "\-h," "\-\-help" Display help (it is also displayed when setarch takes no arguments). .TP +.I "\-\-uname\-2.6" +Causes the program to see a kernel version number beginning with 2.6. +.TP .I "\-3," "\-\-3gb" Specifies that processes should use a maximum of 3GB of address space on systems where it is supported (ADDR_LIMIT_3GB). .TP diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c index 35efca4a99..a33be70d75 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; } }