1UNAME(3P) POSIX Programmer's Manual UNAME(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 uname — get the name of the current system
14
16 #include <sys/utsname.h>
17
18 int uname(struct utsname *name);
19
21 The uname() function shall store information identifying the current
22 system in the structure pointed to by name.
23
24 The uname() function uses the utsname structure defined in
25 <sys/utsname.h>.
26
27 The uname() function shall return a string naming the current system in
28 the character array sysname. Similarly, nodename shall contain the
29 name of this node within an implementation-defined communications net‐
30 work. The arrays release and version shall further identify the operat‐
31 ing system. The array machine shall contain a name that identifies the
32 hardware that the system is running on.
33
34 The format of each member is implementation-defined.
35
37 Upon successful completion, a non-negative value shall be returned.
38 Otherwise, −1 shall be returned and errno set to indicate the error.
39
41 No errors are defined.
42
43 The following sections are informative.
44
46 None.
47
49 The inclusion of the nodename member in this structure does not imply
50 that it is sufficient information for interfacing to communications
51 networks.
52
54 The values of the structure members are not constrained to have any
55 relation to the version of this volume of POSIX.1‐2008 implemented in
56 the operating system. An application should instead depend on
57 _POSIX_VERSION and related constants defined in <unistd.h>.
58
59 This volume of POSIX.1‐2008 does not define the sizes of the members of
60 the structure and permits them to be of different sizes, although most
61 implementations define them all to be the same size: eight bytes plus
62 one byte for the string terminator. That size for nodename is not
63 enough for use with many networks.
64
65 The uname() function originated in System III, System V, and related
66 implementations, and it does not exist in Version 7 or 4.3 BSD. The
67 values it returns are set at system compile time in those historical
68 implementations.
69
70 4.3 BSD has gethostname() and gethostid(), which return a symbolic name
71 and a numeric value, respectively. There are related sethostname() and
72 sethostid() functions that are used to set the values the other two
73 functions return. The former functions are included in this specifica‐
74 tion, the latter are not.
75
77 None.
78
80 The Base Definitions volume of POSIX.1‐2008, <sys_utsname.h>
81
83 Portions of this text are reprinted and reproduced in electronic form
84 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
85 -- Portable Operating System Interface (POSIX), The Open Group Base
86 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
87 cal and Electronics Engineers, Inc and The Open Group. (This is
88 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
89 event of any discrepancy between this version and the original IEEE and
90 The Open Group Standard, the original IEEE and The Open Group Standard
91 is the referee document. The original Standard can be obtained online
92 at http://www.unix.org/online.html .
93
94 Any typographical or formatting errors that appear in this page are
95 most likely to have been introduced during the conversion of the source
96 files to man page format. To report such errors, see https://www.ker‐
97 nel.org/doc/man-pages/reporting_bugs.html .
98
99
100
101IEEE/The Open Group 2013 UNAME(3P)