summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Fiddaman <omnios@citrus-it.co.uk>2018-03-09 14:37:15 -0800
committerJoshua M. Clulow <josh@sysmgr.org>2018-03-09 14:37:18 -0800
commit84c66da4cde7f54163e6f9a68f671d8351dd9eed (patch)
tree33164248c415f31411ea11e192c56305ecf82f74
parente9bacc6d1a71ea3f7082038b2868de8c4dd98bdc (diff)
downloadillumos-joyent-84c66da4cde7f54163e6f9a68f671d8351dd9eed.tar.gz
1956 /usr/bin/uname '-o' should return 'illumos'
Reviewed by: Dominik Hassler <hadfl@omniosce.org> Reviewed by: Sebastian Wiedenroth <sebastian.wiedenroth@skylime.net> Reviewed by: Peter Tribble <peter.tribble@gmail.com> Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> Reviewed by: Yuri Pankov <yuripv@yuripv.net> Approved by: Joshua M. Clulow <josh@sysmgr.org>
-rw-r--r--usr/src/cmd/uname/uname.c26
-rw-r--r--usr/src/man/man1/uname.1369
2 files changed, 165 insertions, 230 deletions
diff --git a/usr/src/cmd/uname/uname.c b/usr/src/cmd/uname/uname.c
index 2c43b50cd6..8fde32d24f 100644
--- a/usr/src/cmd/uname/uname.c
+++ b/usr/src/cmd/uname/uname.c
@@ -17,13 +17,13 @@
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
- */
-/*
+ *
+ * Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
@@ -49,6 +49,8 @@
#include <sys/utsname.h>
#include <sys/systeminfo.h>
+#define OS_NAME "illumos"
+
static void usage(void);
/* ARGSUSED */
@@ -56,9 +58,9 @@ int
main(int argc, char *argv[], char *envp[])
{
char *nodename;
- char *optstring = "asnrpvmiS:X";
+ char *optstring = "asnrpvmioS:X";
int sflg = 0, nflg = 0, rflg = 0, vflg = 0, mflg = 0;
- int pflg = 0, iflg = 0, Sflg = 0;
+ int pflg = 0, iflg = 0, oflg = 0, Sflg = 0;
int errflg = 0, optlet;
int Xflg = 0;
struct utsname unstr, *un;
@@ -104,6 +106,9 @@ main(int argc, char *argv[], char *envp[])
case 'i':
iflg++;
break;
+ case 'o':
+ oflg++;
+ break;
case 'S':
Sflg++;
nodename = optarg;
@@ -121,7 +126,7 @@ main(int argc, char *argv[], char *envp[])
if ((Sflg > 1) ||
(Sflg && (sflg || nflg || rflg || vflg || mflg || pflg || iflg ||
- Xflg))) {
+ oflg || Xflg))) {
usage();
}
@@ -148,7 +153,8 @@ main(int argc, char *argv[], char *envp[])
/*
* "uname -s" is the default
*/
- if (!(sflg || nflg || rflg || vflg || mflg || pflg || iflg || Xflg))
+ if (!(sflg || nflg || rflg || vflg || mflg || pflg || iflg ||
+ oflg || Xflg))
sflg++;
if (sflg) {
(void) fprintf(stdout, fs, sizeof (un->sysname),
@@ -189,6 +195,10 @@ main(int argc, char *argv[], char *envp[])
(void) fprintf(stdout, fs, strlen(procbuf), procbuf);
fs = fmt_string;
}
+ if (oflg) {
+ (void) fprintf(stdout, fs, strlen(OS_NAME), OS_NAME);
+ fs = fmt_string;
+ }
if (Xflg) {
int val;
@@ -224,7 +234,7 @@ usage(void)
{
{
(void) fprintf(stderr, gettext(
- "usage: uname [-snrvmapiX]\n"
+ "usage: uname [-snrvmapioX]\n"
" uname [-S system_name]\n"));
}
exit(1);
diff --git a/usr/src/man/man1/uname.1 b/usr/src/man/man1/uname.1
index 422252ea1d..12ed819805 100644
--- a/usr/src/man/man1/uname.1
+++ b/usr/src/man/man1/uname.1
@@ -43,238 +43,163 @@
.\" Copyright 1989 AT&T
.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved
+.\" Copyright 2018 Nexenta Systems, Inc.
.\"
-.TH UNAME 1 "May 13, 2017"
-.SH NAME
-uname \- print name of current system
-.SH SYNOPSIS
-.LP
-.nf
-\fBuname\fR [\fB-aimnprsvX\fR]
-.fi
-
-.LP
-.nf
-\fBuname\fR [\fB-S\fR \fIsystem_name\fR]
-.fi
-
-.SH DESCRIPTION
-.LP
-The \fBuname\fR utility prints information about the current system on the
-standard output. When options are specified, symbols representing one or more
-system characteristics will be written to the standard output. If no options
-are specified, \fBuname\fR prints the current operating system's name. The
-options print selected information returned by \fBuname\fR(2),
-\fBsysinfo\fR(2), or both.
-.SH OPTIONS
-.LP
+.Dd February 9, 2018
+.Dt UNAME 1
+.Os
+.Sh NAME
+.Nm uname
+.Nd print name of current system
+.Sh SYNOPSIS
+.Nm
+.Op Fl aimnoprsvX
+.Nm
+.Fl S Ar system_name
+.Sh DESCRIPTION
+The
+.Nm
+utility prints information about the current system on the standard output.
+When options are specified, symbols representing one or more system
+characteristics will be written to the standard output.
+If no options are specified,
+.Nm
+prints the current operating system's name.
+The options print selected information returned by
+.Xr uname 2 ,
+.Xr sysinfo 2 ,
+or both.
+.Sh OPTIONS
The following options are supported:
-.sp
-.ne 2
-.na
-\fB\fB-a\fR\fR
-.ad
-.RS 18n
+.Bl -tag -width Ds
+.It Fl a
Prints basic information currently available from the system.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-i\fR\fR
-.ad
-.RS 18n
+.It Fl i
Prints the name of the platform.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-m\fR\fR
-.ad
-.RS 18n
-Prints the machine hardware name (class). Use of this option is discouraged.
-Use \fBuname\fR \fB-p\fR instead. See NOTES section below.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-n\fR\fR
-.ad
-.RS 18n
+.It Fl m
+Prints the machine hardware name (class).
+Use of this option is discouraged.
+Use
+.Nm Fl p
+instead.
+See
+.Sx NOTES
+section below.
+.It Fl n
Prints the nodename (the nodename is the name by which the system is known to a
communications network).
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-p\fR\fR
-.ad
-.RS 18n
-Prints the current host's \fBISA\fR or processor type.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-r\fR\fR
-.ad
-.RS 18n
+.It Fl o
+Prints the name of the kernel/OS.
+.It Fl p
+Prints the current host's ISA or processor type.
+.It Fl r
Prints the operating system release level.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-s\fR\fR
-.ad
-.RS 18n
-Prints the name of the operating system. This is the default.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-S\fR \fIsystem_name\fR\fR
-.ad
-.RS 18n
-The nodename may be changed by specifying a system name argument. The system
-name argument is restricted to \fBSYS_NMLN\fR characters. \fBSYS_NMLN\fR is an
-implementation specific value defined in \fB<sys/utsname.h>\fR\&. Only the
-super-user is allowed this capability. This change does not persist across
-reboots of the system. See \fBnodename\fR(4) for details of how to change a
-host's name permanently.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-v\fR\fR
-.ad
-.RS 18n
+.It Fl s
+Prints the name of the operating system.
+This is the default.
+.It Fl S Ar system_name
+The nodename may be changed by specifying a system name argument.
+The system name argument is restricted to
+.Dv SYS_NMLN
+characters.
+.Dv SYS_NMLN
+is an implementation specific value defined in
+.In sys/utsname.h .
+Only the super-user is allowed this capability.
+This change does not persist across reboots of the system.
+See
+.Xr nodename 4
+for details of how to change a host's name permanently.
+.It Fl v
Prints the operating system version.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB-X\fR \fR
-.ad
-.RS 18n
+.It Fl X
Prints expanded system information, one information element per line, as
-expected by SCO UNIX. The displayed information includes:
-.RS +4
-.TP
-.ie t \(bu
-.el o
+expected by SCO UNIX.
+The displayed information includes:
+.Bl -bullet
+.It
system name, node, release, version, machine, and number of CPUs.
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
+.It
BusType, Serial, and Users (set to "unknown" in Solaris)
-.RE
-.RS +4
-.TP
-.ie t \(bu
-.el o
-OEM# and Origin# (set to \fB0\fR and \fB1\fR, respectively)
-.RE
-.RE
-
-.SH EXAMPLES
-.LP
-\fBExample 1 \fRPrinting the OS name and release level
-.sp
-.LP
+.It
+OEM# and Origin# (set to 0 and 1, respectively)
+.El
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+.Bl -tag -width Ds
+.It Sy Example 1 No Printing the OS name and release level
The following command:
-
-.sp
-.in +2
-.nf
-example% \fBuname \(misr\fR
-.fi
-.in -2
-.sp
-
-.sp
-.LP
-prints the operating system name and release level, separated by one SPACE
+.Bd -literal
+$ uname -sr
+.Ed
+.Pp
+\&...prints the operating system name and release level, separated by one SPACE
character.
-
-.SH ENVIRONMENT VARIABLES
-.LP
-See \fBenviron\fR(5) for descriptions of the following environment variables
-that affect the execution of \fBuname\fR: \fBLANG\fR, \fBLC_ALL\fR,
-\fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
-
-.SH EXIT STATUS
-.LP
-The following exit values are returned:
-.sp
-.ne 2
-.na
-\fB\fB0\fR \fR
-.ad
-.RS 7n
-Successful completion.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fB>0\fR \fR
-.ad
-.RS 7n
-An error occurred.
-.RE
-
-.SH ATTRIBUTES
-.LP
-See \fBattributes\fR(5) for descriptions of the following attributes:
-.sp
-
-.sp
-.TS
-box;
-c | c
-l | l .
-ATTRIBUTE TYPE ATTRIBUTE VALUE
-_
-Interface Stability Standard
-.TE
-
-.SH SEE ALSO
-.LP
-\fBarch\fR(1), \fBisalist\fR(1), \fBsysinfo\fR(2),
-\fBuname\fR(2), \fBnodename\fR(4), \fBattributes\fR(5), \fBenviron\fR(5),
-\fBstandards\fR(5)
-.SH NOTES
-.LP
-Independent software vendors (\fBISV\fRs) and others who need to determine
-detailed characteristics of the platform on which their software is either
-being installed or executed should use the \fBuname\fR command.
-.sp
-.LP
-To determine the operating system name and release level, use \fBuname
-\fR\fB-sr\fR. To determine only the operating system release level, use
-\fBuname \fR\fB-r\fR. Notice that operating system release levels are not
-guaranteed to be in \fIx.y\fR format (such as 5.3, 5.4, 5.5, and so forth);
-but could be in the \fIx.y.z\fR format (such as 5.5.1).
-.sp
-.LP
-In SunOS 4.\fIx\fR releases, the \fBarch\fR(1) command was often used to obtain
-information similar to that obtained by using the \fBuname\fR command. The
-\fBarch\fR(1) command output "sun4" was often incorrectly interpreted to
-signify a SunOS SPARC system. If hardware platform information is desired, use
-\fBuname \fR\fB-sp\fR.
-.sp
-.LP
-The \fBarch\fR \fB-k\fR and \fBuname\fR \fB-m\fR commands return equivalent
-values; however, the use of either of these commands by third party programs is
-discouraged, as is the use of the \fBarch\fR command in general. To determine
-the machine's Instruction Set Architecture (\fBISA\fR or processor type), use
-\fBuname\fR with the \fB-p\fR option.
+.El
+.Sh ENVIRONMENT VARIABLES
+See
+.Xr environ 5
+for descriptions of the following environment variables that affect the
+execution of
+.Nm :
+.Ev LANG , LC_ALL , LC_CTYPE , LC_MESSAGES ,
+and
+.Ev NLSPATH .
+.Sh INTERFACE STABILITY
+.Sy Standard
+.Sh SEE ALSO
+.Xr arch 1 ,
+.Xr isalist 1 ,
+.Xr sysinfo 2 ,
+.Xr uname 2 ,
+.Xr nodename 4 ,
+.Xr attributes 5 ,
+.Xr environ 5 ,
+.Xr standards 5
+.Sh NOTES
+Independent software vendors (ISVs) and others who need to determine detailed
+characteristics of the platform on which their software is either being
+installed or executed should use the
+.Nm
+command.
+.Pp
+To determine the operating system name and release level, use
+.Nm Fl sr .
+To determine only the operating system release level, use
+.Nm Fl r .
+Notice that operating system release levels are not guaranteed to be in
+.Em x.y
+format (such as 5.3, 5.4, 5.5, and so forth); but could be in the
+.Em x.y.z
+format (such as 5.5.1).
+.Pp
+In SunOS 4.x releases, the
+.Xr arch 1
+command was often used to obtain information similar to that obtained by using
+the
+.Nm
+command.
+The
+.Xr arch 1
+command output
+.Ql sun4
+was often incorrectly interpreted to signify a SunOS SPARC system.
+If hardware platform information is desired, use
+.Nm Fl sp .
+.Pp
+The
+.Nm arch Fl k
+and
+.Nm Fl m
+commands return equivalent values; however, the use of either of these commands
+by third party programs is discouraged, as is the use of the
+.Nm arch
+command in general.
+To determine the machine's Instruction Set Architecture (ISA or processor type),
+use
+.Nm
+with the
+.Fl p
+option.