source: rtems/testsuites/psxtests/psxsysconf/init.c @ 105530fe

4.104.115
Last change on this file since 105530fe was 105530fe, checked in by Joel Sherrill <joel.sherrill@…>, on 09/20/09 at 17:03:18

2009-09-20 Joel Sherrill <joel.sherrill@…>

  • psxsysconf/init.c, psxsysconf/psxsysconf.scn: Add test for getpagesize().
  • Property mode set to 100644
File size: 1.9 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  puts( "sysconf -- bad configuration parameter - too large" );
33  sc = sysconf( LONG_MAX );
34  fatal_posix_service_status_errno( sc, EINVAL, "bad conf name" );
35 
36  sc = sysconf( _SC_CLK_TCK );
37  printf( "sysconf - _SC_CLK_TCK=%d\n", sc );
38  if ( sc == -1 )
39   rtems_test_exit(0);
40
41  sc = sysconf( _SC_OPEN_MAX );
42  printf( "sysconf - _SC_OPEN_MAX=%d\n", sc );
43  if ( sc == -1 )
44   rtems_test_exit(0);
45
46  sc = sysconf( _SC_GETPW_R_SIZE_MAX );
47  printf( "sysconf - _SC_GETPW_R_SIZE_MAX=%d\n", sc );
48  if ( sc == -1 )
49   rtems_test_exit(0);
50
51  sc = sysconf( _SC_PAGESIZE );
52  printf( "sysconf - _SC_PAGESIZE=%d\n", sc );
53  if ( sc == -1 )
54   rtems_test_exit(0);
55
56  sc = getpagesize();
57  printf( "getpagesize = %d\n", sc );
58  if ( sc == -1 )
59   rtems_test_exit(0);
60
61  sc = sysconf( 0x12345678 );
62  printf( "sysconf - bad parameter = %d errno=%s\n", sc, strerror(errno) );
63  if ( (sc != -1) || (errno != EINVAL) )
64   rtems_test_exit(0);
65
66#if defined(__sparc__)
67  /* Solaris _SC_STACK_PROT - 515 */
68  sc = sysconf( _SC_PAGESIZE );
69  printf( "sysconf - (SPARC only) _SC_STACK_PROT=%d\n", sc );
70  if ( sc == -1 )
71   rtems_test_exit(0);
72#endif
73
74  puts( "*** END OF POSIX TEST SYSCONF ***" );
75  rtems_test_exit( 0 );
76
77  return NULL; /* just so the compiler thinks we returned something */
78}
Note: See TracBrowser for help on using the repository browser.