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 Windows_NT.

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 2003            5       02
Windows Vista           6       00
Windows Server 2008     6       00
Windows 7               6       01
Windows Server 2008 R2  6       01
Windows 8               6       02
Windows Server 2012     6       02
Windows 8.1             6       03
Windows Server 2012 R2  6       03
Windows 10             10       00
Windows Server 2016    10       00
Windows Server 2019    10       00
Windows 11             10       00
Windows Server 2022    10       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

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


SEE ALSO


PTC MKS Toolkit 10.5 Documentation Build 40.