[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 2

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 unamex subroutine uses the xutsname structure, which is defined in the sys/utsname.h file, and contains the following members:

unsigned long   nid;
long   reserved[3];

The xutsname.nid field is the binary form of the utsname.machine field. 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

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:

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

Related Information

The uname command.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]