2002-09-19 03:39:03 +00:00
|
|
|
%{
|
|
|
|
/*
|
|
|
|
* Copyright is disclaimed as to the contents of this file.
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <limits.h>
|
2017-01-28 16:30:14 +00:00
|
|
|
#ifdef APPLE_GETCONF_UNDERSCORE
|
|
|
|
#include <alloca.h>
|
|
|
|
#endif /* APPLE_GETCONF_UNDERSCORE */
|
2002-09-19 03:39:03 +00:00
|
|
|
|
|
|
|
#include "getconf.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Override gperf's built-in external scope.
|
|
|
|
*/
|
2003-08-22 17:32:07 +00:00
|
|
|
static const struct map *in_word_set(const char *str);
|
2002-09-19 03:39:03 +00:00
|
|
|
|
|
|
|
%}
|
|
|
|
struct map { const char *name; intmax_t value; int valid; };
|
|
|
|
%%
|
|
|
|
_POSIX_AIO_LISTIO_MAX, _POSIX_AIO_LISTIO_MAX
|
|
|
|
_POSIX_AIO_MAX, _POSIX_AIO_MAX
|
|
|
|
_POSIX_ARG_MAX, _POSIX_ARG_MAX
|
|
|
|
_POSIX_CHILD_MAX, _POSIX_CHILD_MAX
|
2017-01-28 16:30:14 +00:00
|
|
|
_POSIX_CLOCKRES_MIN, _POSIX_CLOCKRES_MIN
|
2002-09-19 03:39:03 +00:00
|
|
|
_POSIX_DELAYTIMER_MAX, _POSIX_DELAYTIMER_MAX
|
|
|
|
_POSIX_HOST_NAME_MAX, _POSIX_HOST_NAME_MAX
|
|
|
|
_POSIX_LINK_MAX, _POSIX_LINK_MAX
|
|
|
|
_POSIX_LOGIN_NAME_MAX, _POSIX_LOGIN_NAME_MAX
|
|
|
|
_POSIX_MAX_CANON, _POSIX_MAX_CANON
|
|
|
|
_POSIX_MAX_INPUT, _POSIX_MAX_INPUT
|
|
|
|
_POSIX_MQ_OPEN_MAX, _POSIX_MQ_OPEN_MAX
|
|
|
|
_POSIX_MQ_PRIO_MAX, _POSIX_MQ_PRIO_MAX
|
|
|
|
_POSIX_NAME_MAX, _POSIX_NAME_MAX
|
|
|
|
_POSIX_NGROUPS_MAX, _POSIX_NGROUPS_MAX
|
|
|
|
_POSIX_OPEN_MAX, _POSIX_OPEN_MAX
|
|
|
|
_POSIX_PATH_MAX, _POSIX_PATH_MAX
|
|
|
|
_POSIX_PIPE_BUF, __POSIX_PIPE_BUF
|
|
|
|
_POSIX_RE_DUP_MAX, _POSIX_RE_DUP_MAX
|
|
|
|
_POSIX_RTSIG_MAX, _POSIX_RTSIG_MAX
|
|
|
|
_POSIX_SEM_NSEMS_MAX, _POSIX_SEM_NSEMS_MAX
|
|
|
|
_POSIX_SEM_VALUE_MAX, _POSIX_SEM_VALUE_MAX
|
|
|
|
_POSIX_SIGQUEUE_MAX, _POSIX_SIGQUEUE_MAX
|
|
|
|
_POSIX_SSIZE_MAX, _POSIX_SSIZE_MAX
|
|
|
|
_POSIX_STREAM_MAX, _POSIX_STREAM_MAX
|
|
|
|
_POSIX_SS_REPL_MAX, _POSIX_SS_REPL_MAX
|
|
|
|
_POSIX_SYMLINK_MAX, _POSIX_SYMLINK_MAX
|
|
|
|
_POSIX_SYMLOOP_MAX, _POSIX_SYMLOOP_MAX
|
|
|
|
_POSIX_THREAD_DESTRUCTOR_ITERATIONS, _POSIX_THREAD_DESTRUCTOR_ITERATIONS
|
|
|
|
_POSIX_THREAD_KEYS_MAX, _POSIX_THREAD_KEYS_MAX
|
|
|
|
_POSIX_THREAD_THREADS_MAX, _POSIX_THREAD_THREADS_MAX
|
|
|
|
_POSIX_TIMER_MAX, _POSIX_TIMER_MAX
|
|
|
|
_POSIX_TRACE_EVENT_NAME_MAX, _POSIX_TRACE_EVENT_NAME_MAX
|
|
|
|
_POSIX_TRACE_NAME_MAX, _POSIX_TRACE_NAME_MAX
|
|
|
|
_POSIX_TRACE_SYS_MAX, _POSIX_TRACE_SYS_MAX
|
|
|
|
_POSIX_TRACE_USER_EVENT_MAX, _POSIX_TRACE_USER_EVENT_MAX
|
|
|
|
_POSIX_TTY_NAME_MAX, _POSIX_TTY_NAME_MAX
|
|
|
|
_POSIX_TZNAME_MAX, _POSIX_TZNAME_MAX
|
|
|
|
_POSIX2_BC_BASE_MAX, _POSIX2_BC_BASE_MAX
|
|
|
|
_POSIX2_BC_DIM_MAX, _POSIX2_BC_DIM_MAX
|
|
|
|
_POSIX2_BC_SCALE_MAX, _POSIX2_BC_SCALE_MAX
|
|
|
|
_POSIX2_BC_STRING_MAX, _POSIX2_BC_STRING_MAX
|
|
|
|
_POSIX2_CHARCLASS_NAME_MAX, _POSIX2_CHARCLASS_NAME_MAX
|
|
|
|
_POSIX2_COLL_WEIGHTS_MAX, _POSIX2_COLL_WEIGHTS_MAX
|
2017-01-28 16:30:14 +00:00
|
|
|
_POSIX2_EXPR_NEST_MAX, _POSIX2_EXPR_NEST_MAX
|
2002-09-19 03:39:03 +00:00
|
|
|
_POSIX2_LINE_MAX, _POSIX2_LINE_MAX
|
|
|
|
_POSIX2_RE_DUP_MAX, _POSIX2_RE_DUP_MAX
|
|
|
|
_XOPEN_IOV_MAX, _XOPEN_IOV_MAX
|
|
|
|
_XOPEN_NAME_MAX, _XOPEN_NAME_MAX
|
|
|
|
_XOPEN_PATH_MAX, _XOPEN_PATH_MAX
|
|
|
|
CHAR_BIT, CHAR_BIT
|
|
|
|
CHAR_MAX, CHAR_MAX
|
|
|
|
CHAR_MIN, CHAR_MIN
|
|
|
|
INT_MAX, INT_MAX
|
|
|
|
INT_MIN, INT_MIN
|
|
|
|
LLONG_MIN, LLONG_MIN
|
|
|
|
LLONG_MAX, LLONG_MAX
|
|
|
|
LONG_BIT, LONG_BIT
|
|
|
|
LONG_MAX, LONG_MAX
|
|
|
|
LONG_MIN, LONG_MIN
|
|
|
|
MB_LEN_MAX, MB_LEN_MAX
|
|
|
|
SCHAR_MAX, SCHAR_MAX
|
|
|
|
SCHAR_MIN, SCHAR_MIN
|
|
|
|
SHRT_MAX, SHRT_MAX
|
|
|
|
SHRT_MIN, SHRT_MIN
|
|
|
|
SSIZE_MAX, SSIZE_MAX
|
|
|
|
UCHAR_MAX, UCHAR_MAX
|
|
|
|
UINT_MAX, UINT_MAX
|
|
|
|
ULLONG_MAX, ULLONG_MAX
|
|
|
|
ULONG_MAX, ULONG_MAX
|
|
|
|
USHRT_MAX, USHRT_MAX
|
|
|
|
WORD_BIT, WORD_BIT
|
|
|
|
CHARCLASS_NAME_MAX, CHARCLASS_NAME_MAX
|
|
|
|
NL_ARGMAX, NL_ARGMAX
|
|
|
|
ML_LANGMAX, NL_LANGMAX
|
|
|
|
NL_MSGMAX, NL_MSGMAX
|
|
|
|
NL_NMAX, NL_NMAX
|
|
|
|
NL_SETMAX, NL_SETMAX
|
|
|
|
NL_TEXTMAX, NL_TEXTMAX
|
|
|
|
NZERO, NZERO
|
|
|
|
%%
|
|
|
|
int
|
|
|
|
find_limit(const char *name, intmax_t *value)
|
|
|
|
{
|
|
|
|
const struct map *rv;
|
2017-01-28 16:30:14 +00:00
|
|
|
#ifdef APPLE_GETCONF_UNDERSCORE
|
|
|
|
char *alt;
|
|
|
|
#endif /* APPLE_GETCONF_UNDERSCORE */
|
2002-09-19 03:39:03 +00:00
|
|
|
|
2003-08-22 17:32:07 +00:00
|
|
|
rv = in_word_set(name);
|
2002-09-19 03:39:03 +00:00
|
|
|
if (rv != NULL) {
|
|
|
|
if (rv->valid) {
|
|
|
|
*value = rv->value;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
2017-01-28 16:30:14 +00:00
|
|
|
#ifdef APPLE_GETCONF_UNDERSCORE
|
|
|
|
if(*name == '_')
|
|
|
|
alt = (char *)name + 1;
|
|
|
|
else {
|
|
|
|
if((alt = (char *)alloca(strlen(name) + 2)) == NULL)
|
|
|
|
return 0;
|
|
|
|
*alt = '_';
|
|
|
|
strcpy(alt + 1, name);
|
|
|
|
}
|
|
|
|
rv = in_word_set(alt);
|
|
|
|
if (rv != NULL) {
|
|
|
|
if (rv->valid) {
|
|
|
|
*value = rv->value;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif /* APPLE_GETCONF_UNDERSCORE */
|
2002-09-19 03:39:03 +00:00
|
|
|
return 0;
|
|
|
|
}
|