Home | History | Annotate | Download | only in other
      1 /*
      2  * Copyright (C) 2008 The Android Open Source Project
      3  * All rights reserved.
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions
      7  * are met:
      8  *  * Redistributions of source code must retain the above copyright
      9  *    notice, this list of conditions and the following disclaimer.
     10  *  * Redistributions in binary form must reproduce the above copyright
     11  *    notice, this list of conditions and the following disclaimer in
     12  *    the documentation and/or other materials provided with the
     13  *    distribution.
     14  *
     15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     18  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
     19  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
     22  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     25  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  * SUCH DAMAGE.
     27  */
     28 #include <unistd.h>
     29 #include <errno.h>
     30 #include <stdio.h>
     31 #include <string.h>
     32 
     33 #define  T(_name,_cond)                                               \
     34     errno = 0;                                                        \
     35     printf( "testing %-*s : ", 32, #_name );                          \
     36     ret   = sysconf( _name );                                         \
     37     if (ret < 0 && errno != 0) {                                      \
     38         printf( "error: %s\n", strerror(errno) );                     \
     39     } else {                                                          \
     40         if ( ret _cond )  {                                           \
     41             printf( "OK  (%d)\n", ret );                              \
     42         } else {                                                      \
     43             printf( "ERROR: %d does not meet %s\n", ret, #_cond );    \
     44         }                                                             \
     45     }
     46 
     47 int  main( void )
     48 {
     49     int  ret;
     50     T(_SC_ARG_MAX, > 0);
     51     T(_SC_BC_BASE_MAX, |1 );
     52     T(_SC_BC_DIM_MAX, |1 );
     53     T(_SC_BC_SCALE_MAX, |1 );
     54     T(_SC_BC_STRING_MAX, |1 );
     55     T(_SC_CHILD_MAX, >0 );
     56     T(_SC_CLK_TCK, >0 );
     57     T(_SC_COLL_WEIGHTS_MAX, |1 );
     58     T(_SC_EXPR_NEST_MAX, |1 );
     59     T(_SC_LINE_MAX, > 256 );
     60     T(_SC_NGROUPS_MAX, >0 );
     61     T(_SC_OPEN_MAX, >128 );
     62     T(_SC_PASS_MAX, |1 );
     63     T(_SC_2_C_BIND, >0 );
     64     T(_SC_2_C_DEV, |1 );
     65     T(_SC_2_C_VERSION, |1 );
     66     T(_SC_2_CHAR_TERM, |1 );
     67     T(_SC_2_FORT_DEV, |1 );
     68     T(_SC_2_FORT_RUN, |1 );
     69     T(_SC_2_LOCALEDEF, |1 );
     70     T(_SC_2_SW_DEV, |1 );
     71     T(_SC_2_UPE, |1 );
     72     T(_SC_2_VERSION, |1);
     73     T(_SC_JOB_CONTROL, == 1);
     74     T(_SC_SAVED_IDS, == 1);
     75     T(_SC_VERSION, |1);
     76     T(_SC_RE_DUP_MAX, |1);
     77     T(_SC_STREAM_MAX, > 0);
     78     T(_SC_TZNAME_MAX, |1 );
     79     T(_SC_XOPEN_CRYPT, |1 );
     80     T(_SC_XOPEN_ENH_I18N, |1 );
     81     T(_SC_XOPEN_SHM, |1 );
     82     T(_SC_XOPEN_VERSION, |1 );
     83     T(_SC_XOPEN_XCU_VERSION, |1 );
     84     T(_SC_XOPEN_REALTIME, |1 );
     85     T(_SC_XOPEN_REALTIME_THREADS, |1 );
     86     T(_SC_XOPEN_LEGACY, |1 );
     87     T(_SC_ATEXIT_MAX, >32 );
     88     T(_SC_IOV_MAX, >0 );
     89     T(_SC_PAGESIZE, == 4096 );
     90     T(_SC_PAGE_SIZE, == 4096 );
     91     T(_SC_XOPEN_UNIX, |1 );
     92     T(_SC_XBS5_ILP32_OFF32, |1 );
     93     T(_SC_XBS5_ILP32_OFFBIG, |1 );
     94     T(_SC_XBS5_LP64_OFF64, |1 );
     95     T(_SC_XBS5_LPBIG_OFFBIG, |1 );
     96     T(_SC_AIO_LISTIO_MAX, |1 );
     97     T(_SC_AIO_MAX, |1 );
     98     T(_SC_AIO_PRIO_DELTA_MAX, |1 );
     99     T(_SC_DELAYTIMER_MAX, >0 );
    100     T(_SC_MQ_OPEN_MAX, |1 );
    101     T(_SC_MQ_PRIO_MAX, >0 );
    102     T(_SC_RTSIG_MAX, |1 );
    103     T(_SC_SEM_NSEMS_MAX, |1 );
    104     T(_SC_SEM_VALUE_MAX, |1 );
    105     T(_SC_SIGQUEUE_MAX, >0 );
    106     T(_SC_TIMER_MAX, |1 );
    107     T(_SC_ASYNCHRONOUS_IO, |1 );
    108     T(_SC_FSYNC, |1 );
    109     T(_SC_MAPPED_FILES, |1 );
    110     T(_SC_MEMLOCK, |1 );
    111     T(_SC_MEMLOCK_RANGE, |1 );
    112     T(_SC_MEMORY_PROTECTION, |1 );
    113     T(_SC_MESSAGE_PASSING, |1 );
    114     T(_SC_PRIORITIZED_IO, |1 );
    115     T(_SC_PRIORITY_SCHEDULING, |1 );
    116     T(_SC_REALTIME_SIGNALS, |1 );
    117     T(_SC_SEMAPHORES, |1 );
    118     T(_SC_SHARED_MEMORY_OBJECTS, |1 );
    119     T(_SC_SYNCHRONIZED_IO, |1 );
    120     T(_SC_TIMERS, |1 );
    121     T(_SC_GETGR_R_SIZE_MAX, |1 );
    122     T(_SC_GETPW_R_SIZE_MAX, |1 );
    123     T(_SC_LOGIN_NAME_MAX, |1 );
    124     T(_SC_THREAD_DESTRUCTOR_ITERATIONS, |1 );
    125     T(_SC_THREAD_KEYS_MAX, > 0 );
    126     T(_SC_THREAD_STACK_MIN, >= 8192 );
    127     T(_SC_THREAD_THREADS_MAX, |1 );
    128     T(_SC_TTY_NAME_MAX, > 0 );
    129     T(_SC_THREADS, |1 );
    130     T(_SC_THREAD_ATTR_STACKADDR, |1 );
    131     T(_SC_THREAD_ATTR_STACKSIZE, |1 );
    132     T(_SC_THREAD_PRIORITY_SCHEDULING, |1 );
    133     T(_SC_THREAD_PRIO_INHERIT, |1 );
    134     T(_SC_THREAD_PRIO_PROTECT, |1 );
    135     T(_SC_THREAD_SAFE_FUNCTIONS, |1 );
    136     return 0;
    137 }
    138