uname()

get operating system information 

Function


SYNOPSIS

#include <sys/utsname.h>

int uname(struct utsname *name);


DESCRIPTION

The uname() function stores information that identifies the current operating system in the structure that name points to.

uname() uses the structure utsname defined in <sys/utsname.h>. uname() returns a null-terminated character string that names the current operating system in the character array sysname. The member nodename contains the name that the system is known by on the network. The members release and version further identify the operating system. The member machine is the standard name that identifies the name of the hardware type that the system runs on.


PARAMETERS

name 

Points to the structure where the uname() function stores information that identifies the current operating system. This structure contains the following fields:

sysname 

contains either Windows (for Windows 95/98/Me systems) or Windows_NT (for Windows NT/2000/XP/2003/Vista/7/2008 systems).

nodename 

contains the machine name.

release 

contains the minor version number.

version 

contains the major version number.

machine 

contains the machine type (for example, Pentium).

You can use the major and minor version numbers, from the version and release fields, to determine precisely which version of Windows is running on the machine:

                Major   Minor
Windows 95        4       00
Windows 98        4       10
Windows ME        4       90

Windows NT        4       00
Windows 2000      5       00
Windows XP        5       01
Windows 2003      5       02
Windows Vista     6       00


RETURN VALUES

If successful, uname() returns a nonnegative value. On failure, uname() returns -1 and sets errno to one of the following values:

EFAULT 

name is an invalid pointer.


CONFORMANCE

POSIX.1 (1996).


MULTITHREAD SAFETY LEVEL

Async-signal-safe.


PORTING ISSUES

None.


AVAILABILITY

MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO


MKS Toolkit 9.3 Documentation Build 6.