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

4.104.115
Last change on this file since dc4fbb8 was dc4fbb8, checked in by Ralf Corsepius <ralf.corsepius@…>, on 10/29/09 at 05:45:49

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
Line 
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" );
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 */
37  puts( "sysconf -- bad configuration parameter - too large" );
38  sc = sysconf( LONG_MAX );
39  fatal_posix_service_status_errno( sc, EINVAL, "bad conf name" );
40#endif
41
42  sc = sysconf( _SC_CLK_TCK );
43  printf( "sysconf - _SC_CLK_TCK=%ld\n", sc );
44  if ( sc == -1 )
45   rtems_test_exit(0);
46
47  sc = sysconf( _SC_OPEN_MAX );
48  printf( "sysconf - _SC_OPEN_MAX=%ld\n", sc );
49  if ( sc == -1 )
50   rtems_test_exit(0);
51
52  sc = sysconf( _SC_GETPW_R_SIZE_MAX );
53  printf( "sysconf - _SC_GETPW_R_SIZE_MAX=%ld\n", sc );
54  if ( sc == -1 )
55   rtems_test_exit(0);
56
57  sc = sysconf( _SC_PAGESIZE );
58  printf( "sysconf - _SC_PAGESIZE=%ld\n", sc );
59  if ( sc == -1 )
60   rtems_test_exit(0);
61
62  sc = getpagesize();
63  printf( "getpagesize = %ld\n", sc );
64  if ( sc == -1 )
65   rtems_test_exit(0);
66
67  sc = sysconf( INT_MAX );
68  printf( "sysconf - bad parameter = %ld errno=%s\n", sc, strerror(errno) );
69  if ( (sc != -1) || (errno != EINVAL) )
70   rtems_test_exit(0);
71
72#if defined(__sparc__)
73  /* Solaris _SC_STACK_PROT - 515 */
74  sc = sysconf( _SC_PAGESIZE );
75  printf( "sysconf - (SPARC only) _SC_STACK_PROT=%ld\n", sc );
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.