diff options
author | wollman <wollman@FreeBSD.org> | 2000-04-26 02:36:54 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 2000-04-26 02:36:54 +0000 |
commit | 0da05adfcfd9dcf952e983c96f8a827f4309981f (patch) | |
tree | ad1044f32d7a08228bbe9584fce85e50f7ccb309 /usr.bin/getconf | |
parent | 9ca89dce6cc6b9e9db12a36c546caecb1b8ad893 (diff) | |
download | FreeBSD-src-0da05adfcfd9dcf952e983c96f8a827f4309981f.zip FreeBSD-src-0da05adfcfd9dcf952e983c96f8a827f4309981f.tar.gz |
Hello, getconf. This is a slight reinvention of the
wheel^H^H^H^H^HPOSIX.2 and X/Open utility, and rather
more complicated than necessary.
Diffstat (limited to 'usr.bin/getconf')
-rw-r--r-- | usr.bin/getconf/Makefile | 13 | ||||
-rw-r--r-- | usr.bin/getconf/confstr.gperf | 35 | ||||
-rw-r--r-- | usr.bin/getconf/getconf.1 | 161 | ||||
-rw-r--r-- | usr.bin/getconf/getconf.c | 167 | ||||
-rw-r--r-- | usr.bin/getconf/getconf.h | 35 | ||||
-rw-r--r-- | usr.bin/getconf/pathconf.gperf | 56 | ||||
-rw-r--r-- | usr.bin/getconf/sysconf.gperf | 221 |
7 files changed, 688 insertions, 0 deletions
diff --git a/usr.bin/getconf/Makefile b/usr.bin/getconf/Makefile new file mode 100644 index 0000000..53a7bac --- /dev/null +++ b/usr.bin/getconf/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD$ + +PROG= getconf + +SRCS= confstr.c getconf.c pathconf.c sysconf.c +CLEANFILES+= confstr.c pathconf.c sysconf.c + +.SUFFIXES: .gperf + +.gperf.c: + gperf -t -L ANSI-C -C -k 1,2,7-10,21,'$$' ${.IMPSRC} >${.TARGET} + +.include <bsd.prog.mk> diff --git a/usr.bin/getconf/confstr.gperf b/usr.bin/getconf/confstr.gperf new file mode 100644 index 0000000..637c3ac --- /dev/null +++ b/usr.bin/getconf/confstr.gperf @@ -0,0 +1,35 @@ +%{ +/* + * 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. + */ +static const struct map *in_word_set(const char *str, unsigned int len); + +%} +struct map { char *name; int key; }; +%% +PATH, _CS_PATH +%% +int +find_confstr(const char *name) +{ + const struct map *rv; + + rv = in_word_set(name, strlen(name)); + if (rv != 0) + return rv->key; + else + return -1; +} diff --git a/usr.bin/getconf/getconf.1 b/usr.bin/getconf/getconf.1 new file mode 100644 index 0000000..3aac9ed --- /dev/null +++ b/usr.bin/getconf/getconf.1 @@ -0,0 +1,161 @@ +.\" +.\" Copyright 2000 Massachusetts Institute of Technology +.\" +.\" Permission to use, copy, modify, and distribute this software and +.\" its documentation for any purpose and without fee is hereby +.\" granted, provided that both the above copyright notice and this +.\" permission notice appear in all copies, that both the above +.\" copyright notice and this permission notice appear in all +.\" supporting documentation, and that the name of M.I.T. not be used +.\" in advertising or publicity pertaining to distribution of the +.\" software without specific, written prior permission. M.I.T. makes +.\" no representations about the suitability of this software for any +.\" purpose. It is provided "as is" without express or implied +.\" warranty. +.\" +.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS +.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, +.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT +.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 25, 2000 +.Dt GETCONF 1 +.Os +.Sh NAME +.Nm getconf +.Nd retrieve standard configuration variables +.Sh SYNOPSIS +.Nm getconf +.Op Fl v Ar environment +.Ar path_var +.Ar file +.Pp +.Nm getconf +.Op Fl v Ar environment +.Ar system_var +.Sh DESCRIPTION +The +.Nm getconf +utility outputs the value of +.Tn POSIX +or +.Tn X/Open +system or path configuration variable on the standard output. +If the specified variable is undefined, the string +.Dq Li undefined +is output. +.Pp +The first form of the command, with two mandatory +arguments, retrieves file- and filesystem-specific +configuration variables using +.Xr pathconf 2 . +The second form, with a single argument, retrieves system +configuration variables using +.Xr confstr 3 +and +.Xr sysconf 3 , +depending on the type of variable. +.Pp +All variables use the same name as the manifest constants defined in +the relevant standard C-language bindings, including any leading +underscore or prefix. +That is to say, +.Ar system_var +might be +.Dv ARG_MAX +or +.Dv _POSIX_VERSION , +as opposed to the +.Xr sysconf 3 +names +.Dv _SC_ARG_MAX +or +.Dv _SC_POSIX_VERSION . +(There is one exception: there is no corresponding manifest constant +to +.Dv _CS_PATH , +so a +.Ar system_var +of +.Dq Li PATH +is used.) +.Pp +The +.Fl v Ar environment +option is not supported, but provided for compatibility purposes. +.Sh DIAGNOSTICS +The +.Nm getconf +utility exits 0 on success or >0 if an error occurred. +Use of a +.Ar system_var +or +.Ar path_var +which is completely unknown to the system is considered an error, +causing a diagnostic message to be written to standard error; one +which is known but merely undefined does not result in an error +indication. +.Pp +Use of the unsupported +.Fl v Ar environment +option will result in a diagnostic message indicating that it is not +supported. +.Sh EXAMPLES +The command: +.Bd -literal -offset indent +getconf PATH +.Ed +.Pp +will display the system default setting for the +.Ev PATH +environment variable. +.Pp +The command: +.Bd -literal -offset indent +getconf NAME_MAX /tmp +.Ed +.Pp +will display the maximum length of a filename in the +.Pa /tmp +directory. +.Sh SEE ALSO +.Xr confstr 3 , +.Xr pathconf 2 , +.Xr sysconf 3 +.Sh STANDARDS +The +.Nm getconf +utility is expected to be compliant with +.St -susv2 . +.Sh HISTORY +The +.Nm getconf +command first appeared in +.Fx 5.0 . +.Sh BUGS +The original +.Tn X/Open +specification erroneously requires the return values of +.Xr pathconf 2 +and +.Xr sysconf 3 +to be printed using the +.Xr printf 3 +format specifier +.Li \&"%d" . +We ignore that aspect of the specification and use the +correct +.Li \&"%ld" +format. +.Sh AUTHOR +.An Garrett A. Wollman Aq wollman@lcs.mit.edu diff --git a/usr.bin/getconf/getconf.c b/usr.bin/getconf/getconf.c new file mode 100644 index 0000000..b33f574 --- /dev/null +++ b/usr.bin/getconf/getconf.c @@ -0,0 +1,167 @@ +/* + * Copyright 2000 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include <sys/types.h> + +#include <err.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <sysexits.h> +#include <unistd.h> + +#include "getconf.h" + +static void do_confstr(const char *name, int key); +static void do_sysconf(const char *name, int key); +static void do_pathconf(const char *name, int key, const char *path); + +static void +usage(void) +{ + fprintf(stderr, "usage:\n" + "\tgetconf [-v prog_model] system_var\n" + "\tgetconf [-v prog_model] path_var pathname\n"); + exit(EX_USAGE); +} + +int +main(int argc, char **argv) +{ + int c; + const char *name, *vflag; + int key; + + vflag = 0; + + while ((c = getopt(argc, argv, "v:")) != -1) { + switch (c) { + case 'v': + vflag = optarg; + break; + + default: + usage(); + } + } + + if (vflag) + warnx("-v %s ignored", vflag); + + /* No arguments... */ + if ((name = argv[optind]) == 0) + usage(); + + if (argv[optind + 1] == 0) { /* confstr or sysconf */ + key = find_confstr(name); + if (key >= 0) { + do_confstr(name, key); + } else { + key = find_sysconf(name); + if (key >= 0) + do_sysconf(name, key); + else + errx(EX_USAGE, + "no such configuration parameter `%s'", + name); + } + } else { + key = find_pathconf(name); + if (key >= 0) + do_pathconf(name, key, argv[optind + 1]); + else + errx(EX_USAGE, + "no such path configuration parameter `%s'", + name); + } + return 0; +} + +static void +do_confstr(const char *name, int key) +{ + char *buf; + size_t len; + + len = confstr(key, 0, 0); + if (len < 0) + err(EX_OSERR, "confstr: %s", name); + + if (len == 0) { + printf("undefined\n"); + } else { + buf = alloca(len); + confstr(key, buf, len); + printf("%s\n", buf); + } +} + +static void +do_sysconf(const char *name, int key) +{ + long value; + + errno = 0; + value = sysconf(key); + if (value == -1 && errno != 0) + err(EX_OSERR, "sysconf: %s", name); + else if (value == -1) + printf("undefined\n"); + else + /* + * SUSv2 specifies that the value, if defined, is to be + * printed using the format "%d\n". This is clearly + * erroneous, since sysconf is defined to return a long + * and not an int. + */ + printf("%ld\n", value); +} + +static void +do_pathconf(const char *name, int key, const char *path) +{ + long value; + + errno = 0; + value = pathconf(path, key); + if (value == -1 && errno != 0) + err(EX_OSERR, "pathconf: %s", name); + else if (value == -1) + printf("undefined\n"); + else + /* + * SUSv2 specifies that the value, if defined, is to be + * printed using the format "%d\n". This is clearly + * erroneous, since sysconf is defined to return a long + * and not an int. + */ + printf("%ld\n", value); +} diff --git a/usr.bin/getconf/getconf.h b/usr.bin/getconf/getconf.h new file mode 100644 index 0000000..0cb13c4 --- /dev/null +++ b/usr.bin/getconf/getconf.h @@ -0,0 +1,35 @@ +/* + * Copyright 2000 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * supporting documentation, and that the name of M.I.T. not be used + * in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. M.I.T. makes + * no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +int find_confstr(const char *name); +int find_sysconf(const char *name); +int find_pathconf(const char *name); + diff --git a/usr.bin/getconf/pathconf.gperf b/usr.bin/getconf/pathconf.gperf new file mode 100644 index 0000000..17ca458 --- /dev/null +++ b/usr.bin/getconf/pathconf.gperf @@ -0,0 +1,56 @@ +%{ +/* + * Copyright is disclaimed as to the contents of this file. + * + * $FreeBSD$ + */ + +#include <sys/types.h> + +#include <limits.h> +#include <string.h> +#include <unistd.h> + +#include "getconf.h" + +/* + * Stuff that isn't defined right now -- we want this file to work + * unmodified once it is defined. + */ +#ifndef _PC_FILESIZEBITS +#define _PC_FILESIZEBITS -1 +#endif + +/* + * Override gperf's built-in external scope. + */ +static const struct map *in_word_set(const char *str, unsigned int len); + +%} +struct map { char *name; int key; }; +%% +FILESIZEBITS, _PC_FILESIZEBITS +LINK_MAX, _PC_LINK_MAX +MAX_CANON, _PC_MAX_CANON +MAX_INPUT, _PC_MAX_INPUT +NAME_MAX, _PC_NAME_MAX +PATH_MAX, _PC_PATH_MAX +PIPE_BUF, _PC_PIPE_BUF +_POSIX_CHOWN_RESTRICTED, _PC_CHOWN_RESTRICTED +_POSIX_NO_TRUNC, _PC_NO_TRUNC +_POSIX_VDISABLE, _PC_VDISABLE +_POSIX_ASYNC_IO, _PC_ASYNC_IO +_POSIX_PRIO_IO, _PC_PRIO_IO +_POSIX_SYNC_IO, _PC_SYNC_IO +%% +int +find_pathconf(const char *name) +{ + const struct map *rv; + + rv = in_word_set(name, strlen(name)); + if (rv != 0) + return rv->key; + else + return -1; +} diff --git a/usr.bin/getconf/sysconf.gperf b/usr.bin/getconf/sysconf.gperf new file mode 100644 index 0000000..10e0204 --- /dev/null +++ b/usr.bin/getconf/sysconf.gperf @@ -0,0 +1,221 @@ +%{ +/* + * Copyright is disclaimed as to the contents of this file. + * + * $FreeBSD$ + */ + +#include <sys/types.h> + +#include <limits.h> +#include <string.h> +#include <unistd.h> + +#include "getconf.h" + +/* + * Stuff that isn't defined right now -- we want this file to work + * unmodified once it is defined. + */ +#ifndef _SC_ATEXIT_MAX +#define _SC_ATEXIT_MAX -1 +#endif +#ifndef _SC_TTY_NAME_MAX +#define _SC_TTY_NAME_MAX -1 +#endif +#ifndef _SC_MQ_PRIO_MAX +#define _SC_MQ_PRIO_MAX -1 +#endif +#ifndef _SC_IOV_MAX +#define _SC_IOV_MAX -1 +#endif +#ifndef _SC_XOPEN_REALTIME +#define _SC_XOPEN_REALTIME -1 +#endif +#ifndef _SC_XOPEN_LEGACY +#define _SC_XOPEN_LEGACY -1 +#endif +#ifndef _SC_XCU_VERSION +#define _SC_XCU_VERSION -1 +#endif +#ifndef _SC_PASS_MAX +#define _SC_PASS_MAX -1 +#endif +#ifndef _SC_XOPEN_REALTIME_THREADS +#define _SC_XOPEN_REALTIME_THREADS -1 +#endif +#ifndef _SC_LOGIN_NAME_MAX +#define _SC_LOGIN_NAME_MAX -1 +#endif +#ifndef _SC_XBS5_LP64_OFF64 +#define _SC_XBS5_LP64_OFF64 -1 +#endif +#ifndef _SC_XOPEN_SHM +#define _SC_XOPEN_SHM -1 +#endif +#ifndef _SC_XOPEN_CRYPT +#define _SC_XOPEN_CRYPT -1 +#endif +#ifndef _SC_XOPEN_UNIX +#define _SC_XOPEN_UNIX -1 +#endif +#ifndef _SC_XOPEN_VERSION +#define _SC_XOPEN_VERSION -1 +#endif +#ifndef _SC_THREAD_DESTRUCTOR_ITERATIONS +#define _SC_THREAD_DESTRUCTOR_ITERATIONS -1 +#endif +#ifndef _SC_THREAD_KEYS_MAX +#define _SC_THREAD_KEYS_MAX -1 +#endif +#ifndef _SC_2_C_VERSION +#define _SC_2_C_VERSION -1 +#endif +#ifndef _SC_XBS5_LPBIG_OFFBIG +#define _SC_XBS5_LPBIG_OFFBIG -1 +#endif +#ifndef _SC_THREAD_THREADS_MAX +#define _SC_THREAD_THREADS_MAX -1 +#endif +#ifndef _SC_XBS5_ILP32_OFF32 +#define _SC_XBS5_ILP32_OFF32 -1 +#endif +#ifndef _SC_XBS5_ILP32_OFFBIG +#define _SC_XBS5_ILP32_OFFBIG -1 +#endif +#ifndef _SC_THREAD_STACK_MIN +#define _SC_THREAD_STACK_MIN -1 +#endif +#ifndef _SC_XOPEN_ENH_I18N +#define _SC_XOPEN_ENH_I18N -1 +#endif +#ifndef _SC_THREAD_ATTR_STACKSIZE +#define _SC_THREAD_ATTR_STACKSIZE -1 +#endif +#ifndef _SC_THREAD_PRIORITY_SCHEDULING +#define _SC_THREAD_PRIORITY_SCHEDULING -1 +#endif +#ifndef _SC_THREADS +#define _SC_THREADS -1 +#endif +#ifndef _SC_THREAD_PROCESS_SHARED +#define _SC_THREAD_PROCESS_SHARED -1 +#endif +#ifndef _SC_THREAD_SAFE_FUNCTIONS +#define _SC_THREAD_SAFE_FUNCTIONS -1 +#endif +#ifndef _SC_THREAD_PRIO_PROTECT +#define _SC_THREAD_PRIO_PROTECT -1 +#endif +#ifndef _SC_THREAD_ATTR_STACKADDR +#define _SC_THREAD_ATTR_STACKADDR -1 +#endif +#ifndef _SC_THREAD_PRIO_INHERIT +#define _SC_THREAD_PRIO_INHERIT -1 +#endif + +/* + * Override gperf's built-in external scope. + */ +static const struct map *in_word_set(const char *str, unsigned int len); + +%} +struct map { char *name; int key; }; +%% +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 +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 +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 +TIMER_MAX, _SC_TIMER_MAX +TTY_NAME_MAX, _SC_TTY_NAME_MAX +TZNAME_MAX, _SC_TZNAME_MAX +_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 +_POSIX_FSYNC, _SC_FSYNC +_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 +_POSIX_PRIORITIZED_IO, _SC_PRIORITIZED_IO +_POSIX_PRIORITY_SCHEDULING, _SC_PRIORITY_SCHEDULING +_POSIX_REALTIME_SIGNALS, _SC_REALTIME_SIGNALS +_POSIX_SAVED_IDS, _SC_SAVED_IDS +_POSIX_SEMAPHORES, _SC_SEMAPHORES +_POSIX_SHARED_MEMORY_OBJECTS, _SC_SHARED_MEMORY_OBJECTS +_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 +_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 +_POSIX_THREAD_SAFE_FUNCTIONS, _SC_THREAD_SAFE_FUNCTIONS +_POSIX_TIMERS, _SC_TIMERS +_POSIX_VERSION, _SC_VERSION +_XBS5_ILP32_OFF32, _SC_XBS5_ILP32_OFF32 +_XBS5_ILP32_OFFBIG, _SC_XBS5_ILP32_OFFBIG +_XBS5_LP64_OFF64, _SC_XBS5_LP64_OFF64 +_XBS5_LPBIG_OFFBIG, _SC_XBS5_LPBIG_OFFBIG +_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 +find_sysconf(const char *name) +{ + const struct map *rv; + + rv = in_word_set(name, strlen(name)); + if (rv != 0) + return rv->key; + else + return -1; +} |