uname() example

Joel Sherrill <joel@OARcorp.com> joel.sherrill at OARcorp.com
Wed Jan 21 21:15:58 UTC 2004


psx01 has a an example of using it.  Cutting and pasting, it looks
like this:

#include <sys/utsname.h>
#include <stdio.h>

void dump_uname(void)
{
   struct utsname  uts;

   uname( &uts );
   printf( "Init: uts.sysname: %s\n", uts.sysname );
   printf( "Init: uts.nodename: %s\n", uts.nodename );
   printf( "Init: uts.release: %s\n", uts.release );
   printf( "Init: uts.version: %s\n", uts.version );
   printf( "Init: uts.machine: %s\n", uts.machine );
   puts("");
}

sysname is always RTEMS
nodename is always 1 in a single CPU system
release is of the form rtems-VERSION
machine is of the form: CPU/CPU Model
   CPU is the CPU family
   CPU Model will usually reflect the multilib variant

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985





More information about the users mailing list