From: Ben Hutchings <ben@decadent.org.uk>
To: Andi Kleen <andi@firstfloor.org>
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>,
util-linux@vger.kernel.org
Subject: [PATCH] setarch: Add --uname-2.6 option for personality flag UNAME26
Date: Tue, 23 Aug 2011 07:00:01 +0100 [thread overview]
Message-ID: <1314079201.12047.68.camel@deadeye> (raw)
In-Reply-To: <1313795710-30827-1-git-send-email-andi@firstfloor.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
On Fri, 2011-08-19 at 16:15 -0700, Andi Kleen wrote:
[...]
> To use:
>
> wget ftp://ftp.kernel.org/pub/linux/kernel/people/ak/uname26/uname26.c
> gcc -o uname26 uname26.c
> ./uname26 program
[...]
I would suggest adding this to setarch, as that handles all the other
personality flags. The following patch to util-linux seems to do the
trick.
Ben.
configure.ac | 1 +
sys-utils/setarch.8 | 3 +++
sys-utils/setarch.c | 12 +++++++++++-
3 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index 0d3b889..51d06fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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,
diff --git a/sys-utils/setarch.8 b/sys-utils/setarch.8
index 0764a45..b6f5b77 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 35efca4..b53bf36 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -41,6 +41,8 @@
/* Option --4gb has no equivalent short option, use a non-character as a
pseudo short option. */
#define OPT_4GB (CHAR_MAX+1)
+/* Similarly for --uname-2.6 */
+#define OPT_UNAME26 (OPT_4GB+1)
#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 }
};
@@ -125,7 +131,8 @@ show_help(void)
" -S, --whole-seconds turns on WHOLE_SECONDS\n"
" -T, --sticky-timeouts turns on STICKY_TIMEOUTS\n"
" -3, --3gb limits the used address space to a maximum of 3 GB\n"
- " --4gb ignored (for backward compatibility only)\n"));
+ " --4gb ignored (for backward compatibility only)\n"
+ " --uname-2.6 turns on UNAME26\n"));
printf(_("\nFor more information see setarch(8).\n"));
exit(EXIT_SUCCESS);
@@ -306,6 +313,9 @@ int main(int argc, char *argv[])
break;
case OPT_4GB: /* just ignore this one */
break;
+ case OPT_UNAME26:
+ turn_on(UNAME26, options);
+ break;
}
}
--
1.7.5.4
next prev parent reply other threads:[~2011-08-23 6:00 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-19 23:15 [PATCH] Add a personality to report 2.6.x version numbers Andi Kleen
2011-08-21 22:28 ` Arnaud Lacombe
2011-08-21 22:37 ` Jesper Juhl
2011-08-21 23:15 ` Andi Kleen
2011-08-21 23:13 ` Andi Kleen
2011-08-21 23:32 ` Arnaud Lacombe
2011-08-22 0:11 ` Andi Kleen
2011-08-22 1:04 ` Arnaud Lacombe
2011-08-22 1:46 ` Andi Kleen
2011-08-22 9:54 ` Américo Wang
2011-08-22 18:30 ` Linus Torvalds
2011-08-22 18:45 ` Eric Dumazet
2011-08-22 19:03 ` David Daney
2011-08-22 19:34 ` Andi Kleen
2011-08-23 13:15 ` Colin Walters
2011-08-23 16:11 ` Andi Kleen
2011-08-23 16:20 ` Colin Walters
2011-08-23 17:35 ` Arnaud Lacombe
2011-08-24 14:19 ` Alexey Dobriyan
2011-08-24 17:02 ` Arnd Bergmann
2011-09-13 14:12 ` Pavel Machek
2011-09-13 14:36 ` Stratos Psomadakis
2011-09-13 15:50 ` Andi Kleen
2011-09-13 23:06 ` Stratos Psomadakis
2011-08-23 6:00 ` Ben Hutchings [this message]
2011-08-23 10:16 ` [PATCH] setarch: Add --uname-2.6 option for personality flag UNAME26 Karel Zak
2011-08-23 12:15 ` Ben Hutchings
2011-08-26 21:43 ` Greg KH
2011-08-29 9:17 ` Karel Zak
2011-08-23 12:44 ` [PATCH] Add a personality to report 2.6.x version numbers Arnd Bergmann
2011-08-26 21:43 ` Greg KH
2011-08-26 22:25 ` Andi Kleen
2011-08-26 22:35 ` Greg KH
2011-08-27 16:36 ` Jesper Juhl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1314079201.12047.68.camel@deadeye \
--to=ben@decadent.org.uk \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox