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