Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/u/uname.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/u/uname.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/u/uname.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/u/uname.html on line 8
Get information about the operating system
#include <sys/utsname.h>
int uname( struct utsname * name );
- name
- A pointer to a utsname where the function can store the
information; see below.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The uname() function stores information about the current operating system
in the structure pointed to by the argument name.
The system name structure, utsname, is defined in <sys/utsname.h>,
and contains at least the following structure members:
- char* sysname
- The name of the OS.
- char* nodename
- The name of this node.
- char* release
- The current release level.
- char* version
- The current version level.
- char* machine
- The hardware type.
Each of these items is a null-terminated character array.
- 0
- Success.
- -1
- An error occurred
(errno is set).
/*
* The following program prints some information about the
* system it's running on.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/utsname.h>
int main( void )
{
struct utsname sysinfo;
if( uname( &sysinfo ) == -1 ) {
perror( "uname" );
return EXIT_FAILURE;
}
printf( "system name : %s\n", sysinfo.sysname );
printf( "node name : %s\n", sysinfo.nodename );
printf( "release name : %s\n", sysinfo.release );
printf( "version name : %s\n", sysinfo.version );
return EXIT_SUCCESS;
}
POSIX 1003.1
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
errno
uname
in the Utilities Reference
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/u/uname.html on line 185
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/u/uname.html on line 185