perfbook.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leonardo Bras <leobras.c@gmail.com>
To: paulmck@kernel.org
Cc: Leonardo Bras <leobras.c@gmail.com>, perfbook@vger.kernel.org
Subject: [PATCH v1] Codesamples/depends.mk : Replace non-portable uname '-p' with '-m'
Date: Sat,  4 Feb 2023 00:01:01 -0300	[thread overview]
Message-ID: <20230204030100.65344-1-leobras.c@gmail.com> (raw)

`uname -p` returns 'unknown' for current coreutils.

On GNU coreutils 9.1, the uname --help text says:

uname --help
Usage: uname [OPTION]...
[...]
  -v, --kernel-version     print the kernel version
  -m, --machine            print the machine hardware name
  -p, --processor          print the processor type (non-portable)
  -i, --hardware-platform  print the hardware platform (non-portable)
[...]

Looking deeper, I noticed that '-p' is supposed to be printing the
processor type when available, and not necessarily the architecture.

For printing the architecture, it's recommended to use uname -m, instead.
Even so, it seems like some distros make '-p' to return the same as '-m'
for compatibility purposes.

Anyway, change '-p' to '-m' on depends.mk to avoid getting arch=unknown.

Signed-off-by: Leonardo Bras <leobras.c@gmail.com>
---
 CodeSamples/depends.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CodeSamples/depends.mk b/CodeSamples/depends.mk
index 30810339..2086fe00 100644
--- a/CodeSamples/depends.mk
+++ b/CodeSamples/depends.mk
@@ -1,5 +1,5 @@
 ifeq ($(strip $(arch)),)
-arch := $(shell uname -p)
+arch := $(shell uname -m)
 endif
 
 ifeq ($(strip $(os)),)
-- 
2.39.1


             reply	other threads:[~2023-02-04  3:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04  3:01 Leonardo Bras [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-02-04  2:55 [PATCH v1] Codesamples/depends.mk : Replace non-portable uname '-p' with '-m' Leonardo Bras

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=20230204030100.65344-1-leobras.c@gmail.com \
    --to=leobras.c@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=perfbook@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).