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