[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YxEjTK7zFfe4cxhS@pevik>
Date: Thu, 1 Sep 2022 23:25:32 +0200
From: Petr Vorel <pvorel@...e.cz>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org,
Eric Biederman <ebiederm@...ssion.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
David Sterba <dsterba@...e.com>
Subject: Re: [PATCH v3 1/1] kernel/utsname_sysctl.c: Print kernel arch
> On Thu, 1 Sep 2022 21:44:03 +0200 Petr Vorel <pvorel@...e.cz> wrote:
> > Print the machine hardware name (UTS_MACHINE) in /proc/sys/kernel/arch.
> > This helps people who debug kernel with initramfs with minimal
> > environment (i.e. without coreutils or even busybox) or allow to open
> > sysfs file instead of run 'uname -m' in high level languages.
> If they're this constrained, why not run sys_uname() directly?
Hi Andrew,
of course you're right that in C is the most straightforward way to use uname(2).
I was more concerned about userspace, but I have to admit uname is probably
everywhere, therefore this is probably useless.
The background of this was my colleague while writing software running LTP tests
with qemu (using whole systems on qcow image or minimal dracut initramfs) or over SSH
got all info about running kernel from proc / sysfs, just architecture was
missing.
/proc/cpuinfo and /sys/devices/system/cpu/ are full of details about CPU, but
surprisingly no info about the architecture. Understand, this info is in struct
utsname and there is uname binary, OTOH there are
/proc/sys/kernel/{osrelease,ostype,version}, which are also in struct utsname.
Kind regards,
Petr
Powered by blists - more mailing lists