coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Proposed uname -r -v FAQ entry


From: Bob Proulx
Subject: Proposed uname -r -v FAQ entry
Date: Sat, 28 Dec 2013 13:55:05 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

Eric Blake wrote:
> Thanks for the report.  However, this is turning into a FAQ; see
> debbugs.gnu.org/14388 for the last discussion on the issue ...

I have written up this potential FAQ entry on uname.  First is the raw
texinfo.  I follow this with the formatted output without the texinfo
markup since that might be easier to read as it would be displayed.

Comments?

Bob


@c ---------------------------------------------------------------------------
@node uname is system specific
@chapter uname is system specific

Due to the peculiarities of the Linux kernel there are often questions
like this one concerning the @code{uname -r -v} output.

@quotation
The man page for uname says:
@example
-r, --kernel-release     print the kernel release
-v, --kernel-version     print the kernel version
@end example
But the Linux kernel seems to return the opposite value for each.
@example
$ uname -r
2.6.32-431.1.2.0.1.el6.x86_64

$ uname -v
#1 SMP Fri Dec 13 13:06:13 UTC 2013
@end example
Isn't that a bug?
@end quotation

This is not a bug in the uname command.  The uname(3) command line
utility is simply a thin wrapper around the uname(2) system call.  It
displays the kernel information stored in the kernel's @code{struct
utsname} data structure.  That information is determined by the
operating system kernel not the uname(3) command line display tool.

The short answer is that the kernel has chosen to store that specific
data and it isn't anything that the uname display program can change.
If you want it changed then it must be changed in the kernel.

The long answer is that the uname command is a very old command and
has been around a very long time.  The utility of the command itself
dates way back into the history of Unix and the origins of
communication between different hosts.  (If anyone can point me to a
good reference on the original history of this please contact me.)
The system name and host names are limited to eight characters which
is smaller than the full field width available to those fields today.
Longer strings will be truncated.  The command has always been very
system specific.  The output of uname is not portable across different
systems.

The only portable way to use uname(1) is to call it first without
arguments to see which system name it returns and then after knowing
the system type then call it again with whatever options make sense on
that system.

A recent log of the discussion in the bug tracker includes more
information and links to duplicate bug reports on the same topic.

@example
@uref{http://debbugs.gnu.org/14388}
@end example

At the time of this writing someone at Wikipedia has documented a list
of uname outputs from various systems.  I think that is unmanageable
and at some point in the future I expect a deletionist will delete
it.  But in the meantime a table of various system outputs is there.

@example
@uref{http://en.wikipedia.org/wiki/Uname}
@end example

Documentation on the uname(2) system call and the @code{struct
utsname} data structure may be found on a GNU system in the Texinfo
documentation system in the ``Platform Type'' section under the
``System Management'' chapter.  On a GNU system you can get there
directly with this command line.

@example
$ info libc 'Platform Type'
@end example

This most recent version is also available online.

@example
@uref{http://www.gnu.org/software/libc/manual/html_node/Platform-Type.html}
@end example

================================================================

uname is system specific

Due to the pecularities of the Linux kernel there are often questions
like this one concerning the uname -r -v output.

    The man page for uname says:

        -r, --kernel-release     print the kernel release
        -v, --kernel-version     print the kernel version

    But the Linux kernel seems to return the opposite value for each.

        $ uname -r
        2.6.32-431.1.2.0.1.el6.x86_64

        $ uname -v
        #1 SMP Fri Dec 13 13:06:13 UTC 2013

    Isn't that a bug? 

This is not a bug in the uname command.  The uname(3) command line
utility is simply a thin wrapper around the uname(2) system call.  It
displays the kernel information stored in the kernel's struct utsname
data structure.  That information is determined by the operating system
kernel not the uname(3) command line display tool.

The short answer is that the kernel has chosen to store that specific
data and it isn't anything that the uname display program can
change.  If you want it changed then it must be changed in the kernel.

The long answer is that the uname command is a very old command and
has been around a very long time.  The utility of the command itself
dates way back into the history of Unix and the origins of
communication between different hosts.  (If anyone can point me to a
good reference on the original history of this please contact me.)  The
system name and host names are limited to eight characters which is
smaller than the full field width available to those fields
today.  Longer strings will be truncated.  The command has always been
very system specific.  The output of uname is not portable across
different systems.

The only portable way to use uname(1) is to call it first without
arguments to see which system name it returns and then after knowing
the system type then call it again with whatever options make sense on
that system.

A recent log of the discussion in the bug tracker includes more
information and links to duplicate bug reports on the same topic.

    http://debbugs.gnu.org/14388

At the time of this writing someone at Wikipedia has documented a list
of uname outputs from various systems.  I think that is unmanageable
and at some point in the future I expect a deletionist will delete
it.  But in the meantime a table of various system outputs is there.

    http://en.wikipedia.org/wiki/Uname

Documentation on the uname(2) system call and the struct utsname data
structure may be found on a GNU system in the Texinfo documentation
system in the "Platform Type" section under the "System Management"
chapter.  On a GNU system you can get there directly with this command
line.

    $ info libc 'Platform Type'

This most recent version is also available online.

    http://www.gnu.org/software/libc/manual/html_node/Platform-Type.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]