uname(2) CLIX uname(2)
NAME
uname - Gets the name of the current system
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <sys/utsname.h>
int uname(
struct utsname *name );
PARAMETERS
name Points to the utsname structure.
DESCRIPTION
The uname() function stores information identifying the current system in
the structure pointed to by the name parameter.
The uname() function uses the utsname structure, which is defined in the
<sys/utsname.h> file and contains the following members:
char sysname[9];
char nodename[9];
char release[9];
char version[9];
char machine[9];
The uname() function returns a null-terminated character string naming the
current UNIX system in the sysname character array. The nodename array
contains the name that the system is known by on a communications network.
The release and version arrays further identify the operating system. The
machine array identifies the CPU hardware being used.
EXAMPLES
To fetch and display the name of the currently running system:
struct utsname unix_info;
if (uname(&unix_info) == -1) {
perror("uname failed");
return(-1);
}
printf("UNIX system name is %s\n", &unix_info.sysname[0]);
2/94 - Intergraph Corporation 1
uname(2) CLIX uname(2)
RETURN VALUES
Upon successful completion, a non-negative value is returned. If uname()
fails, -1 is returned and the global variable errno is set to indicate the
error.
ERRORS
The uname() function fails if the following is true:
[EFAULT] The name parameter points outside of the process address space.
RELATED INFORMATION
Commands: uname(1)
2 Intergraph Corporation - 2/94