The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


uname - get name of current system


#include <sys/utsname.h>

int uname(struct utsname *name);


The uname() function stores information identifying the current system in the structure pointed to by name.

The uname() function uses the utsname structure defined in <sys/utsname.h>.

The uname() function returns a string naming the current system in the character array sysname. Similarly, nodename contains the name that the system is known by on a communications network. The arrays release and version further identify the operating system. The array machine contains a name that identifies the hardware that the system is running on.

The format of each member is implementation-dependent.


Upon successful completion, a non-negative value is returned. Otherwise, -1 is returned and errno is set to indicate the error.


No errors are defined.




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






Derived from Issue 1 of the SVID.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]