diff -r b8a5b26dc8aa usr/src/cmd/uname/uname.c --- a/usr/src/cmd/uname/uname.c Wed Jan 04 15:55:32 2012 +0000 +++ b/usr/src/cmd/uname/uname.c Thu Jan 05 15:44:00 2012 +0000 @@ -17,8 +17,8 @@ * 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. */ @@ -56,9 +56,9 @@ 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; @@ -82,6 +82,7 @@ sflg++; nflg++; rflg++; vflg++; mflg++; pflg++; iflg++; + oflg++; break; case 's': sflg++; @@ -104,6 +105,9 @@ case 'i': iflg++; break; + case 'o': + oflg++; + break; case 'S': Sflg++; nodename = optarg; @@ -120,7 +124,7 @@ usage(); if ((Sflg > 1) || - (Sflg && (sflg || nflg || rflg || vflg || mflg || pflg || iflg || + (Sflg && (sflg || nflg || rflg || vflg || mflg || pflg || iflg || oflg || Xflg))) { usage(); } @@ -148,7 +152,7 @@ /* * "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 +193,15 @@ (void) fprintf(stdout, fs, strlen(procbuf), procbuf); fs = fmt_string; } + if (oflg) { + if (sysinfo(SI_OSNAME, procbuf, sizeof (procbuf)) == -1) { + (void) fprintf(stderr, gettext( + "uname: sysinfo failed\n")); + exit(1); + } + (void) fprintf(stdout, fs, strlen(procbuf), procbuf); + fs = fmt_string; + } if (Xflg) { int val; diff -r b8a5b26dc8aa usr/src/man/man1/uname.1 --- a/usr/src/man/man1/uname.1 Wed Jan 04 15:55:32 2012 +0000 +++ b/usr/src/man/man1/uname.1 Thu Jan 05 15:44:00 2012 +0000 @@ -1,5 +1,6 @@ '\" te .\" Copyright 1989 AT&T +.\" Copyright (c) 2012, Nexenta Systems, Inc. All Rights Reserved .\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at @@ -57,6 +58,15 @@ .sp .ne 2 .na +\fB\fB-o\fR\fR +.ad +.RS 18n +Prints the name of the kernel/os. +.RE + +.sp +.ne 2 +.na \fB\fB-m\fR\fR .ad .RS 18n diff -r b8a5b26dc8aa usr/src/uts/common/sys/systeminfo.h --- a/usr/src/uts/common/sys/systeminfo.h Wed Jan 04 15:55:32 2012 +0000 +++ b/usr/src/uts/common/sys/systeminfo.h Thu Jan 05 15:44:00 2012 +0000 @@ -17,8 +17,8 @@ * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END - */ -/* + * + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -86,6 +86,7 @@ #define SI_ARCHITECTURE_64 517 /* basic 64-bit SI_ARCHITECTURE */ #define SI_ARCHITECTURE_K 518 /* kernel SI_ARCHITECTURE equivalent */ #define SI_ARCHITECTURE_NATIVE 519 /* SI_ARCHITECTURE of the caller */ +#define SI_OSNAME 520 /* return kernel/os name */ /* Solaris defined `set' commands (769-1024) (none currently assigned) */ diff -r b8a5b26dc8aa usr/src/uts/common/syscall/systeminfo.c --- a/usr/src/uts/common/syscall/systeminfo.c Wed Jan 04 15:55:32 2012 +0000 +++ b/usr/src/uts/common/syscall/systeminfo.c Thu Jan 05 15:44:00 2012 +0000 @@ -17,8 +17,8 @@ * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END - */ -/* + * + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -49,6 +49,8 @@ static void get_netif_name(char *, char *); +#define OS_SYSTEM_NAME "Illumos" + long systeminfo(int command, char *buf, long count) { @@ -118,6 +120,9 @@ case SI_ISALIST: kstr = isa_list; break; + case SI_OSNAME: + kstr = OS_SYSTEM_NAME; + break; default: kstr = NULL; break;