source: rtems/testsuites/psxtests/psxsysconf/init.c @ dc4fbb8

4.104.11
Last change on this file since dc4fbb8 was dc4fbb8, checked in by Ralf Corsepius <ralf.corsepius@…>, on Oct 29, 2009 at 5:45:49 AM

Comment out sysconf(LONG_MAX) check (not useful).
Change sysconf(0x12345678) check into sysconf(INT_MAX) for better
16bit compliance.

  • Property mode set to 100644
File size: 2.1 KB
RevLine 
[901a913]1/*
2 *  COPYRIGHT (c) 1989-2007.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#define CONFIGURE_INIT
13#include "system.h"
14#include "tmacros.h"
15
16#include <unistd.h>
17#include <stdint.h>
18#include <errno.h>
19
20void *POSIX_Init(
21  void *argument
22)
23{
24  long  sc;
25
26  puts( "\n\n*** POSIX TEST -- SYSCONF ***" );
27
28  puts( "sysconf -- bad configuration parameter - negative" );
29  sc = sysconf( -1 );
30  fatal_posix_service_status_errno( sc, EINVAL, "bad conf name" );
[dc4fbb8]31
32#if UNUSED 
33/* FIXME: This test doesn't make sense.
34 * On targets with sizeof(int) < sizeof(long), compilation will fail,
35 * On targets with sizeof(int) == sizeof(long) the call is valid.
36 */
[901a913]37  puts( "sysconf -- bad configuration parameter - too large" );
38  sc = sysconf( LONG_MAX );
39  fatal_posix_service_status_errno( sc, EINVAL, "bad conf name" );
[dc4fbb8]40#endif
41
[901a913]42  sc = sysconf( _SC_CLK_TCK );
[17c7533]43  printf( "sysconf - _SC_CLK_TCK=%ld\n", sc );
[901a913]44  if ( sc == -1 )
45   rtems_test_exit(0);
46
47  sc = sysconf( _SC_OPEN_MAX );
[17c7533]48  printf( "sysconf - _SC_OPEN_MAX=%ld\n", sc );
[901a913]49  if ( sc == -1 )
50   rtems_test_exit(0);
51
52  sc = sysconf( _SC_GETPW_R_SIZE_MAX );
[17c7533]53  printf( "sysconf - _SC_GETPW_R_SIZE_MAX=%ld\n", sc );
[901a913]54  if ( sc == -1 )
55   rtems_test_exit(0);
56
57  sc = sysconf( _SC_PAGESIZE );
[17c7533]58  printf( "sysconf - _SC_PAGESIZE=%ld\n", sc );
[901a913]59  if ( sc == -1 )
60   rtems_test_exit(0);
61
[105530fe]62  sc = getpagesize();
[17c7533]63  printf( "getpagesize = %ld\n", sc );
[105530fe]64  if ( sc == -1 )
65   rtems_test_exit(0);
66
[dc4fbb8]67  sc = sysconf( INT_MAX );
[17c7533]68  printf( "sysconf - bad parameter = %ld errno=%s\n", sc, strerror(errno) );
[760076d7]69  if ( (sc != -1) || (errno != EINVAL) )
70   rtems_test_exit(0);
71
[901a913]72#if defined(__sparc__)
73  /* Solaris _SC_STACK_PROT - 515 */
74  sc = sysconf( _SC_PAGESIZE );
[17c7533]75  printf( "sysconf - (SPARC only) _SC_STACK_PROT=%ld\n", sc );
[901a913]76  if ( sc == -1 )
77   rtems_test_exit(0);
78#endif
79
80  puts( "*** END OF POSIX TEST SYSCONF ***" );
81  rtems_test_exit( 0 );
82
83  return NULL; /* just so the compiler thinks we returned something */
84}
Note: See TracBrowser for help on using the repository browser.