2000-04-26 02:36:54 +00:00
|
|
|
%{
|
|
|
|
/*
|
|
|
|
* Copyright is disclaimed as to the contents of this file.
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#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);
|
2000-04-26 02:36:54 +00:00
|
|
|
|
|
|
|
%}
|
2002-09-19 03:39:03 +00:00
|
|
|
struct map { const char *name; int key; int valid; };
|
2000-04-26 02:36:54 +00:00
|
|
|
%%
|
|
|
|
AIO_LISTIO_MAX, _SC_AIO_LISTIO_MAX
|
|
|
|
AIO_MAX, _SC_AIO_MAX
|
|
|
|
AIO_PRIO_DELTA_MAX, _SC_AIO_PRIO_DELTA_MAX
|
|
|
|
ARG_MAX, _SC_ARG_MAX
|
|
|
|
ATEXIT_MAX, _SC_ATEXIT_MAX
|
|
|
|
BC_BASE_MAX, _SC_BC_BASE_MAX
|
|
|
|
BC_DIM_MAX, _SC_BC_DIM_MAX
|
|
|
|
BC_SCALE_MAX, _SC_BC_SCALE_MAX
|
|
|
|
BC_STRING_MAX, _SC_BC_STRING_MAX
|
|
|
|
CHILD_MAX, _SC_CHILD_MAX
|
|
|
|
CLK_TCK, _SC_CLK_TCK
|
|
|
|
COLL_WEIGHTS_MAX, _SC_COLL_WEIGHTS_MAX
|
|
|
|
DELAYTIMER_MAX, _SC_DELAYTIMER_MAX
|
|
|
|
EXPR_NEST_MAX, _SC_EXPR_NEST_MAX
|
2002-09-19 03:39:03 +00:00
|
|
|
GETGR_R_SIZE_MAX, _SC_GETGR_R_SIZE_MAX
|
|
|
|
GETPW_R_SIZE_MAX, _SC_GETPW_R_SIZE_MAX
|
|
|
|
HOST_NAME_MAX, _SC_HOST_NAME_MAX
|
2000-04-26 02:36:54 +00:00
|
|
|
IOV_MAX, _SC_IOV_MAX
|
|
|
|
LINE_MAX, _SC_LINE_MAX
|
|
|
|
LOGIN_NAME_MAX, _SC_LOGIN_NAME_MAX
|
|
|
|
MQ_OPEN_MAX, _SC_MQ_OPEN_MAX
|
|
|
|
MQ_PRIO_MAX, _SC_MQ_PRIO_MAX
|
|
|
|
NGROUPS_MAX, _SC_NGROUPS_MAX
|
2002-09-19 03:39:03 +00:00
|
|
|
NPROCESSORS_CONF, _SC_NPROCESSORS_CONF
|
|
|
|
NPROCESSORS_ONLN, _SC_NPROCESSORS_ONLN
|
2000-04-26 02:36:54 +00:00
|
|
|
OPEN_MAX, _SC_OPEN_MAX
|
|
|
|
PAGESIZE, _SC_PAGESIZE
|
|
|
|
PAGE_SIZE, _SC_PAGESIZE
|
|
|
|
PASS_MAX, _SC_PASS_MAX
|
|
|
|
PTHREAD_DESTRUCTOR_ITERATIONS, _SC_THREAD_DESTRUCTOR_ITERATIONS
|
|
|
|
PTHREAD_KEYS_MAX, _SC_THREAD_KEYS_MAX
|
|
|
|
PTHREAD_STACK_MIN, _SC_THREAD_STACK_MIN
|
|
|
|
PTHREAD_THREADS_MAX, _SC_THREAD_THREADS_MAX
|
|
|
|
RE_DUP_MAX, _SC_RE_DUP_MAX
|
|
|
|
RTSIG_MAX, _SC_RTSIG_MAX
|
|
|
|
SEM_NSEMS_MAX, _SC_SEM_NSEMS_MAX
|
|
|
|
SEM_VALUE_MAX, _SC_SEM_VALUE_MAX
|
|
|
|
SIGQUEUE_MAX, _SC_SIGQUEUE_MAX
|
|
|
|
STREAM_MAX, _SC_STREAM_MAX
|
2002-10-27 04:10:34 +00:00
|
|
|
SYMLOOP_MAX, _SC_SYMLOOP_MAX
|
2000-04-26 02:36:54 +00:00
|
|
|
TIMER_MAX, _SC_TIMER_MAX
|
|
|
|
TTY_NAME_MAX, _SC_TTY_NAME_MAX
|
|
|
|
TZNAME_MAX, _SC_TZNAME_MAX
|
2019-01-11 22:28:18 +00:00
|
|
|
_NPROCESSORS_CONF, _SC_NPROCESSORS_CONF
|
|
|
|
_NPROCESSORS_ONLN, _SC_NPROCESSORS_ONLN
|
2000-04-26 02:36:54 +00:00
|
|
|
_POSIX2_CHAR_TERM, _SC_2_CHAR_TERM
|
|
|
|
_POSIX2_C_BIND, _SC_2_C_BIND
|
|
|
|
_POSIX2_C_DEV, _SC_2_C_DEV
|
|
|
|
_POSIX2_C_VERSION, _SC_2_C_VERSION
|
|
|
|
_POSIX2_FORT_DEV, _SC_2_FORT_DEV
|
|
|
|
_POSIX2_FORT_RUN, _SC_2_FORT_RUN
|
|
|
|
_POSIX2_LOCALEDEF, _SC_2_LOCALEDEF
|
|
|
|
_POSIX2_SW_DEV, _SC_2_SW_DEV
|
|
|
|
_POSIX2_UPE, _SC_2_UPE
|
|
|
|
_POSIX2_VERSION, _SC_2_VERSION
|
|
|
|
_POSIX_ASYNCHRONOUS_IO, _SC_ASYNCHRONOUS_IO
|
2002-09-19 03:39:03 +00:00
|
|
|
_POSIX_BARRIERS, _SC_BARRIERS
|
|
|
|
_POSIX_CLOCK_SELECTION, _SC_CLOCK_SELECTION
|
|
|
|
_POSIX_CPUTIME, _SC_CPUTIME
|
|
|
|
_POSIX_FILE_LOCKING, _SC_FILE_LOCKING
|
2000-04-26 02:36:54 +00:00
|
|
|
_POSIX_FSYNC, _SC_FSYNC
|
2002-10-27 04:10:34 +00:00
|
|
|
_POSIX_IPV6, _SC_IPV6
|
2000-04-26 02:36:54 +00:00
|
|
|
_POSIX_JOB_CONTROL, _SC_JOB_CONTROL
|
|
|
|
_POSIX_MAPPED_FILES, _SC_MAPPED_FILES
|
|
|
|
_POSIX_MEMLOCK, _SC_MEMLOCK
|
|
|
|
_POSIX_MEMLOCK_RANGE, _SC_MEMLOCK_RANGE
|
|
|
|
_POSIX_MEMORY_PROTECTION, _SC_MEMORY_PROTECTION
|
|
|
|
_POSIX_MESSAGE_PASSING, _SC_MESSAGE_PASSING
|
2002-09-19 03:39:03 +00:00
|
|
|
_POSIX_MONOTONIC_CLOCK, _SC_MONOTONIC_CLOCK
|
2000-04-26 02:36:54 +00:00
|
|
|
_POSIX_PRIORITIZED_IO, _SC_PRIORITIZED_IO
|
|
|
|
_POSIX_PRIORITY_SCHEDULING, _SC_PRIORITY_SCHEDULING
|
2002-09-19 03:39:03 +00:00
|
|
|
_POSIX_READER_WRITER_LOCKS, _SC_READER_WRITER_LOCKS
|
2000-04-26 02:36:54 +00:00
|
|
|
_POSIX_REALTIME_SIGNALS, _SC_REALTIME_SIGNALS
|
2002-09-19 03:39:03 +00:00
|
|
|
_POSIX_REGEXP, _SC_REGEXP
|
2000-04-26 02:36:54 +00:00
|
|
|
_POSIX_SAVED_IDS, _SC_SAVED_IDS
|
|
|
|
_POSIX_SEMAPHORES, _SC_SEMAPHORES
|
|
|
|
_POSIX_SHARED_MEMORY_OBJECTS, _SC_SHARED_MEMORY_OBJECTS
|
2002-09-19 03:39:03 +00:00
|
|
|
_POSIX_SHELL, _SC_SHELL
|
|
|
|
_POSIX_SPAWN, _SC_SPAWN
|
|
|
|
_POSIX_SPIN_LOCKS, _SC_SPIN_LOCKS
|
|
|
|
_POSIX_SPORADIC_SERVER, _SC_SPORADIC_SERVER
|
2000-04-26 02:36:54 +00:00
|
|
|
_POSIX_SYNCHRONIZED_IO, _SC_SYNCHRONIZED_IO
|
|
|
|
_POSIX_THREADS, _SC_THREADS
|
|
|
|
_POSIX_THREAD_ATTR_STACKADDR, _SC_THREAD_ATTR_STACKADDR
|
|
|
|
_POSIX_THREAD_ATTR_STACKSIZE, _SC_THREAD_ATTR_STACKSIZE
|
2002-09-19 03:39:03 +00:00
|
|
|
_POSIX_THREAD_CPUTIME, _SC_THREAD_CPUTIME
|
2000-04-26 02:36:54 +00:00
|
|
|
_POSIX_THREAD_PRIORITY_SCHEDULING, _SC_THREAD_PRIORITY_SCHEDULING
|
|
|
|
_POSIX_THREAD_PRIO_INHERIT, _SC_THREAD_PRIO_INHERIT
|
|
|
|
_POSIX_THREAD_PRIO_PROTECT, _SC_THREAD_PRIO_PROTECT
|
|
|
|
_POSIX_THREAD_PROCESS_SHARED, _SC_THREAD_PROCESS_SHARED
|
2002-09-19 03:39:03 +00:00
|
|
|
_POSIX_THREAD_SAFE_FUNCTIONS, _SC_THREAD_SAFE_FUNCTIONS
|
|
|
|
_POSIX_THREAD_SPORADIC_SERVER, _SC_THREAD_SPORADIC_SERVER
|
|
|
|
_POSIX_TIMEOUTS, _SC_TIMEOUTS
|
|
|
|
_POSIX_TRACE, _SC_TRACE
|
|
|
|
_POSIX_TRACE_EVENT_FILTER, _SC_TRACE_EVENT_FILTER
|
|
|
|
_POSIX_TRACE_INHERIT, _SC_TRACE_INHERIT
|
|
|
|
_POSIX_TRACE_LOG, _SC_TRACE_LOG
|
2017-01-28 16:31:23 +00:00
|
|
|
_POSIX_TIMERS, _SC_TIMERS
|
2002-09-19 03:39:03 +00:00
|
|
|
_POSIX_TYPED_MEMORY_OBJECTS, _SC_TYPED_MEMORY_OBJECTS
|
2017-01-28 16:31:23 +00:00
|
|
|
_POSIX_VERSION, _SC_VERSION
|
2002-09-19 03:39:03 +00:00
|
|
|
_POSIX_V6_ILP32_OFF32, _SC_V6_ILP32_OFF32
|
|
|
|
_POSIX_V6_ILP32_OFFBIG, _SC_V6_ILP32_OFFBIG
|
|
|
|
_POSIX_V6_LP64_OFF64, _SC_V6_LP64_OFF64
|
2015-10-19 21:06:30 +00:00
|
|
|
_POSIX_V6_LPBIG_OFFBIG, _SC_V6_LPBIG_OFFBIG
|
2000-04-26 02:36:54 +00:00
|
|
|
_XOPEN_CRYPT, _SC_XOPEN_CRYPT
|
|
|
|
_XOPEN_ENH_I18N, _SC_XOPEN_ENH_I18N
|
|
|
|
_XOPEN_LEGACY, _SC_XOPEN_LEGACY
|
|
|
|
_XOPEN_REALTIME, _SC_XOPEN_REALTIME
|
|
|
|
_XOPEN_REALTIME_THREADS, _SC_XOPEN_REALTIME_THREADS
|
|
|
|
_XOPEN_SHM, _SC_XOPEN_SHM
|
|
|
|
_XOPEN_UNIX, _SC_XOPEN_UNIX
|
|
|
|
_XOPEN_VERSION, _SC_XOPEN_VERSION
|
|
|
|
_XOPEN_XCU_VERSION, _SC_XCU_VERSION
|
|
|
|
%%
|
|
|
|
int
|
2002-09-19 03:39:03 +00:00
|
|
|
find_sysconf(const char *name, int *key)
|
2000-04-26 02:36:54 +00:00
|
|
|
{
|
|
|
|
const struct map *rv;
|
|
|
|
|
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) {
|
|
|
|
*key = rv->key;
|
|
|
|
return 1;
|
|
|
|
}
|
2000-04-26 02:36:54 +00:00
|
|
|
return -1;
|
2002-09-19 03:39:03 +00:00
|
|
|
}
|
|
|
|
return 0;
|
2000-04-26 02:36:54 +00:00
|
|
|
}
|
2017-09-15 22:55:15 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
foreach_sysconf(void (*func)(const char *, int))
|
|
|
|
{
|
|
|
|
const struct map *mp;
|
|
|
|
|
|
|
|
for (mp = wordlist; mp->name != NULL; mp++) {
|
|
|
|
if (mp->valid)
|
|
|
|
func(mp->name, mp->key);
|
|
|
|
}
|
|
|
|
}
|