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