uname -- Display Current Operating System Name

SYNOPSIS

 #include <sys/utsname.h>

 int uname(struct utsname *sysInfo);
 

DESCRIPTION

uname stores information about the operating system you are running under in a structure at the location pointed to by sysInfo. The utsname structure is declared in <sys/utsname.h> and has the following elements:
char *sysname;
points to the name of the operating system implementation.
char *nodename;
points to the node name within a communications network for the specific implementation.
char *release;
points to the current release level for the implementation.
char *version;
points to the current version number for the release.
char *machine;
points to the name of the machine on which the operating system is running.

RETURN VALUE

uname returns a nonnegative value if successful and a -1 if unsuccessful.

EXAMPLE

The following example illustrates the use of uname to determine information about the operating system:
  #include <sys/types.h>
  #include <sys/utsname.h>
  #include <stdio.h>

  main()
  {
     struct utsname sysInfo;

     if (uname(&sysInfo) != -1) {
        puts(sysInfo.sysname);
        puts(sysInfo.nodename);
        puts(sysInfo.release);
        puts(sysInfo.version);
        puts(sysInfo.machine);
     }
     else
        perror("uname() error");
  }

 

RELATED FUNCTIONS

sysname, syslevel


Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.