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

NAME

6       uname - get the name of the current system
7

SYNOPSIS

9       #include <sys/utsname.h>
10
11       int uname(struct utsname *name);
12
13

DESCRIPTION

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

RETURN VALUE

31       Upon successful completion, a non-negative  value  shall  be  returned.
32       Otherwise, -1 shall be returned and errno set to indicate the error.
33

ERRORS

35       No errors are defined.
36
37       The following sections are informative.
38

EXAMPLES

40       None.
41

APPLICATION USAGE

43       The  inclusion  of the nodename member in this structure does not imply
44       that it is sufficient information  for  interfacing  to  communications
45       networks.
46

RATIONALE

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

FUTURE DIRECTIONS

71       None.
72

SEE ALSO

74       The Base Definitions volume of IEEE Std 1003.1-2001, <sys/utsname.h>
75
77       Portions  of  this text are reprinted and reproduced in electronic form
78       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
79       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
80       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
81       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
82       event of any discrepancy between this version and the original IEEE and
83       The  Open Group Standard, the original IEEE and The Open Group Standard
84       is the referee document. The original Standard can be  obtained  online
85       at http://www.opengroup.org/unix/online.html .
86
87
88
89IEEE/The Open Group                  2003                             UNAME(P)
Impressum