Bug #1956 » uname-o-illumos.diff
usr/src/cmd/uname/uname.c Wed Jan 04 15:55:32 2012 +0000 → usr/src/cmd/uname/uname.c Thu Jan 05 15:44:00 2012 +0000 | ||
---|---|---|
17 | 17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
18 | 18 |
* |
19 | 19 |
* CDDL HEADER END |
20 |
*/
|
|
21 |
/* |
|
20 |
* |
|
21 |
* Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved. |
|
22 | 22 |
* Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. |
23 | 23 |
*/ |
24 | 24 | |
... | ... | |
56 | 56 |
main(int argc, char *argv[], char *envp[]) |
57 | 57 |
{ |
58 | 58 |
char *nodename; |
59 |
char *optstring = "asnrpvmiS:X"; |
|
59 |
char *optstring = "asnrpvmioS:X";
|
|
60 | 60 |
int sflg = 0, nflg = 0, rflg = 0, vflg = 0, mflg = 0; |
61 |
int pflg = 0, iflg = 0, Sflg = 0; |
|
61 |
int pflg = 0, iflg = 0, oflg = 0, Sflg = 0;
|
|
62 | 62 |
int errflg = 0, optlet; |
63 | 63 |
int Xflg = 0; |
64 | 64 |
struct utsname unstr, *un; |
... | ... | |
82 | 82 |
sflg++; nflg++; rflg++; vflg++; mflg++; |
83 | 83 |
pflg++; |
84 | 84 |
iflg++; |
85 |
oflg++; |
|
85 | 86 |
break; |
86 | 87 |
case 's': |
87 | 88 |
sflg++; |
... | ... | |
104 | 105 |
case 'i': |
105 | 106 |
iflg++; |
106 | 107 |
break; |
108 |
case 'o': |
|
109 |
oflg++; |
|
110 |
break; |
|
107 | 111 |
case 'S': |
108 | 112 |
Sflg++; |
109 | 113 |
nodename = optarg; |
... | ... | |
120 | 124 |
usage(); |
121 | 125 | |
122 | 126 |
if ((Sflg > 1) || |
123 |
(Sflg && (sflg || nflg || rflg || vflg || mflg || pflg || iflg || |
|
127 |
(Sflg && (sflg || nflg || rflg || vflg || mflg || pflg || iflg || oflg ||
|
|
124 | 128 |
Xflg))) { |
125 | 129 |
usage(); |
126 | 130 |
} |
... | ... | |
148 | 152 |
/* |
149 | 153 |
* "uname -s" is the default |
150 | 154 |
*/ |
151 |
if (!(sflg || nflg || rflg || vflg || mflg || pflg || iflg || Xflg)) |
|
155 |
if (!(sflg || nflg || rflg || vflg || mflg || pflg || iflg || oflg || Xflg))
|
|
152 | 156 |
sflg++; |
153 | 157 |
if (sflg) { |
154 | 158 |
(void) fprintf(stdout, fs, sizeof (un->sysname), |
... | ... | |
189 | 193 |
(void) fprintf(stdout, fs, strlen(procbuf), procbuf); |
190 | 194 |
fs = fmt_string; |
191 | 195 |
} |
196 |
if (oflg) { |
|
197 |
if (sysinfo(SI_OSNAME, procbuf, sizeof (procbuf)) == -1) { |
|
198 |
(void) fprintf(stderr, gettext( |
|
199 |
"uname: sysinfo failed\n")); |
|
200 |
exit(1); |
|
201 |
} |
|
202 |
(void) fprintf(stdout, fs, strlen(procbuf), procbuf); |
|
203 |
fs = fmt_string; |
|
204 |
} |
|
192 | 205 |
if (Xflg) { |
193 | 206 |
int val; |
194 | 207 |
usr/src/man/man1/uname.1 Wed Jan 04 15:55:32 2012 +0000 → usr/src/man/man1/uname.1 Thu Jan 05 15:44:00 2012 +0000 | ||
---|---|---|
1 | 1 |
'\" te |
2 | 2 |
.\" Copyright 1989 AT&T |
3 |
.\" Copyright (c) 2012, Nexenta Systems, Inc. All Rights Reserved |
|
3 | 4 |
.\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved |
4 | 5 |
.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved |
5 | 6 |
.\" 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 | 58 |
.sp |
58 | 59 |
.ne 2 |
59 | 60 |
.na |
61 |
\fB\fB-o\fR\fR |
|
62 |
.ad |
|
63 |
.RS 18n |
|
64 |
Prints the name of the kernel/os. |
|
65 |
.RE |
|
66 | ||
67 |
.sp |
|
68 |
.ne 2 |
|
69 |
.na |
|
60 | 70 |
\fB\fB-m\fR\fR |
61 | 71 |
.ad |
62 | 72 |
.RS 18n |
usr/src/uts/common/sys/systeminfo.h Wed Jan 04 15:55:32 2012 +0000 → usr/src/uts/common/sys/systeminfo.h Thu Jan 05 15:44:00 2012 +0000 | ||
---|---|---|
17 | 17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
18 | 18 |
* |
19 | 19 |
* CDDL HEADER END |
20 |
*/
|
|
21 |
/* |
|
20 |
* |
|
21 |
* Copyright 2012 Nexenta Systems, Inc. All rights reserved. |
|
22 | 22 |
* Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
23 | 23 |
* Use is subject to license terms. |
24 | 24 |
*/ |
... | ... | |
86 | 86 |
#define SI_ARCHITECTURE_64 517 /* basic 64-bit SI_ARCHITECTURE */ |
87 | 87 |
#define SI_ARCHITECTURE_K 518 /* kernel SI_ARCHITECTURE equivalent */ |
88 | 88 |
#define SI_ARCHITECTURE_NATIVE 519 /* SI_ARCHITECTURE of the caller */ |
89 |
#define SI_OSNAME 520 /* return kernel/os name */ |
|
89 | 90 | |
90 | 91 |
/* Solaris defined `set' commands (769-1024) (none currently assigned) */ |
91 | 92 |
usr/src/uts/common/syscall/systeminfo.c Wed Jan 04 15:55:32 2012 +0000 → usr/src/uts/common/syscall/systeminfo.c Thu Jan 05 15:44:00 2012 +0000 | ||
---|---|---|
17 | 17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
18 | 18 |
* |
19 | 19 |
* CDDL HEADER END |
20 |
*/
|
|
21 |
/* |
|
20 |
* |
|
21 |
* Copyright 2012 Nexenta Systems, Inc. All rights reserved. |
|
22 | 22 |
* Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
23 | 23 |
* Use is subject to license terms. |
24 | 24 |
*/ |
... | ... | |
49 | 49 | |
50 | 50 |
static void get_netif_name(char *, char *); |
51 | 51 | |
52 |
#define OS_SYSTEM_NAME "Illumos" |
|
53 | ||
52 | 54 |
long |
53 | 55 |
systeminfo(int command, char *buf, long count) |
54 | 56 |
{ |
... | ... | |
118 | 120 |
case SI_ISALIST: |
119 | 121 |
kstr = isa_list; |
120 | 122 |
break; |
123 |
case SI_OSNAME: |
|
124 |
kstr = OS_SYSTEM_NAME; |
|
125 |
break; |
|
121 | 126 |
default: |
122 | 127 |
kstr = NULL; |
123 | 128 |
break; |