diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2010-08-24 05:51:51 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2010-08-24 05:51:51 +0000 |
commit | 823a26fc22a9bbe37910404598981985ce18ce4e (patch) | |
tree | aa3df92f8062781a55e244b40600c72456808f69 /cpukit/libcsupport | |
parent | 2010-08-23 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-823a26fc22a9bbe37910404598981985ce18ce4e.tar.bz2 |
2010-09-24 Ralf Corsépius <ralf.corsepius@rtems.org>
* libcsupport/include/sys/utsname.h: Remove times().
Remove unnecessary includes.
Introduce SYS_NMLN (From freebsd).
* libcsupport/src/utsname.c: Rework uname().
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r-- | cpukit/libcsupport/include/sys/utsname.h | 33 | ||||
-rw-r--r-- | cpukit/libcsupport/src/utsname.c | 16 |
2 files changed, 21 insertions, 28 deletions
diff --git a/cpukit/libcsupport/include/sys/utsname.h b/cpukit/libcsupport/include/sys/utsname.h index ebe2f52785..b1b2e6ef41 100644 --- a/cpukit/libcsupport/include/sys/utsname.h +++ b/cpukit/libcsupport/include/sys/utsname.h @@ -10,9 +10,6 @@ extern "C" { #endif -#include <sys/times.h> -#include <sys/types.h> - /* * 4.4.1 Get System Name (Table 4-1), P1003.1b-1993, p. 90 * @@ -22,14 +19,22 @@ extern "C" { * Internet hostnames. */ +#ifdef _KERNEL +#define SYS_NMLN 32 /* uname(2) for the FreeBSD 1.1 ABI. */ +#endif + +#ifndef SYS_NMLN +#define SYS_NMLN 32 /* User can override. */ +#endif + struct utsname { - char sysname[ 32 ]; /* Name of this implementation of the operating system */ - char nodename[ 32 ]; /* Name of this node within an implementation */ - /* specified communication network */ - char release[ 32 ]; /* Current release level of this implementation */ - char version[ 32 ]; /* Current version level of this release */ - char machine[ 32 ]; /* Name of the hardware type on which the system */ - /* is running */ + char sysname[SYS_NMLN]; /* Name of this implementation of the operating system */ + char nodename[SYS_NMLN]; /* Name of this node within an implementation */ + /* specified communication network */ + char release[SYS_NMLN]; /* Current release level of this implementation */ + char version[SYS_NMLN]; /* Current version level of this release */ + char machine[SYS_NMLN]; /* Name of the hardware type on which the system */ + /* is running */ }; /* @@ -40,14 +45,6 @@ int uname( struct utsname *name ); -/* - * 4.5.2 Get Process Times, P1003.1b-1993, p. 92 - */ - -clock_t times( - struct tms *buffer -); - #ifdef __cplusplus } #endif diff --git a/cpukit/libcsupport/src/utsname.c b/cpukit/libcsupport/src/utsname.c index d97284b3be..564a762942 100644 --- a/cpukit/libcsupport/src/utsname.c +++ b/cpukit/libcsupport/src/utsname.c @@ -8,15 +8,11 @@ #include <stdio.h> #include <string.h> - -#include <errno.h> #include <sys/utsname.h> - +#include <inttypes.h> #include <rtems/system.h> #include <rtems/score/object.h> -#include <inttypes.h> - #include <rtems/seterr.h> /*PAGE @@ -39,15 +35,15 @@ int uname( if ( !name ) rtems_set_errno_and_return_minus_one( EFAULT ); - strcpy( name->sysname, "RTEMS" ); + strncpy( name->sysname, "RTEMS", sizeof(name->sysname) ); - sprintf( name->nodename, "Node %" PRId16, _Objects_Local_node ); + snprintf( name->nodename, sizeof(name->nodename), "Node %" PRId16, _Objects_Local_node ); - strcpy( name->release, RTEMS_VERSION ); + strncpy( name->release, RTEMS_VERSION, sizeof(name->release) ); - strcpy( name->version, "" ); + strncpy( name->version, "", sizeof(name->version) ); - sprintf( name->machine, "%s/%s", CPU_NAME, CPU_MODEL_NAME ); + snprintf( name->machine, sizeof(name->machine), "%s/%s", CPU_NAME, CPU_MODEL_NAME ); return 0; } |