uname or unamex Subroutine

Purpose

Gets the name of the current operating system.

Library

Standard C Library (libc.a)

Syntax

#include <sys/utsname.h>
int uname ( Name)
struct utsname *Name;
int unamex ( Name)
struct xutsname *Name;

Description

The uname subroutine stores information identifying the current system in the structure pointed to by the Name parameter.

The uname subroutine uses the utsname structure, which is defined in the sys/utsname.h file, and contains the following members:
char   sysname[SYS_NMLN];
char   nodename[SYS_NMLN];
char   release[SYS_NMLN];
char   version[SYS_NMLN];
char   machine[SYS_NMLN];

The uname subroutine returns a null-terminated character string naming the current 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 system. The machine array identifies the system unit hardware being used. The utsname.machine field is not unique if the last two characters in the string are 4C. The character string returned by the uname -Mu command is unique for all systems and the character string returned by the uname -MuL command is unique for all partitions is all systems.

The unamex subroutine uses the xutsname structure, which is defined in the sys/utsname.h file, and contains the following members:
unsigned int   nid;
int   reserved;
unsigned long long   longnid;

The xutsname.nid field is the binary form of the utsname.machine field. The xutsname.nid field is not unique if the last two nibbles are 0x4C. The character string returned by the uname -Mu command is unique for all systems and the character string returned by the uname -MuL command is unique for all partitions in all systems. For local area networks in which a binary node name is appropriate, the xutsname.nid field contains such a name.

Release and version variable numbers returned by the uname and unamex subroutines may change when new BOS software levels are installed. This change affects applications using these values to access licensed programs. Machine variable changes are due to hardware fixes or upgrades.

Contact the appropriate support organization if your application is affected.

Parameters

Item Description
Name A pointer to the utsname or xutsname structure.

Return Values

Upon successful completion, the uname or unamex subroutine returns a nonnegative value. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.

Error Codes

The uname and unamex subroutines is unsuccessful if the following is true:

Item Description
EFAULT The Name parameter points outside of the process address space.