utsname.h File Reference

SYS_NMLN

uname ( struct utsname * )

IMPORT_C intuname(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.

Examples:
#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
Return Value
Upon successful completion, a non-negative value is returned. Otherwise, -1 is returned and errno is set to indicate the error.