]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
setarch: add --uname-2.6 option for personality flag UNAME26
authorBen Hutchings <ben@decadent.org.uk>
Tue, 23 Aug 2011 06:00:01 +0000 (07:00 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 29 Aug 2011 09:16:25 +0000 (11:16 +0200)
[kzak@redhat.com: - minor change in usage()]

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Karel Zak <kzak@redhat.com>
configure.ac
sys-utils/setarch.8
sys-utils/setarch.c

index 0d3b889312edfa2852686fd2698aab28b405faf3..51d06fdd59fd280b9326d5828c9bc8210e19da28 100644 (file)
@@ -792,6 +792,7 @@ AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
        [#include <sys/stat.h>])
 
 AC_CHECK_DECLS([
+ UNAME26,
  ADDR_NO_RANDOMIZE,
  FDPIC_FUNCPTRS,
  MMAP_PAGE_ZERO,
index 0764a455b227c696405400eefb90af77d7647c39..b6f5b776c70f71598670e437aa4183dacb5dce6b 100644 (file)
@@ -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
index 35efca4a99a5717bdc374dc95690cd050bd9780c..a33be70d756c64764f7ddf98d0069da251cab3c6 100644 (file)
 
 #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;
     }
   }