Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <utsname.h>
Link against: libc.lib

uname(struct utsname *)

Interface status: externallyDefinedApi

IMPORT_C int uname(struct utsname *name);

Description

 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

Parameters

struct utsnameutsname *name

Return value

int

Upon successful completion, a non-negative value is returned. Otherwise, -1 is returned and errno is set to indicate the error.