1UNAME(3P)                  POSIX Programmer's Manual                 UNAME(3P)
2
3
4

PROLOG

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

NAME

12       uname — get the name of the current system
13

SYNOPSIS

15       #include <sys/utsname.h>
16
17       int uname(struct utsname *name);
18

DESCRIPTION

20       The uname() function shall store information  identifying  the  current
21       system in the structure pointed to by name.
22
23       The   uname()   function   uses   the   utsname  structure  defined  in
24       <sys/utsname.h>.
25
26       The uname() function shall return a string naming the current system in
27       the  character  array  sysname.   Similarly, nodename shall contain the
28       name of this node within an implementation-defined communications  net‐
29       work. The arrays release and version shall further identify the operat‐
30       ing system. The array machine shall contain a name that identifies  the
31       hardware that the system is running on.
32
33       The format of each member is implementation-defined.
34

RETURN VALUE

36       Upon  successful  completion,  a  non-negative value shall be returned.
37       Otherwise, -1 shall be returned and errno set to indicate the error.
38

ERRORS

40       No errors are defined.
41
42       The following sections are informative.
43

EXAMPLES

45       None.
46

APPLICATION USAGE

48       The inclusion of the nodename member in this structure does  not  imply
49       that  it  is  sufficient  information for interfacing to communications
50       networks.
51

RATIONALE

53       The values of the structure members are not  constrained  to  have  any
54       relation  to  the version of this volume of POSIX.1‐2017 implemented in
55       the  operating  system.  An  application  should  instead   depend   on
56       _POSIX_VERSION and related constants defined in <unistd.h>.
57
58       This volume of POSIX.1‐2017 does not define the sizes of the members of
59       the structure and permits them to be of different sizes, although  most
60       implementations  define  them all to be the same size: eight bytes plus
61       one byte for the string terminator.  That  size  for  nodename  is  not
62       enough for use with many networks.
63
64       The  uname()  function  originated in System III, System V, and related
65       implementations, and it does not exist in Version 7  or  4.3  BSD.  The
66       values  it  returns  are set at system compile time in those historical
67       implementations.
68
69       4.3 BSD has gethostname() and gethostid(), which return a symbolic name
70       and  a numeric value, respectively. There are related sethostname() and
71       sethostid() functions that are used to set the  values  the  other  two
72       functions  return. The former functions are included in this specifica‐
73       tion, the latter are not.
74

FUTURE DIRECTIONS

76       None.
77

SEE ALSO

79       The Base Definitions volume of POSIX.1‐2017, <sys_utsname.h>
80
82       Portions of this text are reprinted and reproduced in  electronic  form
83       from  IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
84       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
85       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
86       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
87       event of any discrepancy between this version and the original IEEE and
88       The Open Group Standard, the original IEEE and The Open Group  Standard
89       is  the  referee document. The original Standard can be obtained online
90       at http://www.opengroup.org/unix/online.html .
91
92       Any typographical or formatting errors that appear  in  this  page  are
93       most likely to have been introduced during the conversion of the source
94       files to man page format. To report such errors,  see  https://www.ker
95       nel.org/doc/man-pages/reporting_bugs.html .
96
97
98
99IEEE/The Open Group                  2017                            UNAME(3P)
Impressum