sysconf: Simplify

This commit is contained in:
Sebastian Huber
2015-03-09 15:23:12 +01:00
parent 19799fb0f7
commit 8552df6514

View File

@@ -22,8 +22,7 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <rtems/score/todimpl.h> #include <rtems.h>
#include <rtems/system.h>
#include <rtems/seterr.h> #include <rtems/seterr.h>
#include <rtems/libio_.h> #include <rtems/libio_.h>
@@ -37,26 +36,22 @@ long sysconf(
int name int name
) )
{ {
if ( name == _SC_CLK_TCK ) switch ( name ) {
return (TOD_MICROSECONDS_PER_SECOND / case _SC_CLK_TCK:
rtems_configuration_get_microseconds_per_tick()); return (long) rtems_clock_get_ticks_per_second();
case _SC_OPEN_MAX:
if ( name == _SC_OPEN_MAX ) return rtems_libio_number_iops;
return rtems_libio_number_iops; case _SC_GETPW_R_SIZE_MAX:
return 1024;
if ( name == _SC_GETPW_R_SIZE_MAX ) case _SC_PAGESIZE:
return 1024; return PAGE_SIZE;
case _SC_SYMLOOP_MAX:
if ( name == _SC_PAGESIZE ) return RTEMS_FILESYSTEM_SYMLOOP_MAX;
return PAGE_SIZE;
if ( name == _SC_SYMLOOP_MAX )
return RTEMS_FILESYSTEM_SYMLOOP_MAX;
#if defined(__sparc__) #if defined(__sparc__)
if ( name == 515 ) /* Solaris _SC_STACK_PROT */ case 515: /* Solaris _SC_STACK_PROT */
return 0; return 0;
#endif #endif
default:
rtems_set_errno_and_return_minus_one( EINVAL ); rtems_set_errno_and_return_minus_one( EINVAL );
}
} }