IMPORT_C int | uname | ( | struct utsname * | name | ) |
sysname Name of the operating system implementation. nodename Network name of this machine. release Release level of the operating system. version Version level of the operating system. machine Machine hardware platform.The uname function stores NULL -terminated strings of information identifying the current system into the structure referenced by name .
The utsname structure is defined in the #include <sys/utsname.h> header file, and contains the following members: sysname Name of the operating system implementation. nodename Network name of this machine. release Release level of the operating system. version Version level of the operating system. machine Machine hardware platform.
#include <sys/utsname.h> #include<stdio.h> int test_uname() { int retVal; struct utsname name ; retVal = uname( &name; ); if( !retVal ) { printf("Sysname: %s Nodename:%s Release: %s Version: %s Machine:%s "); printf("uname passed"); return 0; } else { printf("failed"); return -1; } }Output
Sysname: Symbian Nodename: localhost Release: Version: 2:0:1055 Machine: uname passed