1%{ 2/* 3 * Copyright is disclaimed as to the contents of this file. 4 * 5 * $FreeBSD$ 6 */ 7 8#include <sys/types.h> 9 10#include <limits.h> 11#include <string.h> 12#include <unistd.h> 13 14#include "getconf.h" 15 16/* 17 * Override gperf's built-in external scope. 18 */ 19static const struct map *in_word_set(const char *str, unsigned int len); 20 21%} 22struct map { const char *name; int key; int valid; }; 23%% 24AIO_LISTIO_MAX, _SC_AIO_LISTIO_MAX 25AIO_MAX, _SC_AIO_MAX 26AIO_PRIO_DELTA_MAX, _SC_AIO_PRIO_DELTA_MAX 27ARG_MAX, _SC_ARG_MAX 28ATEXIT_MAX, _SC_ATEXIT_MAX 29BC_BASE_MAX, _SC_BC_BASE_MAX 30BC_DIM_MAX, _SC_BC_DIM_MAX 31BC_SCALE_MAX, _SC_BC_SCALE_MAX 32BC_STRING_MAX, _SC_BC_STRING_MAX 33CHILD_MAX, _SC_CHILD_MAX 34CLK_TCK, _SC_CLK_TCK 35COLL_WEIGHTS_MAX, _SC_COLL_WEIGHTS_MAX 36DELAYTIMER_MAX, _SC_DELAYTIMER_MAX 37EXPR_NEST_MAX, _SC_EXPR_NEST_MAX 38GETGR_R_SIZE_MAX, _SC_GETGR_R_SIZE_MAX 39GETPW_R_SIZE_MAX, _SC_GETPW_R_SIZE_MAX 40HOST_NAME_MAX, _SC_HOST_NAME_MAX 41IOV_MAX, _SC_IOV_MAX 42LINE_MAX, _SC_LINE_MAX 43LOGIN_NAME_MAX, _SC_LOGIN_NAME_MAX 44MQ_OPEN_MAX, _SC_MQ_OPEN_MAX 45MQ_PRIO_MAX, _SC_MQ_PRIO_MAX 46NGROUPS_MAX, _SC_NGROUPS_MAX 47NPROCESSORS_CONF, _SC_NPROCESSORS_CONF 48NPROCESSORS_ONLN, _SC_NPROCESSORS_ONLN 49OPEN_MAX, _SC_OPEN_MAX 50PAGESIZE, _SC_PAGESIZE 51PAGE_SIZE, _SC_PAGESIZE 52PASS_MAX, _SC_PASS_MAX 53PTHREAD_DESTRUCTOR_ITERATIONS, _SC_THREAD_DESTRUCTOR_ITERATIONS 54PTHREAD_KEYS_MAX, _SC_THREAD_KEYS_MAX 55PTHREAD_STACK_MIN, _SC_THREAD_STACK_MIN 56PTHREAD_THREADS_MAX, _SC_THREAD_THREADS_MAX 57RE_DUP_MAX, _SC_RE_DUP_MAX 58RTSIG_MAX, _SC_RTSIG_MAX 59SEM_NSEMS_MAX, _SC_SEM_NSEMS_MAX 60SEM_VALUE_MAX, _SC_SEM_VALUE_MAX 61SIGQUEUE_MAX, _SC_SIGQUEUE_MAX 62STREAM_MAX, _SC_STREAM_MAX 63SYMLOOP_MAX, _SC_SYMLOOP_MAX 64TIMER_MAX, _SC_TIMER_MAX 65TTY_NAME_MAX, _SC_TTY_NAME_MAX 66TZNAME_MAX, _SC_TZNAME_MAX 67_POSIX2_CHAR_TERM, _SC_2_CHAR_TERM 68_POSIX2_C_BIND, _SC_2_C_BIND 69_POSIX2_C_DEV, _SC_2_C_DEV 70_POSIX2_C_VERSION, _SC_2_C_VERSION 71_POSIX2_FORT_DEV, _SC_2_FORT_DEV 72_POSIX2_FORT_RUN, _SC_2_FORT_RUN 73_POSIX2_LOCALEDEF, _SC_2_LOCALEDEF 74_POSIX2_SW_DEV, _SC_2_SW_DEV 75_POSIX2_UPE, _SC_2_UPE 76_POSIX2_VERSION, _SC_2_VERSION 77_POSIX_ASYNCHRONOUS_IO, _SC_ASYNCHRONOUS_IO 78_POSIX_BARRIERS, _SC_BARRIERS 79_POSIX_CLOCK_SELECTION, _SC_CLOCK_SELECTION 80_POSIX_CPUTIME, _SC_CPUTIME 81_POSIX_FILE_LOCKING, _SC_FILE_LOCKING 82_POSIX_FSYNC, _SC_FSYNC 83_POSIX_IPV6, _SC_IPV6 84_POSIX_JOB_CONTROL, _SC_JOB_CONTROL 85_POSIX_MAPPED_FILES, _SC_MAPPED_FILES 86_POSIX_MEMLOCK, _SC_MEMLOCK 87_POSIX_MEMLOCK_RANGE, _SC_MEMLOCK_RANGE 88_POSIX_MEMORY_PROTECTION, _SC_MEMORY_PROTECTION 89_POSIX_MESSAGE_PASSING, _SC_MESSAGE_PASSING 90_POSIX_MONOTONIC_CLOCK, _SC_MONOTONIC_CLOCK 91_POSIX_PRIORITIZED_IO, _SC_PRIORITIZED_IO 92_POSIX_PRIORITY_SCHEDULING, _SC_PRIORITY_SCHEDULING 93_POSIX_READER_WRITER_LOCKS, _SC_READER_WRITER_LOCKS 94_POSIX_REALTIME_SIGNALS, _SC_REALTIME_SIGNALS 95_POSIX_REGEXP, _SC_REGEXP 96_POSIX_SAVED_IDS, _SC_SAVED_IDS 97_POSIX_SEMAPHORES, _SC_SEMAPHORES 98_POSIX_SHARED_MEMORY_OBJECTS, _SC_SHARED_MEMORY_OBJECTS 99_POSIX_SHELL, _SC_SHELL 100_POSIX_SPAWN, _SC_SPAWN 101_POSIX_SPIN_LOCKS, _SC_SPIN_LOCKS 102_POSIX_SPORADIC_SERVER, _SC_SPORADIC_SERVER 103_POSIX_SYNCHRONIZED_IO, _SC_SYNCHRONIZED_IO 104_POSIX_THREADS, _SC_THREADS 105_POSIX_THREAD_ATTR_STACKADDR, _SC_THREAD_ATTR_STACKADDR 106_POSIX_THREAD_ATTR_STACKSIZE, _SC_THREAD_ATTR_STACKSIZE 107_POSIX_THREAD_CPUTIME, _SC_THREAD_CPUTIME 108_POSIX_THREAD_PRIORITY_SCHEDULING, _SC_THREAD_PRIORITY_SCHEDULING 109_POSIX_THREAD_PRIO_INHERIT, _SC_THREAD_PRIO_INHERIT 110_POSIX_THREAD_PRIO_PROTECT, _SC_THREAD_PRIO_PROTECT 111_POSIX_THREAD_PROCESS_SHARED, _SC_THREAD_PROCESS_SHARED 112_POSIX_THREAD_SAFE_FUNCTIONS, _SC_THREAD_SAFE_FUNCTIONS 113_POSIX_THREAD_SPORADIC_SERVER, _SC_THREAD_SPORADIC_SERVER 114_POSIX_TIMEOUTS, _SC_TIMEOUTS 115_POSIX_TRACE, _SC_TRACE 116_POSIX_TRACE_EVENT_FILTER, _SC_TRACE_EVENT_FILTER 117_POSIX_TRACE_INHERIT, _SC_TRACE_INHERIT 118_POSIX_TRACE_LOG, _SC_TRACE_LOG 119_POSIX_TIMERS, _SC_TIMERS 120_POSIX_TYPED_MEMORY_OBJECTS, _SC_TYPED_MEMORY_OBJECTS 121_POSIX_VERSION, _SC_VERSION 122_POSIX_V6_ILP32_OFF32, _SC_V6_ILP32_OFF32 123_POSIX_V6_ILP32_OFFBIG, _SC_V6_ILP32_OFFBIG 124_POSIX_V6_LP64_OFF64, _SC_V6_LP64_OFF64 125_POSIX_V6_LP64_OFFBIG, _SC_V6_LP64_OFFBIG 126_XOPEN_CRYPT, _SC_XOPEN_CRYPT 127_XOPEN_ENH_I18N, _SC_XOPEN_ENH_I18N 128_XOPEN_LEGACY, _SC_XOPEN_LEGACY 129_XOPEN_REALTIME, _SC_XOPEN_REALTIME 130_XOPEN_REALTIME_THREADS, _SC_XOPEN_REALTIME_THREADS 131_XOPEN_SHM, _SC_XOPEN_SHM 132_XOPEN_UNIX, _SC_XOPEN_UNIX 133_XOPEN_VERSION, _SC_XOPEN_VERSION 134_XOPEN_XCU_VERSION, _SC_XCU_VERSION 135%% 136int 137find_sysconf(const char *name, int *key) 138{ 139 const struct map *rv; 140 141 rv = in_word_set(name, strlen(name)); 142 if (rv != NULL) { 143 if (rv->valid) { 144 *key = rv->key; 145 return 1; 146 } 147 return -1; 148 } 149 return 0; 150} 151