sysconf.gperf (102944) | sysconf.gperf (103591) |
---|---|
1%{ 2/* 3 * Copyright is disclaimed as to the contents of this file. 4 * | 1%{ 2/* 3 * Copyright is disclaimed as to the contents of this file. 4 * |
5 * $FreeBSD: head/usr.bin/getconf/sysconf.gperf 102944 2002-09-04 23:29:10Z dwmalone $ | 5 * $FreeBSD: head/usr.bin/getconf/sysconf.gperf 103591 2002-09-19 03:39:03Z wollman $ |
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/* | 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 * Stuff that isn't defined right now -- we want this file to work 18 * unmodified once it is defined. 19 */ 20#ifndef _SC_ATEXIT_MAX 21#define _SC_ATEXIT_MAX -1 22#endif 23#ifndef _SC_TTY_NAME_MAX 24#define _SC_TTY_NAME_MAX -1 25#endif 26#ifndef _SC_MQ_PRIO_MAX 27#define _SC_MQ_PRIO_MAX -1 28#endif 29#ifndef _SC_IOV_MAX 30#define _SC_IOV_MAX -1 31#endif 32#ifndef _SC_XOPEN_REALTIME 33#define _SC_XOPEN_REALTIME -1 34#endif 35#ifndef _SC_XOPEN_LEGACY 36#define _SC_XOPEN_LEGACY -1 37#endif 38#ifndef _SC_XCU_VERSION 39#define _SC_XCU_VERSION -1 40#endif 41#ifndef _SC_PASS_MAX 42#define _SC_PASS_MAX -1 43#endif 44#ifndef _SC_XOPEN_REALTIME_THREADS 45#define _SC_XOPEN_REALTIME_THREADS -1 46#endif 47#ifndef _SC_LOGIN_NAME_MAX 48#define _SC_LOGIN_NAME_MAX -1 49#endif 50#ifndef _SC_XBS5_LP64_OFF64 51#define _SC_XBS5_LP64_OFF64 -1 52#endif 53#ifndef _SC_XOPEN_SHM 54#define _SC_XOPEN_SHM -1 55#endif 56#ifndef _SC_XOPEN_CRYPT 57#define _SC_XOPEN_CRYPT -1 58#endif 59#ifndef _SC_XOPEN_UNIX 60#define _SC_XOPEN_UNIX -1 61#endif 62#ifndef _SC_XOPEN_VERSION 63#define _SC_XOPEN_VERSION -1 64#endif 65#ifndef _SC_THREAD_DESTRUCTOR_ITERATIONS 66#define _SC_THREAD_DESTRUCTOR_ITERATIONS -1 67#endif 68#ifndef _SC_THREAD_KEYS_MAX 69#define _SC_THREAD_KEYS_MAX -1 70#endif 71#ifndef _SC_2_C_VERSION 72#define _SC_2_C_VERSION -1 73#endif 74#ifndef _SC_XBS5_LPBIG_OFFBIG 75#define _SC_XBS5_LPBIG_OFFBIG -1 76#endif 77#ifndef _SC_THREAD_THREADS_MAX 78#define _SC_THREAD_THREADS_MAX -1 79#endif 80#ifndef _SC_XBS5_ILP32_OFF32 81#define _SC_XBS5_ILP32_OFF32 -1 82#endif 83#ifndef _SC_XBS5_ILP32_OFFBIG 84#define _SC_XBS5_ILP32_OFFBIG -1 85#endif 86#ifndef _SC_THREAD_STACK_MIN 87#define _SC_THREAD_STACK_MIN -1 88#endif 89#ifndef _SC_XOPEN_ENH_I18N 90#define _SC_XOPEN_ENH_I18N -1 91#endif 92#ifndef _SC_THREAD_ATTR_STACKSIZE 93#define _SC_THREAD_ATTR_STACKSIZE -1 94#endif 95#ifndef _SC_THREAD_PRIORITY_SCHEDULING 96#define _SC_THREAD_PRIORITY_SCHEDULING -1 97#endif 98#ifndef _SC_THREADS 99#define _SC_THREADS -1 100#endif 101#ifndef _SC_THREAD_PROCESS_SHARED 102#define _SC_THREAD_PROCESS_SHARED -1 103#endif 104#ifndef _SC_THREAD_SAFE_FUNCTIONS 105#define _SC_THREAD_SAFE_FUNCTIONS -1 106#endif 107#ifndef _SC_THREAD_PRIO_PROTECT 108#define _SC_THREAD_PRIO_PROTECT -1 109#endif 110#ifndef _SC_THREAD_ATTR_STACKADDR 111#define _SC_THREAD_ATTR_STACKADDR -1 112#endif 113#ifndef _SC_THREAD_PRIO_INHERIT 114#define _SC_THREAD_PRIO_INHERIT -1 115#endif 116 117/* | |
118 * Override gperf's built-in external scope. 119 */ 120static const struct map *in_word_set(const char *str, unsigned int len); 121 122%} | 17 * Override gperf's built-in external scope. 18 */ 19static const struct map *in_word_set(const char *str, unsigned int len); 20 21%} |
123struct map { const char *name; int key; }; | 22struct map { const char *name; int key; int valid; }; |
124%% 125AIO_LISTIO_MAX, _SC_AIO_LISTIO_MAX 126AIO_MAX, _SC_AIO_MAX 127AIO_PRIO_DELTA_MAX, _SC_AIO_PRIO_DELTA_MAX 128ARG_MAX, _SC_ARG_MAX 129ATEXIT_MAX, _SC_ATEXIT_MAX 130BC_BASE_MAX, _SC_BC_BASE_MAX 131BC_DIM_MAX, _SC_BC_DIM_MAX 132BC_SCALE_MAX, _SC_BC_SCALE_MAX 133BC_STRING_MAX, _SC_BC_STRING_MAX 134CHILD_MAX, _SC_CHILD_MAX 135CLK_TCK, _SC_CLK_TCK 136COLL_WEIGHTS_MAX, _SC_COLL_WEIGHTS_MAX 137DELAYTIMER_MAX, _SC_DELAYTIMER_MAX 138EXPR_NEST_MAX, _SC_EXPR_NEST_MAX | 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 |
|
139IOV_MAX, _SC_IOV_MAX 140LINE_MAX, _SC_LINE_MAX 141LOGIN_NAME_MAX, _SC_LOGIN_NAME_MAX 142MQ_OPEN_MAX, _SC_MQ_OPEN_MAX 143MQ_PRIO_MAX, _SC_MQ_PRIO_MAX 144NGROUPS_MAX, _SC_NGROUPS_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 |
|
145OPEN_MAX, _SC_OPEN_MAX 146PAGESIZE, _SC_PAGESIZE 147PAGE_SIZE, _SC_PAGESIZE 148PASS_MAX, _SC_PASS_MAX 149PTHREAD_DESTRUCTOR_ITERATIONS, _SC_THREAD_DESTRUCTOR_ITERATIONS 150PTHREAD_KEYS_MAX, _SC_THREAD_KEYS_MAX 151PTHREAD_STACK_MIN, _SC_THREAD_STACK_MIN 152PTHREAD_THREADS_MAX, _SC_THREAD_THREADS_MAX --- 12 unchanged lines hidden (view full) --- 165_POSIX2_C_VERSION, _SC_2_C_VERSION 166_POSIX2_FORT_DEV, _SC_2_FORT_DEV 167_POSIX2_FORT_RUN, _SC_2_FORT_RUN 168_POSIX2_LOCALEDEF, _SC_2_LOCALEDEF 169_POSIX2_SW_DEV, _SC_2_SW_DEV 170_POSIX2_UPE, _SC_2_UPE 171_POSIX2_VERSION, _SC_2_VERSION 172_POSIX_ASYNCHRONOUS_IO, _SC_ASYNCHRONOUS_IO | 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 --- 12 unchanged lines hidden (view full) --- 69_POSIX2_C_VERSION, _SC_2_C_VERSION 70_POSIX2_FORT_DEV, _SC_2_FORT_DEV 71_POSIX2_FORT_RUN, _SC_2_FORT_RUN 72_POSIX2_LOCALEDEF, _SC_2_LOCALEDEF 73_POSIX2_SW_DEV, _SC_2_SW_DEV 74_POSIX2_UPE, _SC_2_UPE 75_POSIX2_VERSION, _SC_2_VERSION 76_POSIX_ASYNCHRONOUS_IO, _SC_ASYNCHRONOUS_IO |
77_POSIX_BARRIERS, _SC_BARRIERS 78_POSIX_CLOCK_SELECTION, _SC_CLOCK_SELECTION 79_POSIX_CPUTIME, _SC_CPUTIME 80_POSIX_FILE_LOCKING, _SC_FILE_LOCKING |
|
173_POSIX_FSYNC, _SC_FSYNC 174_POSIX_JOB_CONTROL, _SC_JOB_CONTROL 175_POSIX_MAPPED_FILES, _SC_MAPPED_FILES 176_POSIX_MEMLOCK, _SC_MEMLOCK 177_POSIX_MEMLOCK_RANGE, _SC_MEMLOCK_RANGE 178_POSIX_MEMORY_PROTECTION, _SC_MEMORY_PROTECTION 179_POSIX_MESSAGE_PASSING, _SC_MESSAGE_PASSING | 81_POSIX_FSYNC, _SC_FSYNC 82_POSIX_JOB_CONTROL, _SC_JOB_CONTROL 83_POSIX_MAPPED_FILES, _SC_MAPPED_FILES 84_POSIX_MEMLOCK, _SC_MEMLOCK 85_POSIX_MEMLOCK_RANGE, _SC_MEMLOCK_RANGE 86_POSIX_MEMORY_PROTECTION, _SC_MEMORY_PROTECTION 87_POSIX_MESSAGE_PASSING, _SC_MESSAGE_PASSING |
88_POSIX_MONOTONIC_CLOCK, _SC_MONOTONIC_CLOCK |
|
180_POSIX_PRIORITIZED_IO, _SC_PRIORITIZED_IO 181_POSIX_PRIORITY_SCHEDULING, _SC_PRIORITY_SCHEDULING | 89_POSIX_PRIORITIZED_IO, _SC_PRIORITIZED_IO 90_POSIX_PRIORITY_SCHEDULING, _SC_PRIORITY_SCHEDULING |
91_POSIX_READER_WRITER_LOCKS, _SC_READER_WRITER_LOCKS |
|
182_POSIX_REALTIME_SIGNALS, _SC_REALTIME_SIGNALS | 92_POSIX_REALTIME_SIGNALS, _SC_REALTIME_SIGNALS |
93_POSIX_REGEXP, _SC_REGEXP |
|
183_POSIX_SAVED_IDS, _SC_SAVED_IDS 184_POSIX_SEMAPHORES, _SC_SEMAPHORES 185_POSIX_SHARED_MEMORY_OBJECTS, _SC_SHARED_MEMORY_OBJECTS | 94_POSIX_SAVED_IDS, _SC_SAVED_IDS 95_POSIX_SEMAPHORES, _SC_SEMAPHORES 96_POSIX_SHARED_MEMORY_OBJECTS, _SC_SHARED_MEMORY_OBJECTS |
97_POSIX_SHELL, _SC_SHELL 98_POSIX_SPAWN, _SC_SPAWN 99_POSIX_SPIN_LOCKS, _SC_SPIN_LOCKS 100_POSIX_SPORADIC_SERVER, _SC_SPORADIC_SERVER |
|
186_POSIX_SYNCHRONIZED_IO, _SC_SYNCHRONIZED_IO 187_POSIX_THREADS, _SC_THREADS 188_POSIX_THREAD_ATTR_STACKADDR, _SC_THREAD_ATTR_STACKADDR 189_POSIX_THREAD_ATTR_STACKSIZE, _SC_THREAD_ATTR_STACKSIZE | 101_POSIX_SYNCHRONIZED_IO, _SC_SYNCHRONIZED_IO 102_POSIX_THREADS, _SC_THREADS 103_POSIX_THREAD_ATTR_STACKADDR, _SC_THREAD_ATTR_STACKADDR 104_POSIX_THREAD_ATTR_STACKSIZE, _SC_THREAD_ATTR_STACKSIZE |
105_POSIX_THREAD_CPUTIME, _SC_THREAD_CPUTIME |
|
190_POSIX_THREAD_PRIORITY_SCHEDULING, _SC_THREAD_PRIORITY_SCHEDULING 191_POSIX_THREAD_PRIO_INHERIT, _SC_THREAD_PRIO_INHERIT 192_POSIX_THREAD_PRIO_PROTECT, _SC_THREAD_PRIO_PROTECT 193_POSIX_THREAD_PROCESS_SHARED, _SC_THREAD_PROCESS_SHARED | 106_POSIX_THREAD_PRIORITY_SCHEDULING, _SC_THREAD_PRIORITY_SCHEDULING 107_POSIX_THREAD_PRIO_INHERIT, _SC_THREAD_PRIO_INHERIT 108_POSIX_THREAD_PRIO_PROTECT, _SC_THREAD_PRIO_PROTECT 109_POSIX_THREAD_PROCESS_SHARED, _SC_THREAD_PROCESS_SHARED |
194_POSIX_THREAD_SAFE_FUNCTIONS, _SC_THREAD_SAFE_FUNCTIONS | 110_POSIX_THREAD_SAFE_FUNCTIONS, _SC_THREAD_SAFE_FUNCTIONS 111_POSIX_THREAD_SPORADIC_SERVER, _SC_THREAD_SPORADIC_SERVER 112_POSIX_TIMEOUTS, _SC_TIMEOUTS 113_POSIX_TRACE, _SC_TRACE 114_POSIX_TRACE_EVENT_FILTER, _SC_TRACE_EVENT_FILTER 115_POSIX_TRACE_INHERIT, _SC_TRACE_INHERIT 116_POSIX_TRACE_LOG, _SC_TRACE_LOG |
195_POSIX_TIMERS, _SC_TIMERS | 117_POSIX_TIMERS, _SC_TIMERS |
118_POSIX_TYPED_MEMORY_OBJECTS, _SC_TYPED_MEMORY_OBJECTS |
|
196_POSIX_VERSION, _SC_VERSION | 119_POSIX_VERSION, _SC_VERSION |
197_XBS5_ILP32_OFF32, _SC_XBS5_ILP32_OFF32 198_XBS5_ILP32_OFFBIG, _SC_XBS5_ILP32_OFFBIG 199_XBS5_LP64_OFF64, _SC_XBS5_LP64_OFF64 200_XBS5_LPBIG_OFFBIG, _SC_XBS5_LPBIG_OFFBIG | 120_POSIX_V6_ILP32_OFF32, _SC_V6_ILP32_OFF32 121_POSIX_V6_ILP32_OFFBIG, _SC_V6_ILP32_OFFBIG 122_POSIX_V6_LP64_OFF64, _SC_V6_LP64_OFF64 123_POSIX_V6_LP64_OFFBIG, _SC_V6_LP64_OFFBIG |
201_XOPEN_CRYPT, _SC_XOPEN_CRYPT 202_XOPEN_ENH_I18N, _SC_XOPEN_ENH_I18N 203_XOPEN_LEGACY, _SC_XOPEN_LEGACY 204_XOPEN_REALTIME, _SC_XOPEN_REALTIME 205_XOPEN_REALTIME_THREADS, _SC_XOPEN_REALTIME_THREADS 206_XOPEN_SHM, _SC_XOPEN_SHM 207_XOPEN_UNIX, _SC_XOPEN_UNIX 208_XOPEN_VERSION, _SC_XOPEN_VERSION 209_XOPEN_XCU_VERSION, _SC_XCU_VERSION 210%% 211int | 124_XOPEN_CRYPT, _SC_XOPEN_CRYPT 125_XOPEN_ENH_I18N, _SC_XOPEN_ENH_I18N 126_XOPEN_LEGACY, _SC_XOPEN_LEGACY 127_XOPEN_REALTIME, _SC_XOPEN_REALTIME 128_XOPEN_REALTIME_THREADS, _SC_XOPEN_REALTIME_THREADS 129_XOPEN_SHM, _SC_XOPEN_SHM 130_XOPEN_UNIX, _SC_XOPEN_UNIX 131_XOPEN_VERSION, _SC_XOPEN_VERSION 132_XOPEN_XCU_VERSION, _SC_XCU_VERSION 133%% 134int |
212find_sysconf(const char *name) | 135find_sysconf(const char *name, int *key) |
213{ 214 const struct map *rv; 215 216 rv = in_word_set(name, strlen(name)); | 136{ 137 const struct map *rv; 138 139 rv = in_word_set(name, strlen(name)); |
217 if (rv != 0) 218 return rv->key; 219 else | 140 if (rv != NULL) { 141 if (rv->valid) { 142 *key = rv->key; 143 return 1; 144 } |
220 return -1; | 145 return -1; |
146 } 147 return 0; |
|
221} | 148} |