xref: /freebsd/usr.bin/getconf/limits.gperf (revision a90b9d0159070121c221b966469c3e36d912bf82)
1%{
2/*
3 * Copyright is disclaimed as to the contents of this file.
4 */
5
6#include <sys/types.h>
7
8#include <string.h>
9#include <limits.h>
10
11#include "getconf.h"
12
13/*
14 * Override gperf's built-in external scope.
15 */
16static const struct map *in_word_set(const char *str);
17
18%}
19struct map { const char *name; intmax_t value; int valid; };
20%%
21_POSIX_CLOCKRES_MIN, _POSIX_CLOCKRES_MIN
22_POSIX_AIO_LISTIO_MAX, _POSIX_AIO_LISTIO_MAX
23_POSIX_AIO_MAX, _POSIX_AIO_MAX
24_POSIX_ARG_MAX, _POSIX_ARG_MAX
25_POSIX_CHILD_MAX, _POSIX_CHILD_MAX
26_POSIX_DELAYTIMER_MAX, _POSIX_DELAYTIMER_MAX
27_POSIX_HOST_NAME_MAX, _POSIX_HOST_NAME_MAX
28_POSIX_LINK_MAX, _POSIX_LINK_MAX
29_POSIX_LOGIN_NAME_MAX, _POSIX_LOGIN_NAME_MAX
30_POSIX_MAX_CANON, _POSIX_MAX_CANON
31_POSIX_MAX_INPUT, _POSIX_MAX_INPUT
32_POSIX_MQ_OPEN_MAX, _POSIX_MQ_OPEN_MAX
33_POSIX_MQ_PRIO_MAX, _POSIX_MQ_PRIO_MAX
34_POSIX_NAME_MAX, _POSIX_NAME_MAX
35_POSIX_NGROUPS_MAX, _POSIX_NGROUPS_MAX
36_POSIX_OPEN_MAX, _POSIX_OPEN_MAX
37_POSIX_PATH_MAX, _POSIX_PATH_MAX
38_POSIX_PIPE_BUF, __POSIX_PIPE_BUF
39_POSIX_RE_DUP_MAX, _POSIX_RE_DUP_MAX
40_POSIX_RTSIG_MAX, _POSIX_RTSIG_MAX
41_POSIX_SEM_NSEMS_MAX, _POSIX_SEM_NSEMS_MAX
42_POSIX_SEM_VALUE_MAX, _POSIX_SEM_VALUE_MAX
43_POSIX_SIGQUEUE_MAX, _POSIX_SIGQUEUE_MAX
44_POSIX_SSIZE_MAX, _POSIX_SSIZE_MAX
45_POSIX_STREAM_MAX, _POSIX_STREAM_MAX
46_POSIX_SS_REPL_MAX, _POSIX_SS_REPL_MAX
47_POSIX_SYMLINK_MAX, _POSIX_SYMLINK_MAX
48_POSIX_SYMLOOP_MAX, _POSIX_SYMLOOP_MAX
49_POSIX_THREAD_DESTRUCTOR_ITERATIONS, _POSIX_THREAD_DESTRUCTOR_ITERATIONS
50_POSIX_THREAD_KEYS_MAX, _POSIX_THREAD_KEYS_MAX
51_POSIX_THREAD_THREADS_MAX, _POSIX_THREAD_THREADS_MAX
52_POSIX_TIMER_MAX, _POSIX_TIMER_MAX
53_POSIX_TRACE_EVENT_NAME_MAX, _POSIX_TRACE_EVENT_NAME_MAX
54_POSIX_TRACE_NAME_MAX, _POSIX_TRACE_NAME_MAX
55_POSIX_TRACE_SYS_MAX, _POSIX_TRACE_SYS_MAX
56_POSIX_TRACE_USER_EVENT_MAX, _POSIX_TRACE_USER_EVENT_MAX
57_POSIX_TTY_NAME_MAX, _POSIX_TTY_NAME_MAX
58_POSIX_TZNAME_MAX, _POSIX_TZNAME_MAX
59_POSIX2_BC_BASE_MAX, _POSIX2_BC_BASE_MAX
60_POSIX2_BC_DIM_MAX, _POSIX2_BC_DIM_MAX
61_POSIX2_BC_SCALE_MAX, _POSIX2_BC_SCALE_MAX
62_POSIX2_BC_STRING_MAX, _POSIX2_BC_STRING_MAX
63_POSIX2_CHARCLASS_NAME_MAX, _POSIX2_CHARCLASS_NAME_MAX
64_POSIX2_COLL_WEIGHTS_MAX, _POSIX2_COLL_WEIGHTS_MAX
65_POSIX2_EXPR_NEXT_MAX, _POSIX2_EXPR_NEST_MAX
66_POSIX2_LINE_MAX, _POSIX2_LINE_MAX
67_POSIX2_RE_DUP_MAX, _POSIX2_RE_DUP_MAX
68_XOPEN_IOV_MAX, _XOPEN_IOV_MAX
69_XOPEN_NAME_MAX, _XOPEN_NAME_MAX
70_XOPEN_PATH_MAX, _XOPEN_PATH_MAX
71CHAR_BIT, CHAR_BIT
72CHAR_MAX, CHAR_MAX
73CHAR_MIN, CHAR_MIN
74INT_MAX, INT_MAX
75INT_MIN, INT_MIN
76LLONG_MIN, LLONG_MIN
77LLONG_MAX, LLONG_MAX
78LONG_BIT, LONG_BIT
79LONG_MAX, LONG_MAX
80LONG_MIN, LONG_MIN
81MB_LEN_MAX, MB_LEN_MAX
82SCHAR_MAX, SCHAR_MAX
83SCHAR_MIN, SCHAR_MIN
84SHRT_MAX, SHRT_MAX
85SHRT_MIN, SHRT_MIN
86SSIZE_MAX, SSIZE_MAX
87WORD_BIT, WORD_BIT
88CHARCLASS_NAME_MAX, CHARCLASS_NAME_MAX
89NL_ARGMAX, NL_ARGMAX
90ML_LANGMAX, NL_LANGMAX
91NL_MSGMAX, NL_MSGMAX
92NL_NMAX, NL_NMAX
93NL_SETMAX, NL_SETMAX
94NL_TEXTMAX, NL_TEXTMAX
95NZERO, NZERO
96%%
97int
98find_limit(const char *name, intmax_t *value)
99{
100	const struct map *rv;
101
102	rv = in_word_set(name);
103	if (rv != NULL) {
104		if (rv->valid) {
105			*value = rv->value;
106			return 1;
107		}
108		return -1;
109	}
110	return 0;
111}
112