From: Ruediger Meier <sweet_f_a@gmx.de>
To: util-linux@vger.kernel.org
Subject: [PATCH] setarch, add generic support for setarch $(uname -m) ...
Date: Thu, 29 May 2014 02:53:18 +0200 [thread overview]
Message-ID: <1401324798-15059-2-git-send-email-sweet_f_a@gmx.de> (raw)
In-Reply-To: <1401324798-15059-1-git-send-email-sweet_f_a@gmx.de>
From: Ruediger Meier <ruediger.meier@ga-group.nl>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
sys-utils/setarch.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index 8e2b6e5..f335f83 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -202,9 +202,25 @@ set_arch(const char *pers, unsigned long options, int list)
{PER_LINUX, "alphaev6", "alpha"},
{PER_LINUX, "alphaev67", "alpha"},
#endif
+ {-1, NULL, NULL}, /* place holder, eventually filled up at runtime */
{-1, NULL, NULL}
};
+ /* Add the trivial transition {PER_LINUX, machine, machine} if no such
+ target_arch is hardcoded yet. */
+ uname(&un);
+ for (i = 0; transitions[i].perval >= 0; i++)
+ if(!strcmp(un.machine, transitions[i].target_arch))
+ break;
+ if (transitions[i].perval < 0) {
+ unsigned long wrdsz = CHAR_BIT * sizeof(void*);
+ if (wrdsz == 32 || wrdsz == 64) {
+ transitions[i].perval = wrdsz == 32 ? PER_LINUX32 : PER_LINUX;
+ transitions[i].target_arch = un.machine;
+ transitions[i].result_arch = un.machine;
+ }
+ }
+
if (list) {
for(i = 0; transitions[i].target_arch != NULL; i++)
printf("%s\n", transitions[i].target_arch);
--
1.8.4.5
next prev parent reply other threads:[~2014-05-29 0:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-26 23:34 setarch question, uname -m Ruediger Meier
2014-05-29 0:53 ` [PATCH] " Ruediger Meier
2014-05-29 0:53 ` Ruediger Meier [this message]
2014-05-29 7:53 ` [PATCH] setarch, add generic support for setarch $(uname -m) Karel Zak
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=1401324798-15059-2-git-send-email-sweet_f_a@gmx.de \
--to=sweet_f_a@gmx.de \
--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