Commit | Line | Data |
---|---|---|
49124039 JH |
1 | .\" Copyright (c) 1983, 1991 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" Redistribution and use in source and binary forms, with or without | |
5 | .\" modification, are permitted provided that the following conditions | |
6 | .\" are met: | |
7 | .\" 1. Redistributions of source code must retain the above copyright | |
8 | .\" notice, this list of conditions and the following disclaimer. | |
9 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer in the | |
11 | .\" documentation and/or other materials provided with the distribution. | |
12 | .\" 3. All advertising materials mentioning features or use of this software | |
13 | .\" must display the following acknowledgement: | |
14 | .\" This product includes software developed by the University of | |
15 | .\" California, Berkeley and its contributors. | |
16 | .\" 4. Neither the name of the University nor the names of its contributors | |
17 | .\" may be used to endorse or promote products derived from this software | |
18 | .\" without specific prior written permission. | |
19 | .\" | |
20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | .\" SUCH DAMAGE. | |
31 | .\" | |
32 | .\" from: @(#)uname.2 6.6 (Berkeley) 3/10/91 | |
326e0c26 | 33 | .\" $Id: uname.2,v 1.1 1993/10/08 01:06:55 jkh Exp $ |
49124039 JH |
34 | .\" |
35 | .Dd March 29, 1993 | |
36 | .Dt UNAME 2 | |
37 | .Os Posix | |
38 | .Sh NAME | |
39 | .Nm uname | |
40 | .Nd get host information | |
41 | .Sh SYNOPSIS | |
42 | .Fd #include <sys/utsname.h> | |
43 | .Ft int | |
44 | .Fn uname "struct utsname *name" | |
45 | .Sh DESCRIPTION | |
326e0c26 GW |
46 | The |
47 | .Fn uname | |
48 | function | |
49 | returns the information identifying the current operating system | |
49124039 JH |
50 | in the structure pointed to by |
51 | .Fa name. | |
52 | .Pp | |
53 | .Fn Uname | |
54 | uses the structure defined in | |
55 | .Aq Pa sys/utsname.h | |
56 | whose members are: | |
57 | .Bd -literal | |
58 | struct utsname { | |
59 | char sysname[SYS_NMLN]; | |
60 | char nodename[SYS_NMLN]; | |
61 | char release[SYS_NMLN]; | |
62 | char version[SYS_NMLN]; | |
63 | char machine[SYS_NMLN]; | |
64 | }; | |
65 | .Ed | |
66 | .Pp | |
326e0c26 GW |
67 | The |
68 | .Fn uname | |
69 | function | |
49124039 | 70 | returns a null-terminated character string naming the |
326e0c26 | 71 | current operating system in the character array |
49124039 JH |
72 | .Fa sysname . |
73 | Similarly, | |
74 | .Fa nodename | |
75 | contains the name that the system is known by on a | |
76 | communication network. | |
326e0c26 GW |
77 | The |
78 | .Fa release | |
49124039 JH |
79 | and |
80 | .Fa version | |
326e0c26 | 81 | fields |
49124039 | 82 | further identify the operating system. |
326e0c26 GW |
83 | The |
84 | .Fa machine | |
85 | field | |
49124039 | 86 | contains the standard name that identifies the hardware |
326e0c26 | 87 | that the operating system is running on. |
49124039 JH |
88 | .Sn ERRORS |
89 | .Bl -tag -width ENAMETOOLONGAA | |
90 | .It Bq Er EFAULT | |
326e0c26 GW |
91 | The |
92 | .Fn uname | |
93 | function | |
49124039 JH |
94 | will fail if |
95 | .Fa name | |
96 | points to an invalid address. | |
97 | .Sh RETURN VALUE | |
98 | Upon successful completion a value of 0 is returned. | |
99 | Otherwise, a value of -1 is returned and | |
100 | .Va errno | |
101 | is set to indicate the error. | |
102 | .Sh SEE ALSO | |
103 | .Xr hostname 1 , | |
104 | .Xr machine 1 , | |
105 | .Xr gethostname 2 | |
106 | .Sh HISTORY | |
107 | The | |
108 | .Nm uname | |
109 | function call appeared in | |
326e0c26 | 110 | .At V.2 . |