xref: /freebsd-src/usr.bin/getconf/limits.gperf (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
1e9cfb9aeSGarrett Wollman%{
2e9cfb9aeSGarrett Wollman/*
3e9cfb9aeSGarrett Wollman * Copyright is disclaimed as to the contents of this file.
4e9cfb9aeSGarrett Wollman */
5e9cfb9aeSGarrett Wollman
6e9cfb9aeSGarrett Wollman#include <sys/types.h>
7e9cfb9aeSGarrett Wollman
8e9cfb9aeSGarrett Wollman#include <string.h>
9e9cfb9aeSGarrett Wollman#include <limits.h>
10e9cfb9aeSGarrett Wollman
11e9cfb9aeSGarrett Wollman#include "getconf.h"
12e9cfb9aeSGarrett Wollman
13e9cfb9aeSGarrett Wollman/*
14e9cfb9aeSGarrett Wollman * Override gperf's built-in external scope.
15e9cfb9aeSGarrett Wollman */
16a272cd3aSMark Murraystatic const struct map *in_word_set(const char *str);
17e9cfb9aeSGarrett Wollman
18e9cfb9aeSGarrett Wollman%}
19e9cfb9aeSGarrett Wollmanstruct map { const char *name; intmax_t value; int valid; };
20e9cfb9aeSGarrett Wollman%%
21*b4b4b530SBaptiste Daroussin_POSIX_CLOCKRES_MIN, _POSIX_CLOCKRES_MIN
22e9cfb9aeSGarrett Wollman_POSIX_AIO_LISTIO_MAX, _POSIX_AIO_LISTIO_MAX
23e9cfb9aeSGarrett Wollman_POSIX_AIO_MAX, _POSIX_AIO_MAX
24e9cfb9aeSGarrett Wollman_POSIX_ARG_MAX, _POSIX_ARG_MAX
25e9cfb9aeSGarrett Wollman_POSIX_CHILD_MAX, _POSIX_CHILD_MAX
26e9cfb9aeSGarrett Wollman_POSIX_DELAYTIMER_MAX, _POSIX_DELAYTIMER_MAX
27e9cfb9aeSGarrett Wollman_POSIX_HOST_NAME_MAX, _POSIX_HOST_NAME_MAX
28e9cfb9aeSGarrett Wollman_POSIX_LINK_MAX, _POSIX_LINK_MAX
29e9cfb9aeSGarrett Wollman_POSIX_LOGIN_NAME_MAX, _POSIX_LOGIN_NAME_MAX
30e9cfb9aeSGarrett Wollman_POSIX_MAX_CANON, _POSIX_MAX_CANON
31e9cfb9aeSGarrett Wollman_POSIX_MAX_INPUT, _POSIX_MAX_INPUT
32e9cfb9aeSGarrett Wollman_POSIX_MQ_OPEN_MAX, _POSIX_MQ_OPEN_MAX
33e9cfb9aeSGarrett Wollman_POSIX_MQ_PRIO_MAX, _POSIX_MQ_PRIO_MAX
34e9cfb9aeSGarrett Wollman_POSIX_NAME_MAX, _POSIX_NAME_MAX
35e9cfb9aeSGarrett Wollman_POSIX_NGROUPS_MAX, _POSIX_NGROUPS_MAX
36e9cfb9aeSGarrett Wollman_POSIX_OPEN_MAX, _POSIX_OPEN_MAX
37e9cfb9aeSGarrett Wollman_POSIX_PATH_MAX, _POSIX_PATH_MAX
38e9cfb9aeSGarrett Wollman_POSIX_PIPE_BUF, __POSIX_PIPE_BUF
39e9cfb9aeSGarrett Wollman_POSIX_RE_DUP_MAX, _POSIX_RE_DUP_MAX
40e9cfb9aeSGarrett Wollman_POSIX_RTSIG_MAX, _POSIX_RTSIG_MAX
41e9cfb9aeSGarrett Wollman_POSIX_SEM_NSEMS_MAX, _POSIX_SEM_NSEMS_MAX
42e9cfb9aeSGarrett Wollman_POSIX_SEM_VALUE_MAX, _POSIX_SEM_VALUE_MAX
43e9cfb9aeSGarrett Wollman_POSIX_SIGQUEUE_MAX, _POSIX_SIGQUEUE_MAX
44e9cfb9aeSGarrett Wollman_POSIX_SSIZE_MAX, _POSIX_SSIZE_MAX
45e9cfb9aeSGarrett Wollman_POSIX_STREAM_MAX, _POSIX_STREAM_MAX
46e9cfb9aeSGarrett Wollman_POSIX_SS_REPL_MAX, _POSIX_SS_REPL_MAX
47e9cfb9aeSGarrett Wollman_POSIX_SYMLINK_MAX, _POSIX_SYMLINK_MAX
48e9cfb9aeSGarrett Wollman_POSIX_SYMLOOP_MAX, _POSIX_SYMLOOP_MAX
49e9cfb9aeSGarrett Wollman_POSIX_THREAD_DESTRUCTOR_ITERATIONS, _POSIX_THREAD_DESTRUCTOR_ITERATIONS
50e9cfb9aeSGarrett Wollman_POSIX_THREAD_KEYS_MAX, _POSIX_THREAD_KEYS_MAX
51e9cfb9aeSGarrett Wollman_POSIX_THREAD_THREADS_MAX, _POSIX_THREAD_THREADS_MAX
52e9cfb9aeSGarrett Wollman_POSIX_TIMER_MAX, _POSIX_TIMER_MAX
53e9cfb9aeSGarrett Wollman_POSIX_TRACE_EVENT_NAME_MAX, _POSIX_TRACE_EVENT_NAME_MAX
54e9cfb9aeSGarrett Wollman_POSIX_TRACE_NAME_MAX, _POSIX_TRACE_NAME_MAX
55e9cfb9aeSGarrett Wollman_POSIX_TRACE_SYS_MAX, _POSIX_TRACE_SYS_MAX
56e9cfb9aeSGarrett Wollman_POSIX_TRACE_USER_EVENT_MAX, _POSIX_TRACE_USER_EVENT_MAX
57e9cfb9aeSGarrett Wollman_POSIX_TTY_NAME_MAX, _POSIX_TTY_NAME_MAX
58e9cfb9aeSGarrett Wollman_POSIX_TZNAME_MAX, _POSIX_TZNAME_MAX
59e9cfb9aeSGarrett Wollman_POSIX2_BC_BASE_MAX, _POSIX2_BC_BASE_MAX
60e9cfb9aeSGarrett Wollman_POSIX2_BC_DIM_MAX, _POSIX2_BC_DIM_MAX
61e9cfb9aeSGarrett Wollman_POSIX2_BC_SCALE_MAX, _POSIX2_BC_SCALE_MAX
62e9cfb9aeSGarrett Wollman_POSIX2_BC_STRING_MAX, _POSIX2_BC_STRING_MAX
63e9cfb9aeSGarrett Wollman_POSIX2_CHARCLASS_NAME_MAX, _POSIX2_CHARCLASS_NAME_MAX
64e9cfb9aeSGarrett Wollman_POSIX2_COLL_WEIGHTS_MAX, _POSIX2_COLL_WEIGHTS_MAX
65*b4b4b530SBaptiste Daroussin_POSIX2_EXPR_NEXT_MAX, _POSIX2_EXPR_NEST_MAX
66e9cfb9aeSGarrett Wollman_POSIX2_LINE_MAX, _POSIX2_LINE_MAX
67e9cfb9aeSGarrett Wollman_POSIX2_RE_DUP_MAX, _POSIX2_RE_DUP_MAX
68e9cfb9aeSGarrett Wollman_XOPEN_IOV_MAX, _XOPEN_IOV_MAX
69e9cfb9aeSGarrett Wollman_XOPEN_NAME_MAX, _XOPEN_NAME_MAX
70e9cfb9aeSGarrett Wollman_XOPEN_PATH_MAX, _XOPEN_PATH_MAX
71e9cfb9aeSGarrett WollmanCHAR_BIT, CHAR_BIT
72e9cfb9aeSGarrett WollmanCHAR_MAX, CHAR_MAX
73e9cfb9aeSGarrett WollmanCHAR_MIN, CHAR_MIN
74e9cfb9aeSGarrett WollmanINT_MAX, INT_MAX
75e9cfb9aeSGarrett WollmanINT_MIN, INT_MIN
76e9cfb9aeSGarrett WollmanLLONG_MIN, LLONG_MIN
77e9cfb9aeSGarrett WollmanLLONG_MAX, LLONG_MAX
78e9cfb9aeSGarrett WollmanLONG_BIT, LONG_BIT
79e9cfb9aeSGarrett WollmanLONG_MAX, LONG_MAX
80e9cfb9aeSGarrett WollmanLONG_MIN, LONG_MIN
81e9cfb9aeSGarrett WollmanMB_LEN_MAX, MB_LEN_MAX
82e9cfb9aeSGarrett WollmanSCHAR_MAX, SCHAR_MAX
83e9cfb9aeSGarrett WollmanSCHAR_MIN, SCHAR_MIN
84e9cfb9aeSGarrett WollmanSHRT_MAX, SHRT_MAX
85e9cfb9aeSGarrett WollmanSHRT_MIN, SHRT_MIN
86e9cfb9aeSGarrett WollmanSSIZE_MAX, SSIZE_MAX
87e9cfb9aeSGarrett WollmanWORD_BIT, WORD_BIT
88e9cfb9aeSGarrett WollmanCHARCLASS_NAME_MAX, CHARCLASS_NAME_MAX
89e9cfb9aeSGarrett WollmanNL_ARGMAX, NL_ARGMAX
90e9cfb9aeSGarrett WollmanML_LANGMAX, NL_LANGMAX
91e9cfb9aeSGarrett WollmanNL_MSGMAX, NL_MSGMAX
92e9cfb9aeSGarrett WollmanNL_NMAX, NL_NMAX
93e9cfb9aeSGarrett WollmanNL_SETMAX, NL_SETMAX
94e9cfb9aeSGarrett WollmanNL_TEXTMAX, NL_TEXTMAX
95e9cfb9aeSGarrett WollmanNZERO, NZERO
96e9cfb9aeSGarrett Wollman%%
97e9cfb9aeSGarrett Wollmanint
98e9cfb9aeSGarrett Wollmanfind_limit(const char *name, intmax_t *value)
99e9cfb9aeSGarrett Wollman{
100e9cfb9aeSGarrett Wollman	const struct map *rv;
101e9cfb9aeSGarrett Wollman
102a272cd3aSMark Murray	rv = in_word_set(name);
103e9cfb9aeSGarrett Wollman	if (rv != NULL) {
104e9cfb9aeSGarrett Wollman		if (rv->valid) {
105e9cfb9aeSGarrett Wollman			*value = rv->value;
106e9cfb9aeSGarrett Wollman			return 1;
107e9cfb9aeSGarrett Wollman		}
108e9cfb9aeSGarrett Wollman		return -1;
109e9cfb9aeSGarrett Wollman	}
110e9cfb9aeSGarrett Wollman	return 0;
111e9cfb9aeSGarrett Wollman}
112