![]() Chapter Contents |
![]() Previous |
![]() Next |
| uname |
| Portability: | POSIX.1 conforming, UNIX compatible |
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| EXAMPLE | |
| RELATED FUNCTIONS |
| 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;
char *nodename;
char *release;
char *version;
char *machine;
| 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 <systypes.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 |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.