xref: /titanic_52/usr/src/cmd/getconf/getconf.c (revision 1cfc4fb76704c672a9934898be440d8e012cebd4)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
58ef5f9c7Schin  * Common Development and Distribution License (the "License").
68ef5f9c7Schin  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21019c3c43Sraf 
227c478bd9Sstevel@tonic-gate /*
233b862e9aSRoger A. Faulkner  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*
287c478bd9Sstevel@tonic-gate  * Copyright 1985, 1993 by Mortice Kern Systems Inc.  All rights reserved.
297c478bd9Sstevel@tonic-gate  *
307c478bd9Sstevel@tonic-gate  */
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /*
337c478bd9Sstevel@tonic-gate  * getconf -- POSIX.2 compatible utility to query configuration specific
347c478bd9Sstevel@tonic-gate  *	      parameters.
357c478bd9Sstevel@tonic-gate  *         -- XPG4 support added June/93
367c478bd9Sstevel@tonic-gate  *
377c478bd9Sstevel@tonic-gate  *         -- XPG5 support added Dec/97
387c478bd9Sstevel@tonic-gate  *
397c478bd9Sstevel@tonic-gate  *         -- XPG6 support added May/2003
407c478bd9Sstevel@tonic-gate  */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #include <stdio.h>
437c478bd9Sstevel@tonic-gate #include <stdlib.h>
447c478bd9Sstevel@tonic-gate #include <string.h>
457c478bd9Sstevel@tonic-gate #include <errno.h>
467c478bd9Sstevel@tonic-gate #include <unistd.h>
477c478bd9Sstevel@tonic-gate #include <limits.h>
487c478bd9Sstevel@tonic-gate #include <locale.h>
497c478bd9Sstevel@tonic-gate #include <libintl.h>
507c478bd9Sstevel@tonic-gate #include <assert.h>
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate extern size_t confstr(int, char *, size_t);
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate static int aflag = 0;
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate #define	INVAL_ARG	"getconf: Invalid argument (%s)\n"
577c478bd9Sstevel@tonic-gate #define	INVAL_PATHARG	"getconf: Invalid argument (%s or %s)\n"
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /*
607c478bd9Sstevel@tonic-gate  *  Notes:
617c478bd9Sstevel@tonic-gate  *  The sctab.value field is defined to be a long.
627c478bd9Sstevel@tonic-gate  *  There are some values that are "unsigned long"; these values
637c478bd9Sstevel@tonic-gate  *  can be stored in a "long" field but when output, must be printed
647c478bd9Sstevel@tonic-gate  *  as an unsigned value. Thus, these values must have UNSIGNED_VALUE bit
657c478bd9Sstevel@tonic-gate  *  set in sctab.flag field.
667c478bd9Sstevel@tonic-gate  *
677c478bd9Sstevel@tonic-gate  *  There are 2 different ways to indicate a symbol is undefined:
687c478bd9Sstevel@tonic-gate  *     1) sctab.flag = UNDEFINED
697c478bd9Sstevel@tonic-gate  *     2) or sctab.value = -1 (and if !UNDEFINED and !UNSIGNED_VALUE)
707c478bd9Sstevel@tonic-gate  *
717c478bd9Sstevel@tonic-gate  *  There are a group of symbols (e.g CHAR_MIN, INT_MAX, INT_MIN, LONG_BIT ...)
727c478bd9Sstevel@tonic-gate  *  which we may set to -1 if they are not pre-defined in a system header file.
737c478bd9Sstevel@tonic-gate  *  This is used to indicate that these symbols are "undefined".
747c478bd9Sstevel@tonic-gate  *  We are assuming that these symbols cannot reasonably have a value of -1
757c478bd9Sstevel@tonic-gate  *  if they were defined in a system header file.
767c478bd9Sstevel@tonic-gate  *  (Unless of course -1 can be used to indicate "undefined" for that symbol)
777c478bd9Sstevel@tonic-gate  */
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate static struct sctab {
807c478bd9Sstevel@tonic-gate 	long value;
817c478bd9Sstevel@tonic-gate 	char *name;
827c478bd9Sstevel@tonic-gate 	enum { SELFCONF, SYSCONF, PATHCONF, CONFSTR } type;
837c478bd9Sstevel@tonic-gate 	int flag;
847c478bd9Sstevel@tonic-gate /* bit fields for sctab.flag member */
857c478bd9Sstevel@tonic-gate #define	NOFLAGS		0	/* no special indicators */
867c478bd9Sstevel@tonic-gate #define	UNDEFINED	1	/* value is known undefined at compile time */
877c478bd9Sstevel@tonic-gate #define	UNSIGNED_VALUE	2	/* value is an unsigned */
887c478bd9Sstevel@tonic-gate } sctab[] = {
897c478bd9Sstevel@tonic-gate /*
907c478bd9Sstevel@tonic-gate  * Some entries in this structure have both leading _ and non leading _
917c478bd9Sstevel@tonic-gate  * versions for compatibility with various versions of the specifications.
927c478bd9Sstevel@tonic-gate  * It is not expected that both forms will be required for new entries.
937c478bd9Sstevel@tonic-gate  */
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate 	/* POSIX.2-1992 table 2-17 */
967c478bd9Sstevel@tonic-gate 	_POSIX2_BC_BASE_MAX,	"POSIX2_BC_BASE_MAX",	SELFCONF,   NOFLAGS,
977c478bd9Sstevel@tonic-gate 	_POSIX2_BC_BASE_MAX,	"_POSIX2_BC_BASE_MAX",	SELFCONF,  NOFLAGS,
987c478bd9Sstevel@tonic-gate 	_POSIX2_BC_DIM_MAX,	"POSIX2_BC_DIM_MAX",	SELFCONF,   NOFLAGS,
997c478bd9Sstevel@tonic-gate 	_POSIX2_BC_DIM_MAX,	"_POSIX2_BC_DIM_MAX",	SELFCONF,  NOFLAGS,
1007c478bd9Sstevel@tonic-gate 	_POSIX2_BC_SCALE_MAX,	"POSIX2_BC_SCALE_MAX",	SELFCONF,   NOFLAGS,
1017c478bd9Sstevel@tonic-gate 	_POSIX2_BC_SCALE_MAX,	"_POSIX2_BC_SCALE_MAX",	SELFCONF,  NOFLAGS,
1027c478bd9Sstevel@tonic-gate 	_POSIX2_BC_STRING_MAX,	"POSIX2_BC_STRING_MAX",	SELFCONF,   NOFLAGS,
1037c478bd9Sstevel@tonic-gate 	_POSIX2_BC_STRING_MAX,	"_POSIX2_BC_STRING_MAX", SELFCONF, NOFLAGS,
1047c478bd9Sstevel@tonic-gate 	_POSIX2_COLL_WEIGHTS_MAX, "POSIX2_COLL_WEIGHTS_MAX", SELFCONF,  NOFLAGS,
1057c478bd9Sstevel@tonic-gate 	_POSIX2_COLL_WEIGHTS_MAX, "_POSIX2_COLL_WEIGHTS_MAX", SELFCONF, NOFLAGS,
1067c478bd9Sstevel@tonic-gate 	_POSIX2_EXPR_NEST_MAX,	"POSIX2_EXPR_NEST_MAX",	SELFCONF,   NOFLAGS,
1077c478bd9Sstevel@tonic-gate 	_POSIX2_EXPR_NEST_MAX,	"_POSIX2_EXPR_NEST_MAX", SELFCONF,   NOFLAGS,
1087c478bd9Sstevel@tonic-gate 	_POSIX2_LINE_MAX,	"POSIX2_LINE_MAX",	SELFCONF,   NOFLAGS,
1097c478bd9Sstevel@tonic-gate 	_POSIX2_LINE_MAX,	"_POSIX2_LINE_MAX",	SELFCONF,  NOFLAGS,
1107c478bd9Sstevel@tonic-gate 	_POSIX2_RE_DUP_MAX,	"POSIX2_RE_DUP_MAX",	SELFCONF,   NOFLAGS,
1117c478bd9Sstevel@tonic-gate 	_POSIX2_RE_DUP_MAX,	"_POSIX2_RE_DUP_MAX",	SELFCONF,   NOFLAGS,
1127c478bd9Sstevel@tonic-gate 	/* See limits.h section below for _POSIX_RE_DUP_MAX */
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate 	/* UNIX 98 */
1157c478bd9Sstevel@tonic-gate 	_POSIX_AIO_LISTIO_MAX,	"_POSIX_AIO_LISTIO_MAX", SELFCONF, 	NOFLAGS,
1167c478bd9Sstevel@tonic-gate 	_POSIX_AIO_MAX,		"_POSIX_AIO_MAX",	 SELFCONF, 	NOFLAGS,
1177c478bd9Sstevel@tonic-gate 	_POSIX_DELAYTIMER_MAX,	"_POSIX_DELAYTIMER_MAX", SELFCONF, 	NOFLAGS,
1187c478bd9Sstevel@tonic-gate 	_POSIX_LOGIN_NAME_MAX,	"_POSIX_LOGIN_NAME_MAX", SELFCONF, 	NOFLAGS,
1197c478bd9Sstevel@tonic-gate 	_POSIX_MQ_OPEN_MAX,	"_POSIX_MQ_OPEN_MAX",	 SELFCONF, 	NOFLAGS,
1207c478bd9Sstevel@tonic-gate 	_POSIX_MQ_PRIO_MAX,	"_POSIX_MQ_PRIO_MAX",	 SELFCONF, 	NOFLAGS,
1217c478bd9Sstevel@tonic-gate 	_POSIX_RTSIG_MAX,	"_POSIX_RTSIG_MAX",	 SELFCONF,	NOFLAGS,
1227c478bd9Sstevel@tonic-gate 	_POSIX_SEM_NSEMS_MAX,	"_POSIX_SEM_NSEMS_MAX",	 SELFCONF,	NOFLAGS,
1237c478bd9Sstevel@tonic-gate 	_POSIX_SEM_VALUE_MAX,	"_POSIX_SEM_VALUE_MAX",	 SELFCONF,	NOFLAGS,
1247c478bd9Sstevel@tonic-gate 	_POSIX_SIGQUEUE_MAX,	"_POSIX_SIGQUEUE_MAX",	 SELFCONF,	NOFLAGS,
1257c478bd9Sstevel@tonic-gate 	_POSIX_TTY_NAME_MAX,	"_POSIX_TTY_NAME_MAX",	 SELFCONF,	NOFLAGS,
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate 	/* UNIX 03 */
1287c478bd9Sstevel@tonic-gate 	_POSIX_HOST_NAME_MAX,	"_POSIX_HOST_NAME_MAX",	  SELFCONF,   NOFLAGS,
1297c478bd9Sstevel@tonic-gate 	_POSIX_RE_DUP_MAX,	"_POSIX_RE_DUP_MAX",	  SELFCONF,   NOFLAGS,
1307c478bd9Sstevel@tonic-gate 	_POSIX_CLOCKRES_MIN,	"_POSIX_CLOCKRES_MIN",	  SELFCONF,   NOFLAGS,
1317c478bd9Sstevel@tonic-gate 	_POSIX_SYMLINK_MAX,	"_POSIX_SYMLINK_MAX",	  SELFCONF,   NOFLAGS,
1327c478bd9Sstevel@tonic-gate 	_POSIX_SYMLOOP_MAX,	"_POSIX_SYMLOOP_MAX",	  SELFCONF,   NOFLAGS,
1337c478bd9Sstevel@tonic-gate 	CHARCLASS_NAME_MAX, "_POSIX2_CHARCLASS_NAME_MAX", SELFCONF,   NOFLAGS,
1347c478bd9Sstevel@tonic-gate 
1357c478bd9Sstevel@tonic-gate 	/* POSIX.2-1992 table 2-17 */
1367c478bd9Sstevel@tonic-gate 	_SC_2_VERSION,		"POSIX2_VERSION",	SYSCONF,   NOFLAGS,
1377c478bd9Sstevel@tonic-gate 	_SC_2_VERSION,		"_POSIX2_VERSION",	SYSCONF,   NOFLAGS,
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate 	/* POSIX.2-1992 table 2-18 */
1407c478bd9Sstevel@tonic-gate 	_SC_BC_BASE_MAX,	"BC_BASE_MAX",		SYSCONF,   NOFLAGS,
1417c478bd9Sstevel@tonic-gate 	_SC_BC_DIM_MAX,		"BC_DIM_MAX",		SYSCONF,   NOFLAGS,
1427c478bd9Sstevel@tonic-gate 	_SC_BC_SCALE_MAX,	"BC_SCALE_MAX",		SYSCONF,   NOFLAGS,
1437c478bd9Sstevel@tonic-gate 	_SC_BC_STRING_MAX,	"BC_STRING_MAX",	SYSCONF,   NOFLAGS,
1447c478bd9Sstevel@tonic-gate 	_SC_COLL_WEIGHTS_MAX,	"COLL_WEIGHTS_MAX",	SYSCONF,   NOFLAGS,
1457c478bd9Sstevel@tonic-gate 	_SC_EXPR_NEST_MAX,	"EXPR_NEST_MAX",	SYSCONF,   NOFLAGS,
1467c478bd9Sstevel@tonic-gate 	_SC_LINE_MAX,		"LINE_MAX",		SYSCONF,   NOFLAGS,
1477c478bd9Sstevel@tonic-gate 	_SC_RE_DUP_MAX,		"RE_DUP_MAX",		SYSCONF,   NOFLAGS,
1487c478bd9Sstevel@tonic-gate 
1497c478bd9Sstevel@tonic-gate 	/* POSIX.2-1992 table 2-19 */
1507c478bd9Sstevel@tonic-gate 	_SC_2_C_BIND,		"POSIX2_C_BIND",	SYSCONF,   NOFLAGS,
1517c478bd9Sstevel@tonic-gate 	_SC_2_C_BIND,		"_POSIX2_C_BIND",	SYSCONF,   NOFLAGS,
1527c478bd9Sstevel@tonic-gate 	_SC_2_C_DEV,		"POSIX2_C_DEV",		SYSCONF,   NOFLAGS,
1537c478bd9Sstevel@tonic-gate 	_SC_2_C_DEV,		"_POSIX2_C_DEV",	SYSCONF,   NOFLAGS,
1547c478bd9Sstevel@tonic-gate 	_SC_2_CHAR_TERM,	"POSIX2_CHAR_TERM",	SYSCONF,   NOFLAGS,
1557c478bd9Sstevel@tonic-gate 	_SC_2_CHAR_TERM,	"_POSIX2_CHAR_TERM",	SYSCONF,   NOFLAGS,
1567c478bd9Sstevel@tonic-gate 	_SC_2_FORT_DEV,		"POSIX2_FORT_DEV",	SYSCONF,   NOFLAGS,
1577c478bd9Sstevel@tonic-gate 	_SC_2_FORT_DEV,		"_POSIX2_FORT_DEV",	SYSCONF,   NOFLAGS,
1587c478bd9Sstevel@tonic-gate 	_SC_2_FORT_RUN,		"POSIX2_FORT_RUN",	SYSCONF,   NOFLAGS,
1597c478bd9Sstevel@tonic-gate 	_SC_2_FORT_RUN,		"_POSIX2_FORT_RUN",	SYSCONF,   NOFLAGS,
1607c478bd9Sstevel@tonic-gate 	_SC_2_LOCALEDEF,	"POSIX2_LOCALEDEF",	SYSCONF,   NOFLAGS,
1617c478bd9Sstevel@tonic-gate 	_SC_2_LOCALEDEF,	"_POSIX2_LOCALEDEF",	SYSCONF,   NOFLAGS,
1627c478bd9Sstevel@tonic-gate 	_SC_2_SW_DEV,		"POSIX2_SW_DEV",	SYSCONF,   NOFLAGS,
1637c478bd9Sstevel@tonic-gate 	_SC_2_SW_DEV,		"_POSIX2_SW_DEV",	SYSCONF,   NOFLAGS,
1647c478bd9Sstevel@tonic-gate 	_SC_2_UPE,		"POSIX2_UPE",		SYSCONF,   NOFLAGS,
1657c478bd9Sstevel@tonic-gate 	_SC_2_UPE,		"_POSIX2_UPE",		SYSCONF,   NOFLAGS,
1667c478bd9Sstevel@tonic-gate 
1677c478bd9Sstevel@tonic-gate 	/* POSIX.1-1990 table 2-3 */
1687c478bd9Sstevel@tonic-gate 	_POSIX_ARG_MAX,		"_POSIX_ARG_MAX",	SELFCONF,   NOFLAGS,
1697c478bd9Sstevel@tonic-gate 	_POSIX_CHILD_MAX,	"_POSIX_CHILD_MAX",	SELFCONF,   NOFLAGS,
1707c478bd9Sstevel@tonic-gate 	_POSIX_LINK_MAX,	"_POSIX_LINK_MAX",	SELFCONF,   NOFLAGS,
1717c478bd9Sstevel@tonic-gate 	_POSIX_MAX_CANON,	"_POSIX_MAX_CANON",	SELFCONF,   NOFLAGS,
1727c478bd9Sstevel@tonic-gate 	_POSIX_MAX_INPUT,	"_POSIX_MAX_INPUT",	SELFCONF,   NOFLAGS,
1737c478bd9Sstevel@tonic-gate 	_POSIX_NAME_MAX,	"_POSIX_NAME_MAX",	SELFCONF,   NOFLAGS,
1747c478bd9Sstevel@tonic-gate 	_POSIX_NGROUPS_MAX,	"_POSIX_NGROUPS_MAX",	SELFCONF,   NOFLAGS,
1757c478bd9Sstevel@tonic-gate 	_POSIX_OPEN_MAX,	"_POSIX_OPEN_MAX",	SELFCONF,   NOFLAGS,
1767c478bd9Sstevel@tonic-gate 	_POSIX_PATH_MAX,	"_POSIX_PATH_MAX",	SELFCONF,   NOFLAGS,
1777c478bd9Sstevel@tonic-gate 	_POSIX_PIPE_BUF,	"_POSIX_PIPE_BUF",	SELFCONF,   NOFLAGS,
1787c478bd9Sstevel@tonic-gate 	_POSIX_SSIZE_MAX,	"_POSIX_SSIZE_MAX",	SELFCONF,   NOFLAGS,
1797c478bd9Sstevel@tonic-gate 	_POSIX_STREAM_MAX,	"_POSIX_STREAM_MAX",	SELFCONF,   NOFLAGS,
1807c478bd9Sstevel@tonic-gate 	_POSIX_TIMER_MAX,	"_POSIX_TIMER_MAX",	SELFCONF,   NOFLAGS,
1817c478bd9Sstevel@tonic-gate 	_POSIX_THREAD_DESTRUCTOR_ITERATIONS,
1827c478bd9Sstevel@tonic-gate 		"_POSIX_THREAD_DESTRUCTOR_ITERATIONS",	SELFCONF,   NOFLAGS,
1837c478bd9Sstevel@tonic-gate 	_POSIX_THREAD_KEYS_MAX,
1847c478bd9Sstevel@tonic-gate 		"_POSIX_THREAD_KEYS_MAX",		SELFCONF,   NOFLAGS,
1857c478bd9Sstevel@tonic-gate 	_POSIX_THREAD_THREADS_MAX,
1867c478bd9Sstevel@tonic-gate 		"_POSIX_THREAD_THREADS_MAX",		SELFCONF,   NOFLAGS,
1877c478bd9Sstevel@tonic-gate 	_POSIX_TZNAME_MAX,	"_POSIX_TZNAME_MAX",	SELFCONF,   NOFLAGS,
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate 	/* POSIX.1-1990 table 4-2 */
1907c478bd9Sstevel@tonic-gate 	_SC_ARG_MAX,		"ARG_MAX",		SYSCONF,   NOFLAGS,
1917c478bd9Sstevel@tonic-gate 	_SC_CHILD_MAX,		"CHILD_MAX",		SYSCONF,   NOFLAGS,
1927c478bd9Sstevel@tonic-gate 	_SC_CLK_TCK,		"CLK_TCK",		SYSCONF,   NOFLAGS,
1937c478bd9Sstevel@tonic-gate 	_SC_JOB_CONTROL,	"_POSIX_JOB_CONTROL",	SYSCONF,   NOFLAGS,
1947c478bd9Sstevel@tonic-gate 	_SC_NGROUPS_MAX,	"NGROUPS_MAX",		SYSCONF,   NOFLAGS,
1957c478bd9Sstevel@tonic-gate 	_SC_OPEN_MAX,		"OPEN_MAX",		SYSCONF,   NOFLAGS,
1967c478bd9Sstevel@tonic-gate 	_SC_SAVED_IDS,		"_POSIX_SAVED_IDS",	SYSCONF,   NOFLAGS,
1977c478bd9Sstevel@tonic-gate 	_SC_STREAM_MAX,		"STREAM_MAX",		SYSCONF,   NOFLAGS,
1987c478bd9Sstevel@tonic-gate 	_SC_TZNAME_MAX,		"TZNAME_MAX",		SYSCONF,   NOFLAGS,
1997c478bd9Sstevel@tonic-gate 	_SC_VERSION,		"_POSIX_VERSION",	SYSCONF,   NOFLAGS,
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate 	/* pathconf() variables */
2027c478bd9Sstevel@tonic-gate 
2037c478bd9Sstevel@tonic-gate 	/* POSIX.1-1990 table 5-2 */
2047c478bd9Sstevel@tonic-gate 
2057c478bd9Sstevel@tonic-gate 	_PC_LINK_MAX,		"LINK_MAX",		PATHCONF,  NOFLAGS,
2067c478bd9Sstevel@tonic-gate 	_PC_MAX_CANON,		"MAX_CANON",		PATHCONF,  NOFLAGS,
2077c478bd9Sstevel@tonic-gate 	_PC_MAX_INPUT,		"MAX_INPUT",		PATHCONF,  NOFLAGS,
2087c478bd9Sstevel@tonic-gate 	_PC_NAME_MAX,		"NAME_MAX",		PATHCONF,  NOFLAGS,
2097c478bd9Sstevel@tonic-gate 	_PC_PATH_MAX,		"PATH_MAX",		PATHCONF,  NOFLAGS,
2107c478bd9Sstevel@tonic-gate 	_PC_PIPE_BUF,		"PIPE_BUF",		PATHCONF,  NOFLAGS,
2117c478bd9Sstevel@tonic-gate 	_PC_CHOWN_RESTRICTED,	"_POSIX_CHOWN_RESTRICTED", PATHCONF,  NOFLAGS,
2127c478bd9Sstevel@tonic-gate 	_PC_NO_TRUNC,		"_POSIX_NO_TRUNC",	PATHCONF,  NOFLAGS,
2137c478bd9Sstevel@tonic-gate 	_PC_VDISABLE,		"_POSIX_VDISABLE",	PATHCONF,  NOFLAGS,
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate 	/* UNIX 98 additions */
2167c478bd9Sstevel@tonic-gate 
2177c478bd9Sstevel@tonic-gate 	_PC_ASYNC_IO,		"_POSIX_ASYNC_IO",	PATHCONF,  NOFLAGS,
2187c478bd9Sstevel@tonic-gate 	_PC_PRIO_IO,		"_POSIX_PRIO_IO",	PATHCONF,  NOFLAGS,
2197c478bd9Sstevel@tonic-gate 	_PC_SYNC_IO,		"_POSIX_SYNC_IO",	PATHCONF,  NOFLAGS,
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate 	/* Large File Summit name (UNIX 98) */
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate 	_PC_FILESIZEBITS,	"FILESIZEBITS",		PATHCONF,  NOFLAGS,
224*1cfc4fb7SDavid Höppner 	_PC_XATTR_ENABLED,	"XATTR_ENABLED",	PATHCONF,  NOFLAGS,
225*1cfc4fb7SDavid Höppner 	_PC_XATTR_EXISTS,	"XATTR_EXISTS",		PATHCONF,  NOFLAGS,
2267c478bd9Sstevel@tonic-gate 
2277c478bd9Sstevel@tonic-gate 	/* UNIX 03 Additions */
2287c478bd9Sstevel@tonic-gate 
229019c3c43Sraf 	/* Advisory Information (ADV) */
2307c478bd9Sstevel@tonic-gate 	_PC_ALLOC_SIZE_MIN,	"POSIX_ALLOC_SIZE_MIN",	PATHCONF,  NOFLAGS,
2317c478bd9Sstevel@tonic-gate 	_PC_REC_INCR_XFER_SIZE,	"POSIX_REC_INCR_XFER_SIZE", PATHCONF,  NOFLAGS,
2327c478bd9Sstevel@tonic-gate 	_PC_REC_MAX_XFER_SIZE,	"POSIX_REC_MAX_XFER_SIZE",  PATHCONF,  NOFLAGS,
2337c478bd9Sstevel@tonic-gate 	_PC_REC_MIN_XFER_SIZE,	"POSIX_REC_MIN_XFER_SIZE",  PATHCONF,  NOFLAGS,
2347c478bd9Sstevel@tonic-gate 	_PC_REC_XFER_ALIGN,	"POSIX_REC_XFER_ALIGN",	PATHCONF,  NOFLAGS,
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate 	_PC_2_SYMLINKS,		"POSIX2_SYMLINKS",	PATHCONF,  NOFLAGS,
2377c478bd9Sstevel@tonic-gate 	_PC_SYMLINK_MAX,	"SYMLINK_MAX",		PATHCONF,  NOFLAGS,
2387c478bd9Sstevel@tonic-gate 
239*1cfc4fb7SDavid Höppner 	_PC_ACL_ENABLED,	"ACL_ENABLED",		PATHCONF,  NOFLAGS,
240*1cfc4fb7SDavid Höppner 	_PC_MIN_HOLE_SIZE,	"MIN_HOLE_SIZE",	PATHCONF,  NOFLAGS,
241*1cfc4fb7SDavid Höppner 	_PC_SATTR_ENABLED,	"SATTR_ENABLED",	PATHCONF,  NOFLAGS,
242*1cfc4fb7SDavid Höppner 	_PC_SATTR_EXISTS,	"SATTR_EXISTS",		PATHCONF,  NOFLAGS,
243*1cfc4fb7SDavid Höppner 
2443b862e9aSRoger A. Faulkner 	/* UNIX 08 additions */
2453b862e9aSRoger A. Faulkner 
2463b862e9aSRoger A. Faulkner 	_PC_TIMESTAMP_RESOLUTION, "_POSIX_TIMESTAMP_RESOLUTION",
2473b862e9aSRoger A. Faulkner 	    PATHCONF,	NOFLAGS,
2483b862e9aSRoger A. Faulkner 
2497c478bd9Sstevel@tonic-gate 	/* confstr() variables */
2507c478bd9Sstevel@tonic-gate 
2517c478bd9Sstevel@tonic-gate 	/* POSIX.2-1992 description of getconf utility */
2527c478bd9Sstevel@tonic-gate 	_CS_PATH,		"PATH",			CONFSTR,   NOFLAGS,
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate 	/* POSIX.2-1992 table B-18 */
2557c478bd9Sstevel@tonic-gate 	_CS_PATH,		"CS_PATH",		CONFSTR,   NOFLAGS,
2567c478bd9Sstevel@tonic-gate 	_CS_PATH,		"_CS_PATH",		CONFSTR,   NOFLAGS,
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate 	/* command names for large file configuration information */
2597c478bd9Sstevel@tonic-gate 	/* large file compilation environment configuration */
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate 	_CS_LFS_CFLAGS,		"LFS_CFLAGS",		CONFSTR,   NOFLAGS,
2627c478bd9Sstevel@tonic-gate 	_CS_LFS_LDFLAGS,	"LFS_LDFLAGS",		CONFSTR,   NOFLAGS,
2637c478bd9Sstevel@tonic-gate 	_CS_LFS_LIBS,		"LFS_LIBS",		CONFSTR,   NOFLAGS,
2647c478bd9Sstevel@tonic-gate 	_CS_LFS_LINTFLAGS,	"LFS_LINTFLAGS",	CONFSTR,   NOFLAGS,
2657c478bd9Sstevel@tonic-gate 
2667c478bd9Sstevel@tonic-gate 	/* transitional large file interface configuration */
2677c478bd9Sstevel@tonic-gate 
2687c478bd9Sstevel@tonic-gate 	_CS_LFS64_CFLAGS,	"LFS64_CFLAGS",		CONFSTR,   NOFLAGS,
2697c478bd9Sstevel@tonic-gate 	_CS_LFS64_LDFLAGS,	"LFS64_LDFLAGS",	CONFSTR,   NOFLAGS,
2707c478bd9Sstevel@tonic-gate 	_CS_LFS64_LIBS,		"LFS64_LIBS",		CONFSTR,   NOFLAGS,
2717c478bd9Sstevel@tonic-gate 	_CS_LFS64_LINTFLAGS,	"LFS64_LINTFLAGS",	CONFSTR,   NOFLAGS,
2727c478bd9Sstevel@tonic-gate 
2737c478bd9Sstevel@tonic-gate 	/*
2747c478bd9Sstevel@tonic-gate 	 *  UNIX 98:
2757c478bd9Sstevel@tonic-gate 	 *  confstr additions, these support
2767c478bd9Sstevel@tonic-gate 	 *  programming specifications/environments.
2777c478bd9Sstevel@tonic-gate 	 *
2787c478bd9Sstevel@tonic-gate 	 * Unfortunately there is some uncertainty with
2797c478bd9Sstevel@tonic-gate 	 * the standard at this point about the constant
2807c478bd9Sstevel@tonic-gate 	 * name, thus we need to recognize BOTH with and
2817c478bd9Sstevel@tonic-gate 	 * without the initial underscore.
2827c478bd9Sstevel@tonic-gate 	 */
2837c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFF32_CFLAGS,	"XBS5_ILP32_OFF32_CFLAGS",
2847c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
2857c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFF32_CFLAGS,	"_XBS5_ILP32_OFF32_CFLAGS",
2867c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFF32_LDFLAGS,	"XBS5_ILP32_OFF32_LDFLAGS",
2897c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
2907c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFF32_LDFLAGS,	"_XBS5_ILP32_OFF32_LDFLAGS",
2917c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
2927c478bd9Sstevel@tonic-gate 
2937c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFF32_LIBS,	"XBS5_ILP32_OFF32_LIBS",
2947c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
2957c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFF32_LIBS,	"_XBS5_ILP32_OFF32_LIBS",
2967c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFF32_LINTFLAGS,	"XBS5_ILP32_OFF32_LINTFLAGS",
2997c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3007c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFF32_LINTFLAGS,	"_XBS5_ILP32_OFF32_LINTFLAGS",
3017c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFFBIG_CFLAGS,	"XBS5_ILP32_OFFBIG_CFLAGS",
3047c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3057c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFFBIG_CFLAGS,	"_XBS5_ILP32_OFFBIG_CFLAGS",
3067c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3077c478bd9Sstevel@tonic-gate 
3087c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFFBIG_LDFLAGS,	"XBS5_ILP32_OFFBIG_LDFLAGS",
3097c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3107c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFFBIG_LDFLAGS,	"_XBS5_ILP32_OFFBIG_LDFLAGS",
3117c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3127c478bd9Sstevel@tonic-gate 
3137c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFFBIG_LIBS,	"XBS5_ILP32_OFFBIG_LIBS",
3147c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3157c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFFBIG_LIBS,	"_XBS5_ILP32_OFFBIG_LIBS",
3167c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFFBIG_LINTFLAGS, "XBS5_ILP32_OFFBIG_LINTFLAGS",
3197c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3207c478bd9Sstevel@tonic-gate 	_CS_XBS5_ILP32_OFFBIG_LINTFLAGS, "_XBS5_ILP32_OFFBIG_LINTFLAGS",
3217c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3227c478bd9Sstevel@tonic-gate 
3237c478bd9Sstevel@tonic-gate 	_CS_XBS5_LP64_OFF64_CFLAGS,	"XBS5_LP64_OFF64_CFLAGS",
3247c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3257c478bd9Sstevel@tonic-gate 	_CS_XBS5_LP64_OFF64_CFLAGS,	"_XBS5_LP64_OFF64_CFLAGS",
3267c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3277c478bd9Sstevel@tonic-gate 
3287c478bd9Sstevel@tonic-gate 	_CS_XBS5_LP64_OFF64_LDFLAGS,	"XBS5_LP64_OFF64_LDFLAGS",
3297c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3307c478bd9Sstevel@tonic-gate 	_CS_XBS5_LP64_OFF64_LDFLAGS,	"_XBS5_LP64_OFF64_LDFLAGS",
3317c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3327c478bd9Sstevel@tonic-gate 
3337c478bd9Sstevel@tonic-gate 	_CS_XBS5_LP64_OFF64_LIBS,	"XBS5_LP64_OFF64_LIBS",
3347c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3357c478bd9Sstevel@tonic-gate 	_CS_XBS5_LP64_OFF64_LIBS,	"_XBS5_LP64_OFF64_LIBS",
3367c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3377c478bd9Sstevel@tonic-gate 
3387c478bd9Sstevel@tonic-gate 	_CS_XBS5_LP64_OFF64_LINTFLAGS,	"XBS5_LP64_OFF64_LINTFLAGS",
3397c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3407c478bd9Sstevel@tonic-gate 	_CS_XBS5_LP64_OFF64_LINTFLAGS,	"_XBS5_LP64_OFF64_LINTFLAGS",
3417c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate 	_CS_XBS5_LPBIG_OFFBIG_CFLAGS,	"XBS5_LPBIG_OFFBIG_CFLAGS",
3447c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3457c478bd9Sstevel@tonic-gate 	_CS_XBS5_LPBIG_OFFBIG_CFLAGS,	"_XBS5_LPBIG_OFFBIG_CFLAGS",
3467c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3477c478bd9Sstevel@tonic-gate 
3487c478bd9Sstevel@tonic-gate 	_CS_XBS5_LPBIG_OFFBIG_LDFLAGS,	"XBS5_LPBIG_OFFBIG_LDFLAGS",
3497c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3507c478bd9Sstevel@tonic-gate 	_CS_XBS5_LPBIG_OFFBIG_LDFLAGS,	"_XBS5_LPBIG_OFFBIG_LDFLAGS",
3517c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3527c478bd9Sstevel@tonic-gate 
3537c478bd9Sstevel@tonic-gate 	_CS_XBS5_LPBIG_OFFBIG_LIBS,	"XBS5_LPBIG_OFFBIG_LIBS",
3547c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3557c478bd9Sstevel@tonic-gate 	_CS_XBS5_LPBIG_OFFBIG_LIBS,	"_XBS5_LPBIG_OFFBIG_LIBS",
3567c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3577c478bd9Sstevel@tonic-gate 
3587c478bd9Sstevel@tonic-gate 	_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, "XBS5_LPBIG_OFFBIG_LINTFLAGS",
3597c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3607c478bd9Sstevel@tonic-gate 	_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS, "_XBS5_LPBIG_OFFBIG_LINTFLAGS",
3617c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate 	/*
3647c478bd9Sstevel@tonic-gate 	 * UNIX 03 confstr() additions for compilation environments
3657c478bd9Sstevel@tonic-gate 	 */
3667c478bd9Sstevel@tonic-gate 	_CS_POSIX_V6_ILP32_OFF32_CFLAGS, "POSIX_V6_ILP32_OFF32_CFLAGS",
3677c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3687c478bd9Sstevel@tonic-gate 	_CS_POSIX_V6_ILP32_OFF32_LDFLAGS, "POSIX_V6_ILP32_OFF32_LDFLAGS",
3697c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3707c478bd9Sstevel@tonic-gate 	_CS_POSIX_V6_ILP32_OFF32_LIBS, "POSIX_V6_ILP32_OFF32_LIBS",
3717c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3727c478bd9Sstevel@tonic-gate 	_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS, "POSIX_V6_ILP32_OFFBIG_CFLAGS",
3737c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3747c478bd9Sstevel@tonic-gate 	_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS, "POSIX_V6_ILP32_OFFBIG_LDFLAGS",
3757c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3767c478bd9Sstevel@tonic-gate 	_CS_POSIX_V6_ILP32_OFFBIG_LIBS, "POSIX_V6_ILP32_OFFBIG_LIBS",
3777c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3787c478bd9Sstevel@tonic-gate 	_CS_POSIX_V6_LP64_OFF64_CFLAGS, "POSIX_V6_LP64_OFF64_CFLAGS",
3797c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3807c478bd9Sstevel@tonic-gate 	_CS_POSIX_V6_LP64_OFF64_LDFLAGS, "POSIX_V6_LP64_OFF64_LDFLAGS",
3817c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3827c478bd9Sstevel@tonic-gate 	_CS_POSIX_V6_LP64_OFF64_LIBS, "POSIX_V6_LP64_OFF64_LIBS",
3837c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3847c478bd9Sstevel@tonic-gate 	_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS, "POSIX_V6_LPBIG_OFFBIG_CFLAGS",
3857c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3867c478bd9Sstevel@tonic-gate 	_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS, "POSIX_V6_LPBIG_OFFBIG_LDFLAGS",
3877c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3887c478bd9Sstevel@tonic-gate 	_CS_POSIX_V6_LPBIG_OFFBIG_LIBS, "POSIX_V6_LPBIG_OFFBIG_LIBS",
3897c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3907c478bd9Sstevel@tonic-gate 	_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS, "POSIX_V6_WIDTH_RESTRICTED_ENVS",
3917c478bd9Sstevel@tonic-gate 		CONFSTR,	NOFLAGS,
3927c478bd9Sstevel@tonic-gate 	/* End of UNIX 03 compilation environments */
3937c478bd9Sstevel@tonic-gate 
3947c478bd9Sstevel@tonic-gate #ifdef  _SC_2_C_VERSION		/* POSIX.2 table B-4 */
3957c478bd9Sstevel@tonic-gate 	_SC_2_C_VERSION,	"_POSIX2_C_VERSION",	SYSCONF,   NOFLAGS,
3967c478bd9Sstevel@tonic-gate #else
3977c478bd9Sstevel@tonic-gate 	_POSIX2_C_VERSION,	"_POSIX2_C_VERSION",	SELFCONF,   NOFLAGS,
3987c478bd9Sstevel@tonic-gate #endif
3997c478bd9Sstevel@tonic-gate 
4007c478bd9Sstevel@tonic-gate /*
4017c478bd9Sstevel@tonic-gate  * XPG4 support BEGINS
4027c478bd9Sstevel@tonic-gate  */
4037c478bd9Sstevel@tonic-gate 
4047c478bd9Sstevel@tonic-gate #ifndef CHARCLASS_NAME_MAX
4057c478bd9Sstevel@tonic-gate #define	CHARCLASS_NAME_MAX	-1
4067c478bd9Sstevel@tonic-gate #endif
4077c478bd9Sstevel@tonic-gate #ifndef CHAR_BIT
4087c478bd9Sstevel@tonic-gate #define	CHAR_BIT	-1
4097c478bd9Sstevel@tonic-gate #endif
4107c478bd9Sstevel@tonic-gate #ifndef CHAR_MAX
4117c478bd9Sstevel@tonic-gate #define	CHAR_MAX	-1
4127c478bd9Sstevel@tonic-gate #endif
4137c478bd9Sstevel@tonic-gate #ifndef CHAR_MIN
4147c478bd9Sstevel@tonic-gate #define	CHAR_MIN	-1
4157c478bd9Sstevel@tonic-gate #endif
4167c478bd9Sstevel@tonic-gate #ifndef INT_MAX
4177c478bd9Sstevel@tonic-gate #define	INT_MAX	-1
4187c478bd9Sstevel@tonic-gate #endif
4197c478bd9Sstevel@tonic-gate #ifndef INT_MIN
4207c478bd9Sstevel@tonic-gate #define	INT_MIN	-1
4217c478bd9Sstevel@tonic-gate #endif
4227c478bd9Sstevel@tonic-gate #ifndef LONG_BIT
4237c478bd9Sstevel@tonic-gate #define	LONG_BIT	-1
4247c478bd9Sstevel@tonic-gate #endif
4257c478bd9Sstevel@tonic-gate #ifndef LONG_MAX
4267c478bd9Sstevel@tonic-gate #define	LONG_MAX	-1
4277c478bd9Sstevel@tonic-gate #endif
4287c478bd9Sstevel@tonic-gate #ifndef LONG_MIN
4297c478bd9Sstevel@tonic-gate #define	LONG_MIN	-1
4307c478bd9Sstevel@tonic-gate #endif
4317c478bd9Sstevel@tonic-gate #ifndef MB_LEN_MAX
4327c478bd9Sstevel@tonic-gate #define	MB_LEN_MAX	-1
4337c478bd9Sstevel@tonic-gate #endif
4347c478bd9Sstevel@tonic-gate #ifndef NL_NMAX
4357c478bd9Sstevel@tonic-gate #define	NL_NMAX	-1
4367c478bd9Sstevel@tonic-gate #endif
4377c478bd9Sstevel@tonic-gate #ifndef NL_ARGMAX
4387c478bd9Sstevel@tonic-gate #define	NL_ARGMAX	-1
4397c478bd9Sstevel@tonic-gate #endif
4407c478bd9Sstevel@tonic-gate #ifndef NL_LANGMAX
4417c478bd9Sstevel@tonic-gate #define	NL_LANGMAX	-1
4427c478bd9Sstevel@tonic-gate #endif
4437c478bd9Sstevel@tonic-gate #ifndef NL_MSGMAX
4447c478bd9Sstevel@tonic-gate #define	NL_MSGMAX	-1
4457c478bd9Sstevel@tonic-gate #endif
4467c478bd9Sstevel@tonic-gate #ifndef NL_SETMAX
4477c478bd9Sstevel@tonic-gate #define	NL_SETMAX	-1
4487c478bd9Sstevel@tonic-gate #endif
4497c478bd9Sstevel@tonic-gate #ifndef NL_TEXTMAX
4507c478bd9Sstevel@tonic-gate #define	NL_TEXTMAX	-1
4517c478bd9Sstevel@tonic-gate #endif
4527c478bd9Sstevel@tonic-gate #ifndef NZERO
4537c478bd9Sstevel@tonic-gate #define	NZERO	-1
4547c478bd9Sstevel@tonic-gate #endif
4557c478bd9Sstevel@tonic-gate #ifndef SCHAR_MAX
4567c478bd9Sstevel@tonic-gate #define	SCHAR_MAX	-1
4577c478bd9Sstevel@tonic-gate #endif
4587c478bd9Sstevel@tonic-gate #ifndef SCHAR_MIN
4597c478bd9Sstevel@tonic-gate #define	SCHAR_MIN	-1
4607c478bd9Sstevel@tonic-gate #endif
4617c478bd9Sstevel@tonic-gate #ifndef SHRT_MAX
4627c478bd9Sstevel@tonic-gate #define	SHRT_MAX	-1
4637c478bd9Sstevel@tonic-gate #endif
4647c478bd9Sstevel@tonic-gate #ifndef SHRT_MIN
4657c478bd9Sstevel@tonic-gate #define	SHRT_MIN	-1
4667c478bd9Sstevel@tonic-gate #endif
4677c478bd9Sstevel@tonic-gate #ifndef TMP_MAX
4687c478bd9Sstevel@tonic-gate #define	TMP_MAX	-1
4697c478bd9Sstevel@tonic-gate #endif
4707c478bd9Sstevel@tonic-gate #ifndef WORD_BIT
4717c478bd9Sstevel@tonic-gate #define	WORD_BIT	-1
4727c478bd9Sstevel@tonic-gate #endif
4737c478bd9Sstevel@tonic-gate 
4747c478bd9Sstevel@tonic-gate 
4757c478bd9Sstevel@tonic-gate #ifndef	_XOPEN_XPG2
4767c478bd9Sstevel@tonic-gate #define	_XOPEN_XPG2	-1
4777c478bd9Sstevel@tonic-gate #endif
4787c478bd9Sstevel@tonic-gate #ifndef	_XOPEN_XPG3
4797c478bd9Sstevel@tonic-gate #define	_XOPEN_XPG3	-1
4807c478bd9Sstevel@tonic-gate #endif
4817c478bd9Sstevel@tonic-gate #ifndef	_XOPEN_XPG4
4827c478bd9Sstevel@tonic-gate #define	_XOPEN_XPG4	-1
4837c478bd9Sstevel@tonic-gate #endif
4847c478bd9Sstevel@tonic-gate 
4857c478bd9Sstevel@tonic-gate 	/*
4867c478bd9Sstevel@tonic-gate 	 * the following are values that we should find in <limits.h>
4877c478bd9Sstevel@tonic-gate 	 * so we use SELFCONF here.
4887c478bd9Sstevel@tonic-gate 	 *
4897c478bd9Sstevel@tonic-gate 	 */
4907c478bd9Sstevel@tonic-gate 
4917c478bd9Sstevel@tonic-gate 	/* POSIX.1-1990 */
4927c478bd9Sstevel@tonic-gate 	CHARCLASS_NAME_MAX,	"CHARCLASS_NAME_MAX",	  SELFCONF,   NOFLAGS,
4938ef5f9c7Schin 	SSIZE_MAX,		"SSIZE_MAX",	SELFCONF,   NOFLAGS,
4947c478bd9Sstevel@tonic-gate 
4957c478bd9Sstevel@tonic-gate 	/* POSIX.1-1988 */
4967c478bd9Sstevel@tonic-gate 	CHAR_BIT,		"CHAR_BIT",	SELFCONF,   NOFLAGS,
4977c478bd9Sstevel@tonic-gate 	CHAR_MAX,		"CHAR_MAX",	SELFCONF,   NOFLAGS,
4987c478bd9Sstevel@tonic-gate 	CHAR_MIN,		"CHAR_MIN",	SELFCONF,   NOFLAGS,
4997c478bd9Sstevel@tonic-gate 	INT_MAX,		"INT_MAX",	SELFCONF,   NOFLAGS,
5007c478bd9Sstevel@tonic-gate 	INT_MIN,		"INT_MIN",	SELFCONF,   NOFLAGS,
5017c478bd9Sstevel@tonic-gate 	LONG_BIT,		"LONG_BIT",	SELFCONF,   NOFLAGS,
5027c478bd9Sstevel@tonic-gate 	LONG_MAX,		"LONG_MAX",	SELFCONF,   NOFLAGS,
5037c478bd9Sstevel@tonic-gate 	LONG_MIN,		"LONG_MIN",	SELFCONF,   NOFLAGS,
5047c478bd9Sstevel@tonic-gate 	MB_LEN_MAX,		"MB_LEN_MAX",	SELFCONF,   NOFLAGS,
5057c478bd9Sstevel@tonic-gate 	NL_NMAX,		"NL_NMAX",	SELFCONF,   NOFLAGS,
5067c478bd9Sstevel@tonic-gate 	NL_ARGMAX,		"NL_ARGMAX",	SELFCONF,   NOFLAGS,
5077c478bd9Sstevel@tonic-gate 	NL_LANGMAX,		"NL_LANGMAX",	SELFCONF,   NOFLAGS,
5087c478bd9Sstevel@tonic-gate 	NL_MSGMAX,		"NL_MSGMAX",	SELFCONF,   NOFLAGS,
5097c478bd9Sstevel@tonic-gate 	NL_SETMAX,		"NL_SETMAX",	SELFCONF,   NOFLAGS,
5107c478bd9Sstevel@tonic-gate 	NL_TEXTMAX,		"NL_TEXTMAX",	SELFCONF,   NOFLAGS,
5117c478bd9Sstevel@tonic-gate 	NZERO,			"NZERO",	SELFCONF,   NOFLAGS,
5127c478bd9Sstevel@tonic-gate 	SCHAR_MAX,		"SCHAR_MAX",	SELFCONF,   NOFLAGS,
5137c478bd9Sstevel@tonic-gate 	SCHAR_MIN,		"SCHAR_MIN",	SELFCONF,   NOFLAGS,
5147c478bd9Sstevel@tonic-gate 	SHRT_MAX,		"SHRT_MAX",	SELFCONF,   NOFLAGS,
5157c478bd9Sstevel@tonic-gate 	SHRT_MIN,		"SHRT_MIN",	SELFCONF,   NOFLAGS,
5167c478bd9Sstevel@tonic-gate 	TMP_MAX,		"TMP_MAX",	SELFCONF,   NOFLAGS,
5177c478bd9Sstevel@tonic-gate 
5187c478bd9Sstevel@tonic-gate 	/*
5197c478bd9Sstevel@tonic-gate 	 * for the unsigned maximums, we cannot rely on the value -1
5207c478bd9Sstevel@tonic-gate 	 * to indicate "undefined".
5217c478bd9Sstevel@tonic-gate 	 */
5227c478bd9Sstevel@tonic-gate #ifndef UCHAR_MAX
5237c478bd9Sstevel@tonic-gate 	0,			"UCHAR_MAX",	SELFCONF,   UNDEFINED,
5247c478bd9Sstevel@tonic-gate #else
5257c478bd9Sstevel@tonic-gate 	(long)UCHAR_MAX,	"UCHAR_MAX",	SELFCONF,   UNSIGNED_VALUE,
5267c478bd9Sstevel@tonic-gate #endif /* UCHAR_MAX */
5277c478bd9Sstevel@tonic-gate #ifndef UINT_MAX
5287c478bd9Sstevel@tonic-gate 	0,			"UINT_MAX",	SELFCONF,   UNDEFINED,
5297c478bd9Sstevel@tonic-gate #else
5307c478bd9Sstevel@tonic-gate 	(long)UINT_MAX,		"UINT_MAX",	SELFCONF,   UNSIGNED_VALUE,
5317c478bd9Sstevel@tonic-gate #endif /* UINT_MAX */
5327c478bd9Sstevel@tonic-gate #ifndef ULONG_MAX
5337c478bd9Sstevel@tonic-gate 	0,			"ULONG_MAX",	SELFCONF,   UNDEFINED,
5347c478bd9Sstevel@tonic-gate #else
5357c478bd9Sstevel@tonic-gate 	(long)ULONG_MAX,	"ULONG_MAX",	SELFCONF,   UNSIGNED_VALUE,
5367c478bd9Sstevel@tonic-gate #endif /* ULONG_MAX */
5377c478bd9Sstevel@tonic-gate #ifndef USHRT_MAX
5387c478bd9Sstevel@tonic-gate 	0,			"USHRT_MAX",	SELFCONF,   UNDEFINED,
5397c478bd9Sstevel@tonic-gate #else
5407c478bd9Sstevel@tonic-gate 	(long)USHRT_MAX,	"USHRT_MAX",	SELFCONF,   UNSIGNED_VALUE,
5417c478bd9Sstevel@tonic-gate #endif /* USHRT_MAX */
5427c478bd9Sstevel@tonic-gate #ifndef SIZE_MAX
5437c478bd9Sstevel@tonic-gate 	0,			"SIZE_MAX",	SELFCONF,   UNDEFINED,
5447c478bd9Sstevel@tonic-gate #else
5457c478bd9Sstevel@tonic-gate 	(long)SIZE_MAX,		"SIZE_MAX",	SELFCONF,   UNSIGNED_VALUE,
5467c478bd9Sstevel@tonic-gate #endif /* SIZE_MAX */
5477c478bd9Sstevel@tonic-gate 
5487c478bd9Sstevel@tonic-gate 	WORD_BIT,		"WORD_BIT",	SELFCONF,   NOFLAGS,
5497c478bd9Sstevel@tonic-gate 
5507c478bd9Sstevel@tonic-gate 	/* XPG4 Version 2 */
5517c478bd9Sstevel@tonic-gate 	_XOPEN_IOV_MAX,		"_XOPEN_IOV_MAX",  SELFCONF, NOFLAGS,
5527c478bd9Sstevel@tonic-gate 
5537c478bd9Sstevel@tonic-gate 	/* UNIX 03 */
5547c478bd9Sstevel@tonic-gate 	_XOPEN_NAME_MAX,	"_XOPEN_NAME_MAX", SELFCONF, NOFLAGS,
5557c478bd9Sstevel@tonic-gate 	_XOPEN_PATH_MAX,	"_XOPEN_PATH_MAX", SELFCONF, NOFLAGS,
5567c478bd9Sstevel@tonic-gate 
5577c478bd9Sstevel@tonic-gate 	/*
5587c478bd9Sstevel@tonic-gate 	 * The following are defined via sysconf().  These are considered
5597c478bd9Sstevel@tonic-gate 	 * an extension to sysconf().
5607c478bd9Sstevel@tonic-gate 	 * The -0 is needed if _XOPEN_XPG? is defined to be an empty string.
5617c478bd9Sstevel@tonic-gate 	 */
5627c478bd9Sstevel@tonic-gate 	_XOPEN_XPG2-0,		"_XOPEN_XPG2",	SELFCONF,    NOFLAGS,
5637c478bd9Sstevel@tonic-gate 	_XOPEN_XPG3-0,		"_XOPEN_XPG3",	SELFCONF,    NOFLAGS,
5647c478bd9Sstevel@tonic-gate 	_XOPEN_XPG4-0,		"_XOPEN_XPG4",	SELFCONF,    NOFLAGS,
5657c478bd9Sstevel@tonic-gate 
5667c478bd9Sstevel@tonic-gate 	/*
5677c478bd9Sstevel@tonic-gate 	 * The following should be provided by sysconf() (e.g use SYSCONF),
5687c478bd9Sstevel@tonic-gate 	 * so we  look for the appropriate _SC_* symbol in <unistd.h>.
5697c478bd9Sstevel@tonic-gate 	 * If it is not defined, then we use SELFCONF with the value of -1.
5707c478bd9Sstevel@tonic-gate 	 */
5717c478bd9Sstevel@tonic-gate 	_SC_XOPEN_VERSION,	"_XOPEN_VERSION",	SYSCONF,   NOFLAGS,
5727c478bd9Sstevel@tonic-gate 	_SC_XOPEN_XCU_VERSION,	"_XOPEN_XCU_VERSION",	SYSCONF,   NOFLAGS,
5737c478bd9Sstevel@tonic-gate 	_SC_XOPEN_CRYPT,	"_XOPEN_CRYPT",		SYSCONF,   NOFLAGS,
5747c478bd9Sstevel@tonic-gate 	_SC_XOPEN_ENH_I18N,	"_XOPEN_ENH_I18N",	SYSCONF,   NOFLAGS,
5757c478bd9Sstevel@tonic-gate 	_SC_XOPEN_SHM,		"_XOPEN_SHM",		SYSCONF,   NOFLAGS,
5767c478bd9Sstevel@tonic-gate 
5777c478bd9Sstevel@tonic-gate /*
5787c478bd9Sstevel@tonic-gate  * XPG4 support ends
5797c478bd9Sstevel@tonic-gate  */
5807c478bd9Sstevel@tonic-gate 
5817c478bd9Sstevel@tonic-gate /* XPG4, Version 2 support */
5827c478bd9Sstevel@tonic-gate 
5837c478bd9Sstevel@tonic-gate 	_SC_ATEXIT_MAX, 	"ATEXIT_MAX",		SYSCONF,	NOFLAGS,
5847c478bd9Sstevel@tonic-gate 	_SC_PAGESIZE,		"PAGESIZE",		SYSCONF,	NOFLAGS,
5857c478bd9Sstevel@tonic-gate 	_SC_PAGE_SIZE,		"PAGE_SIZE",		SYSCONF,	NOFLAGS,
5867c478bd9Sstevel@tonic-gate 	_SC_XOPEN_UNIX,		"_XOPEN_UNIX",		SYSCONF,	NOFLAGS,
5877c478bd9Sstevel@tonic-gate 	_SC_IOV_MAX,		"IOV_MAX",		SYSCONF, 	NOFLAGS,
5887c478bd9Sstevel@tonic-gate 
5897c478bd9Sstevel@tonic-gate /*
5907c478bd9Sstevel@tonic-gate  * UNIX 98 - XPG5 additions
5917c478bd9Sstevel@tonic-gate  */
5927c478bd9Sstevel@tonic-gate 	_SC_XOPEN_LEGACY,	"_XOPEN_LEGACY",	SYSCONF, 	NOFLAGS,
5937c478bd9Sstevel@tonic-gate 	_SC_PASS_MAX,		"PASS_MAX",		SYSCONF, 	NOFLAGS,
5947c478bd9Sstevel@tonic-gate 	_SC_AIO_LISTIO_MAX,	"AIO_LISTIO_MAX",	SYSCONF, 	NOFLAGS,
5957c478bd9Sstevel@tonic-gate 	_SC_AIO_MAX,		"AIO_MAX",		SYSCONF, 	NOFLAGS,
5967c478bd9Sstevel@tonic-gate 	_SC_AIO_PRIO_DELTA_MAX,	"AIO_PRIO_DELTA_MAX",	SYSCONF, 	NOFLAGS,
5977c478bd9Sstevel@tonic-gate 	_SC_DELAYTIMER_MAX,	"DELAYTIMER_MAX",	SYSCONF, 	NOFLAGS,
5987c478bd9Sstevel@tonic-gate 	_SC_MQ_OPEN_MAX,	"MQ_OPEN_MAX",		SYSCONF, 	NOFLAGS,
5997c478bd9Sstevel@tonic-gate 	_SC_MQ_PRIO_MAX,	"MQ_PRIO_MAX",		SYSCONF, 	NOFLAGS,
6007c478bd9Sstevel@tonic-gate 	_SC_RTSIG_MAX,		"RTSIG_MAX",		SYSCONF, 	NOFLAGS,
6017c478bd9Sstevel@tonic-gate 	_SC_SEM_NSEMS_MAX,	"SEM_NSEMS_MAX",	SYSCONF, 	NOFLAGS,
6027c478bd9Sstevel@tonic-gate 	_SC_SEM_VALUE_MAX,	"SEM_VALUE_MAX",	SYSCONF, 	NOFLAGS,
6037c478bd9Sstevel@tonic-gate 	_SC_SIGQUEUE_MAX,	"SIGQUEUE_MAX",		SYSCONF, 	NOFLAGS,
6047c478bd9Sstevel@tonic-gate 	_SC_TIMER_MAX,		"TIMER_MAX",		SYSCONF, 	NOFLAGS,
6057c478bd9Sstevel@tonic-gate 
6067c478bd9Sstevel@tonic-gate 	_SC_ASYNCHRONOUS_IO,	"_POSIX_ASYNCHRONOUS_IO", SYSCONF, 	NOFLAGS,
6077c478bd9Sstevel@tonic-gate 	_SC_FSYNC,		"_POSIX_FSYNC",		SYSCONF,	NOFLAGS,
6087c478bd9Sstevel@tonic-gate 	_SC_MAPPED_FILES,	"_POSIX_MAPPED_FILES",	SYSCONF, 	NOFLAGS,
6097c478bd9Sstevel@tonic-gate 	_SC_MEMLOCK,		"_POSIX_MEMLOCK",	SYSCONF, 	NOFLAGS,
6107c478bd9Sstevel@tonic-gate 	_SC_MEMLOCK_RANGE,	"_POSIX_MEMLOCK_RANGE",	SYSCONF, 	NOFLAGS,
6117c478bd9Sstevel@tonic-gate 	_SC_MEMORY_PROTECTION,	"_POSIX_MEMORY_PROTECTION", SYSCONF, 	NOFLAGS,
6127c478bd9Sstevel@tonic-gate 	_SC_MESSAGE_PASSING,	"_POSIX_MESSAGE_PASSING", SYSCONF, 	NOFLAGS,
6137c478bd9Sstevel@tonic-gate 	_SC_PRIORITIZED_IO,	"_POSIX_PRIORITIZED_IO", SYSCONF, 	NOFLAGS,
6147c478bd9Sstevel@tonic-gate 	_SC_PRIORITY_SCHEDULING, "_POSIX_PRIORITY_SCHEDULING", SYSCONF, NOFLAGS,
6157c478bd9Sstevel@tonic-gate 	_SC_REALTIME_SIGNALS,	"_POSIX_REALTIME_SIGNALS", SYSCONF, 	NOFLAGS,
6167c478bd9Sstevel@tonic-gate 	_SC_SEMAPHORES,		"_POSIX_SEMAPHORES",	SYSCONF, 	NOFLAGS,
6177c478bd9Sstevel@tonic-gate 
6187c478bd9Sstevel@tonic-gate 	_SC_SHARED_MEMORY_OBJECTS, "_POSIX_SHARED_MEMORY_OBJECTS",
6197c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6207c478bd9Sstevel@tonic-gate 
6217c478bd9Sstevel@tonic-gate 	_SC_SYNCHRONIZED_IO,	"_POSIX_SYNCHRONIZED_IO", SYSCONF, 	NOFLAGS,
6227c478bd9Sstevel@tonic-gate 	_SC_TIMERS,		"_POSIX_TIMERS",	SYSCONF, 	NOFLAGS,
6237c478bd9Sstevel@tonic-gate 
6247c478bd9Sstevel@tonic-gate 	_SC_LOGIN_NAME_MAX,	"LOGIN_NAME_MAX",	SYSCONF, 	NOFLAGS,
6257c478bd9Sstevel@tonic-gate 
6267c478bd9Sstevel@tonic-gate 	_SC_THREAD_DESTRUCTOR_ITERATIONS, "PTHREAD_DESTRUCTOR_ITERATIONS",
6277c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6287c478bd9Sstevel@tonic-gate 
6297c478bd9Sstevel@tonic-gate 	_SC_THREAD_KEYS_MAX,	"PTHREAD_KEYS_MAX",	SYSCONF, 	NOFLAGS,
6307c478bd9Sstevel@tonic-gate 	_SC_THREAD_STACK_MIN,	"PTHREAD_STACK_MIN",	SYSCONF, 	NOFLAGS,
6317c478bd9Sstevel@tonic-gate 	_SC_THREAD_THREADS_MAX,	"PTHREAD_THREADS_MAX",	SYSCONF, 	NOFLAGS,
6327c478bd9Sstevel@tonic-gate 
6337c478bd9Sstevel@tonic-gate 	_SC_THREADS,		"_POSIX_THREADS",	SYSCONF, 	NOFLAGS,
6347c478bd9Sstevel@tonic-gate 
6357c478bd9Sstevel@tonic-gate 	_SC_THREAD_ATTR_STACKADDR, "POSIX_THREAD_ATTR_STACKADDR",
6367c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6377c478bd9Sstevel@tonic-gate 	_SC_THREAD_ATTR_STACKADDR, "_POSIX_THREAD_ATTR_STACKADDR",
6387c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6397c478bd9Sstevel@tonic-gate 
6407c478bd9Sstevel@tonic-gate 	_SC_THREAD_ATTR_STACKSIZE, "POSIX_THREAD_ATTR_STACKSIZE",
6417c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6427c478bd9Sstevel@tonic-gate 	_SC_THREAD_ATTR_STACKSIZE, "_POSIX_THREAD_ATTR_STACKSIZE",
6437c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6447c478bd9Sstevel@tonic-gate 
6457c478bd9Sstevel@tonic-gate 	_SC_THREAD_PRIORITY_SCHEDULING, "POSIX_THREAD_PRIORITY_SCHEDULING",
6467c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6477c478bd9Sstevel@tonic-gate 	_SC_THREAD_PRIORITY_SCHEDULING, "_POSIX_THREAD_PRIORITY_SCHEDULING",
6487c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6497c478bd9Sstevel@tonic-gate 
6507c478bd9Sstevel@tonic-gate 	_SC_THREAD_PRIO_INHERIT, "POSIX_THREAD_PRIO_INHERIT",
6517c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6527c478bd9Sstevel@tonic-gate 	_SC_THREAD_PRIO_INHERIT, "_POSIX_THREAD_PRIO_INHERIT",
6537c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6547c478bd9Sstevel@tonic-gate 
6557c478bd9Sstevel@tonic-gate 	_SC_THREAD_PRIO_PROTECT, "POSIX_THREAD_PRIO_PROTECT",
6567c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6577c478bd9Sstevel@tonic-gate 	_SC_THREAD_PRIO_PROTECT, "_POSIX_THREAD_PRIO_PROTECT",
6587c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6597c478bd9Sstevel@tonic-gate 
6607c478bd9Sstevel@tonic-gate 	_SC_THREAD_PROCESS_SHARED, "POSIX_THREAD_PROCESS_SHARED",
6617c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6627c478bd9Sstevel@tonic-gate 	_SC_THREAD_PROCESS_SHARED, "_POSIX_THREAD_PROCESS_SHARED",
6637c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6647c478bd9Sstevel@tonic-gate 
6657c478bd9Sstevel@tonic-gate 	_SC_THREAD_SAFE_FUNCTIONS, "POSIX_THREAD_SAFE_FUNCTIONS",
6667c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6677c478bd9Sstevel@tonic-gate 	_SC_THREAD_SAFE_FUNCTIONS, "_POSIX_THREAD_SAFE_FUNCTIONS",
6687c478bd9Sstevel@tonic-gate 	    SYSCONF, 	NOFLAGS,
6697c478bd9Sstevel@tonic-gate 
6707c478bd9Sstevel@tonic-gate 	_SC_TTY_NAME_MAX,	"TTY_NAME_MAX",		SYSCONF,	NOFLAGS,
6717c478bd9Sstevel@tonic-gate 	_SC_XOPEN_REALTIME,	"_XOPEN_REALTIME",	SYSCONF, 	NOFLAGS,
6727c478bd9Sstevel@tonic-gate 	_SC_XOPEN_REALTIME_THREADS, "_XOPEN_REALTIME_THREADS", SYSCONF, NOFLAGS,
6737c478bd9Sstevel@tonic-gate 
6747c478bd9Sstevel@tonic-gate 	/*
6757c478bd9Sstevel@tonic-gate 	 * Due to ambiguity in the standard we need
6767c478bd9Sstevel@tonic-gate 	 * to recognize both the underscored name
6777c478bd9Sstevel@tonic-gate 	 * and the non-underscored version in the
6787c478bd9Sstevel@tonic-gate 	 * following variables.
6797c478bd9Sstevel@tonic-gate 	 */
6807c478bd9Sstevel@tonic-gate 	_SC_XBS5_ILP32_OFF32,	"XBS5_ILP32_OFF32",	SYSCONF, 	NOFLAGS,
6817c478bd9Sstevel@tonic-gate 	_SC_XBS5_ILP32_OFF32,	"_XBS5_ILP32_OFF32",	SYSCONF, 	NOFLAGS,
6827c478bd9Sstevel@tonic-gate 
6837c478bd9Sstevel@tonic-gate 	_SC_XBS5_ILP32_OFFBIG,	"XBS5_ILP32_OFFBIG",	SYSCONF, 	NOFLAGS,
6847c478bd9Sstevel@tonic-gate 	_SC_XBS5_ILP32_OFFBIG,	"_XBS5_ILP32_OFFBIG",	SYSCONF, 	NOFLAGS,
6857c478bd9Sstevel@tonic-gate 
6867c478bd9Sstevel@tonic-gate 	_SC_XBS5_LP64_OFF64,	"XBS5_LP64_OFF64",	SYSCONF, 	NOFLAGS,
6877c478bd9Sstevel@tonic-gate 	_SC_XBS5_LP64_OFF64,	"_XBS5_LP64_OFF64",	SYSCONF, 	NOFLAGS,
6887c478bd9Sstevel@tonic-gate 
6897c478bd9Sstevel@tonic-gate 	_SC_XBS5_LPBIG_OFFBIG,	"XBS5_LPBIG_OFFBIG",	SYSCONF, 	NOFLAGS,
6907c478bd9Sstevel@tonic-gate 	_SC_XBS5_LPBIG_OFFBIG,	"_XBS5_LPBIG_OFFBIG",	SYSCONF, 	NOFLAGS,
6917c478bd9Sstevel@tonic-gate 
6927c478bd9Sstevel@tonic-gate /*
6937c478bd9Sstevel@tonic-gate  * UNIX 03 additions for sysconf() names, and names that are not in interfaces
6947c478bd9Sstevel@tonic-gate  */
6957c478bd9Sstevel@tonic-gate 	_SC_REGEXP,		"_POSIX_REGEXP",	  SYSCONF,	NOFLAGS,
6967c478bd9Sstevel@tonic-gate 	_SC_SHELL,		"_POSIX_SHELL",		  SYSCONF,	NOFLAGS,
6977c478bd9Sstevel@tonic-gate 	_SC_HOST_NAME_MAX,	"HOST_NAME_MAX",	  SYSCONF,	NOFLAGS,
6987c478bd9Sstevel@tonic-gate 	_SC_READER_WRITER_LOCKS, "_POSIX_READER_WRITER_LOCKS", SYSCONF,	NOFLAGS,
6997c478bd9Sstevel@tonic-gate 	_SC_IPV6,		"_POSIX_IPV6",		  SYSCONF,	NOFLAGS,
7007c478bd9Sstevel@tonic-gate 	_SC_RAW_SOCKETS,	"_POSIX_RAW_SOCKETS",	  SYSCONF,	NOFLAGS,
7017c478bd9Sstevel@tonic-gate 	_SC_XOPEN_STREAMS, 	"_XOPEN_STREAMS",	  SYSCONF,	NOFLAGS,
7027c478bd9Sstevel@tonic-gate 	_SC_SYMLOOP_MAX,	"SYMLOOP_MAX",		  SYSCONF,	NOFLAGS,
7037c478bd9Sstevel@tonic-gate 	_SC_2_PBS,		"_POSIX2_PBS",		  SYSCONF,	NOFLAGS,
7047c478bd9Sstevel@tonic-gate 	_SC_2_PBS_ACCOUNTING,   "_POSIX2_PBS_ACCOUNTING", SYSCONF,	NOFLAGS,
7057c478bd9Sstevel@tonic-gate 	_SC_2_PBS_CHECKPOINT,   "_POSIX2_PBS_CHECKPOINT", SYSCONF,	NOFLAGS,
7067c478bd9Sstevel@tonic-gate 	_SC_2_PBS_LOCATE,	"_POSIX2_PBS_LOCATE",	  SYSCONF,	NOFLAGS,
7077c478bd9Sstevel@tonic-gate 	_SC_2_PBS_MESSAGE,	"_POSIX2_PBS_MESSAGE",	  SYSCONF,	NOFLAGS,
7087c478bd9Sstevel@tonic-gate 	_SC_2_PBS_TRACK,	"_POSIX2_PBS_TRACK",	  SYSCONF,	NOFLAGS,
7097c478bd9Sstevel@tonic-gate 
7107c478bd9Sstevel@tonic-gate 	_SC_ADVISORY_INFO,	"_POSIX_ADVISORY_INFO",   SYSCONF,	NOFLAGS,
7117c478bd9Sstevel@tonic-gate 	_SC_BARRIERS,		"_POSIX_BARRIERS",	  SYSCONF,	NOFLAGS,
7127c478bd9Sstevel@tonic-gate 	_SC_CLOCK_SELECTION,	"_POSIX_CLOCK_SELECTION", SYSCONF,	NOFLAGS,
7137c478bd9Sstevel@tonic-gate 	_SC_CPUTIME,		"_POSIX_CPUTIME",	  SYSCONF,	NOFLAGS,
7147c478bd9Sstevel@tonic-gate 	_SC_MONOTONIC_CLOCK,	"_POSIX_MONOTONIC_CLOCK", SYSCONF,	NOFLAGS,
7157c478bd9Sstevel@tonic-gate 	_SC_SPAWN,		"_POSIX_SPAWN",		  SYSCONF,	NOFLAGS,
7167c478bd9Sstevel@tonic-gate 	_SC_SPIN_LOCKS,		"_POSIX_SPIN_LOCKS",	  SYSCONF,	NOFLAGS,
7177c478bd9Sstevel@tonic-gate 	_SC_SPORADIC_SERVER,	"_POSIX_SPORADIC_SERVER", SYSCONF,	NOFLAGS,
7187c478bd9Sstevel@tonic-gate 	_SC_SS_REPL_MAX,	"_POSIX_SS_REPL_MAX",	  SYSCONF,	NOFLAGS,
7197c478bd9Sstevel@tonic-gate 	_SC_THREAD_CPUTIME,	"_POSIX_THREAD_CPUTIME",   SYSCONF,	NOFLAGS,
7207c478bd9Sstevel@tonic-gate 	_SC_THREAD_SPORADIC_SERVER, "_POSIX_THREAD_SPORADIC_SERVER", 	SYSCONF,
7217c478bd9Sstevel@tonic-gate 		NOFLAGS,
7227c478bd9Sstevel@tonic-gate 	_SC_TIMEOUTS,		"_POSIX_TIMEOUTS",	  SYSCONF,	NOFLAGS,
7237c478bd9Sstevel@tonic-gate 	_SC_TRACE,		"_POSIX_TRACE",		  SYSCONF,	NOFLAGS,
7247c478bd9Sstevel@tonic-gate 	_SC_TRACE_EVENT_FILTER, "_POSIX_TRACE_EVENT_FILTER", SYSCONF, 	NOFLAGS,
7257c478bd9Sstevel@tonic-gate 	_SC_TRACE_EVENT_NAME_MAX, "_POSIX_TRACE_EVENT_NAME_MAX", SYSCONF,
7267c478bd9Sstevel@tonic-gate 									NOFLAGS,
7277c478bd9Sstevel@tonic-gate 	_SC_TRACE_INHERIT,	"_POSIX_TRACE_INHERIT",   SYSCONF,	NOFLAGS,
7287c478bd9Sstevel@tonic-gate 	_SC_TRACE_LOG,		"_POSIX_TRACE_LOG",	  SYSCONF,	NOFLAGS,
7297c478bd9Sstevel@tonic-gate 	_SC_TRACE_NAME_MAX,	"_POSIX_TRACE_NAME_MAX",  SYSCONF,	NOFLAGS,
7307c478bd9Sstevel@tonic-gate 	_SC_TRACE_SYS_MAX,	"_POSIX_TRACE_SYS_MAX",	  SYSCONF,	NOFLAGS,
7317c478bd9Sstevel@tonic-gate 	_SC_TRACE_USER_EVENT_MAX, "_POSIX_TRACE_USER_EVENT_MAX", SYSCONF,
7327c478bd9Sstevel@tonic-gate 									NOFLAGS,
7337c478bd9Sstevel@tonic-gate 	_SC_TYPED_MEMORY_OBJECTS, "_POSIX_TYPED_MEMORY_OBJECTS",	SYSCONF,
7347c478bd9Sstevel@tonic-gate 		NOFLAGS,
7357c478bd9Sstevel@tonic-gate 
7367c478bd9Sstevel@tonic-gate 	/*
7377c478bd9Sstevel@tonic-gate 	 * Due to an ambiguity in the specification, we need to recognize both
7387c478bd9Sstevel@tonic-gate 	 * the underscored POSIX name and the non-underscored name. In addition,
7397c478bd9Sstevel@tonic-gate 	 * we need to permit the use of the _V6_* environment names specified
7407c478bd9Sstevel@tonic-gate 	 * in unistd.h.
7417c478bd9Sstevel@tonic-gate 	 */
7427c478bd9Sstevel@tonic-gate 	_SC_V6_ILP32_OFF32,	"_V6_ILP32_OFF32", 	SYSCONF,	NOFLAGS,
7437c478bd9Sstevel@tonic-gate 	_SC_V6_ILP32_OFF32,	"_POSIX_V6_ILP32_OFF32", SYSCONF,	NOFLAGS,
7447c478bd9Sstevel@tonic-gate 	_SC_V6_ILP32_OFF32,	"POSIX_V6_ILP32_OFF32", SYSCONF,	NOFLAGS,
7457c478bd9Sstevel@tonic-gate 
7467c478bd9Sstevel@tonic-gate 	_SC_V6_ILP32_OFFBIG,	"_V6_ILP32_OFFBIG", 	SYSCONF,	NOFLAGS,
7477c478bd9Sstevel@tonic-gate 	_SC_V6_ILP32_OFFBIG,	"_POSIX_V6_ILP32_OFFBIG", SYSCONF,	NOFLAGS,
7487c478bd9Sstevel@tonic-gate 	_SC_V6_ILP32_OFFBIG,	"POSIX_V6_ILP32_OFFBIG", SYSCONF,	NOFLAGS,
7497c478bd9Sstevel@tonic-gate 
7507c478bd9Sstevel@tonic-gate 	_SC_V6_LP64_OFF64,	"_V6_LP64_OFF64", 	SYSCONF,	NOFLAGS,
7517c478bd9Sstevel@tonic-gate 	_SC_V6_LP64_OFF64,	"_POSIX_V6_LP64_OFF64",	SYSCONF,	NOFLAGS,
7527c478bd9Sstevel@tonic-gate 	_SC_V6_LP64_OFF64,	"POSIX_V6_LP64_OFF64", 	SYSCONF,	NOFLAGS,
7537c478bd9Sstevel@tonic-gate 
7547c478bd9Sstevel@tonic-gate 	_SC_V6_LPBIG_OFFBIG,	"_V6_LPBIG_OFFBIG", 	SYSCONF,	NOFLAGS,
7557c478bd9Sstevel@tonic-gate 	_SC_V6_LPBIG_OFFBIG,	"_POSIX_V6_LPBIG_OFFBIG", SYSCONF,	NOFLAGS,
7567c478bd9Sstevel@tonic-gate 	_SC_V6_LPBIG_OFFBIG,	"POSIX_V6_LPBIG_OFFBIG",  SYSCONF,	NOFLAGS,
7573c1e5174SDavid Höppner /*
7583c1e5174SDavid Höppner  * System V Interface Definition
7593c1e5174SDavid Höppner  */
7603c1e5174SDavid Höppner 	_SC_NPROCESSORS_CONF,	"NPROCESSORS_CONF",	SYSCONF,	NOFLAGS,
7613c1e5174SDavid Höppner 	_SC_NPROCESSORS_MAX,	"NPROCESSORS_MAX",	SYSCONF,	NOFLAGS,
7623c1e5174SDavid Höppner 	_SC_NPROCESSORS_ONLN,	"NPROCESSORS_ONLN",	SYSCONF,	NOFLAGS,
7637c478bd9Sstevel@tonic-gate 	0,		NULL,	0,	0		/* end of table */
7647c478bd9Sstevel@tonic-gate };
7657c478bd9Sstevel@tonic-gate 
7667c478bd9Sstevel@tonic-gate 
7677c478bd9Sstevel@tonic-gate /*
7687c478bd9Sstevel@tonic-gate  * Print usage message.
7697c478bd9Sstevel@tonic-gate  */
7707c478bd9Sstevel@tonic-gate static int
7717c478bd9Sstevel@tonic-gate usage()
7727c478bd9Sstevel@tonic-gate {
7737c478bd9Sstevel@tonic-gate 
7747c478bd9Sstevel@tonic-gate 	(void) fputs(gettext(
7757c478bd9Sstevel@tonic-gate 	    "usage:\tgetconf [-v specification] system_var\n"
7767c478bd9Sstevel@tonic-gate 	    "\tgetconf [-v specification] path_var pathname\n"
7777c478bd9Sstevel@tonic-gate 	    "\tgetconf -a\n"), stderr);
7787c478bd9Sstevel@tonic-gate 	return (2);
7797c478bd9Sstevel@tonic-gate }
7807c478bd9Sstevel@tonic-gate 
7817c478bd9Sstevel@tonic-gate 
7827c478bd9Sstevel@tonic-gate static int
7837c478bd9Sstevel@tonic-gate namecmp(const void *a, const void *b)
7847c478bd9Sstevel@tonic-gate {
7857c478bd9Sstevel@tonic-gate 	return (strcoll(((const struct sctab *)a)->name,
7867c478bd9Sstevel@tonic-gate 	    ((const struct sctab *)b)->name));
7877c478bd9Sstevel@tonic-gate }
7887c478bd9Sstevel@tonic-gate 
7897c478bd9Sstevel@tonic-gate 
7907c478bd9Sstevel@tonic-gate static int
7917c478bd9Sstevel@tonic-gate getconf(struct sctab *scp, int argc, char *name, char *file)
7927c478bd9Sstevel@tonic-gate {
7937c478bd9Sstevel@tonic-gate 	register size_t len;
7947c478bd9Sstevel@tonic-gate 	register char *buffer;
7957c478bd9Sstevel@tonic-gate 	long value;
7967c478bd9Sstevel@tonic-gate 
7977c478bd9Sstevel@tonic-gate 	switch (scp->type) {
7987c478bd9Sstevel@tonic-gate 	case SELFCONF:
7997c478bd9Sstevel@tonic-gate 		if (argc > 2)
8007c478bd9Sstevel@tonic-gate 			return (usage());
8017c478bd9Sstevel@tonic-gate 		if (scp->flag & UNDEFINED ||
8027c478bd9Sstevel@tonic-gate 		    (!(scp->flag&UNSIGNED_VALUE) && scp->value == -1)) {
8037c478bd9Sstevel@tonic-gate 			/* DO NOT TRANSLATE */
8047c478bd9Sstevel@tonic-gate 			(void) printf("undefined\n");
8057c478bd9Sstevel@tonic-gate 		} else
8067c478bd9Sstevel@tonic-gate 			if (scp->flag & UNSIGNED_VALUE)
8077c478bd9Sstevel@tonic-gate 				(void) printf("%lu\n", scp->value);
8087c478bd9Sstevel@tonic-gate 			else
8097c478bd9Sstevel@tonic-gate 				(void) printf("%ld\n", scp->value);
8107c478bd9Sstevel@tonic-gate 		break;
8117c478bd9Sstevel@tonic-gate 
8127c478bd9Sstevel@tonic-gate 	case SYSCONF:
8137c478bd9Sstevel@tonic-gate 		if (argc > 2)
8147c478bd9Sstevel@tonic-gate 			return (usage());
8157c478bd9Sstevel@tonic-gate 		errno = 0;
8167c478bd9Sstevel@tonic-gate 		if (scp->flag & UNDEFINED ||
8177c478bd9Sstevel@tonic-gate 		    (value = sysconf((int)scp->value)) == -1) {
8187c478bd9Sstevel@tonic-gate 			if (errno == EINVAL) {
8197c478bd9Sstevel@tonic-gate 				(void) fprintf(stderr,
8207c478bd9Sstevel@tonic-gate 				    gettext(INVAL_ARG), name);
8217c478bd9Sstevel@tonic-gate 				return (1);
8227c478bd9Sstevel@tonic-gate 			} else {
8237c478bd9Sstevel@tonic-gate 				/* DO NOT TRANSLATE */
8247c478bd9Sstevel@tonic-gate 				(void) printf("undefined\n");
8257c478bd9Sstevel@tonic-gate 				return (0);
8267c478bd9Sstevel@tonic-gate 			}
8277c478bd9Sstevel@tonic-gate 		} else
8287c478bd9Sstevel@tonic-gate 			(void) printf("%ld\n", value);
8297c478bd9Sstevel@tonic-gate 		break;
8307c478bd9Sstevel@tonic-gate 
8317c478bd9Sstevel@tonic-gate 	case CONFSTR:
8327c478bd9Sstevel@tonic-gate 		if (argc > 2)
8337c478bd9Sstevel@tonic-gate 			return (usage());
8347c478bd9Sstevel@tonic-gate 		errno = 0;
8357c478bd9Sstevel@tonic-gate 		len = confstr((int)scp->value, NULL, (size_t)0);
836*1cfc4fb7SDavid Höppner 		if (len == 0) {
8377c478bd9Sstevel@tonic-gate 			if (errno == EINVAL) {
8387c478bd9Sstevel@tonic-gate 				(void) fprintf(stderr, gettext(INVAL_ARG),
8397c478bd9Sstevel@tonic-gate 				    name);
8407c478bd9Sstevel@tonic-gate 				return (1);
8417c478bd9Sstevel@tonic-gate 			} else {
8427c478bd9Sstevel@tonic-gate 				/* DO NOT TRANSLATE */
8437c478bd9Sstevel@tonic-gate 				(void) printf("undefined\n");
8447c478bd9Sstevel@tonic-gate 				return (0);
8457c478bd9Sstevel@tonic-gate 			}
846*1cfc4fb7SDavid Höppner 		}
8477c478bd9Sstevel@tonic-gate 		/*
8487c478bd9Sstevel@tonic-gate 		 * allocate space to store result of constr() into
8497c478bd9Sstevel@tonic-gate 		 */
8507c478bd9Sstevel@tonic-gate 		if ((buffer = malloc(len)) == NULL) {
8517c478bd9Sstevel@tonic-gate 			(void) fprintf(stderr,
8527c478bd9Sstevel@tonic-gate 			    gettext("insufficient memory available"));
8537c478bd9Sstevel@tonic-gate 			return (1);
8547c478bd9Sstevel@tonic-gate 		}
8557c478bd9Sstevel@tonic-gate 
8567c478bd9Sstevel@tonic-gate 		assert(confstr((int)scp->value, buffer, len) != 0);
8577c478bd9Sstevel@tonic-gate 
8587c478bd9Sstevel@tonic-gate 		(void) printf("%s\n", buffer);
8597c478bd9Sstevel@tonic-gate 		free(buffer);
8607c478bd9Sstevel@tonic-gate 		break;
8617c478bd9Sstevel@tonic-gate 
8627c478bd9Sstevel@tonic-gate 	case PATHCONF:
8637c478bd9Sstevel@tonic-gate 		if (argc != 3)
8647c478bd9Sstevel@tonic-gate 			return (usage());
8657c478bd9Sstevel@tonic-gate 		errno = 0;
8667c478bd9Sstevel@tonic-gate 		if ((value = pathconf(file, (int)scp->value)) == -1) {
8677c478bd9Sstevel@tonic-gate 			if (errno == EINVAL || errno == 0) {
8687c478bd9Sstevel@tonic-gate 				/* Does not support the association */
8697c478bd9Sstevel@tonic-gate 				/* DO NOT TRANSLATE */
8707c478bd9Sstevel@tonic-gate 				(void) printf("undefined\n");
8717c478bd9Sstevel@tonic-gate 				return (0);
8727c478bd9Sstevel@tonic-gate 			} else {
8737c478bd9Sstevel@tonic-gate 				/* Probably problems with the pathname itself */
8747c478bd9Sstevel@tonic-gate 				if (aflag) {
8757c478bd9Sstevel@tonic-gate 					(void) printf("%s\n", file);
8767c478bd9Sstevel@tonic-gate 				} else {
8777c478bd9Sstevel@tonic-gate 					(void) printf("%s", file);
8787c478bd9Sstevel@tonic-gate 				}
8797c478bd9Sstevel@tonic-gate 				return (1);
8807c478bd9Sstevel@tonic-gate 			}
8817c478bd9Sstevel@tonic-gate 		}
8827c478bd9Sstevel@tonic-gate 		(void) printf("%ld\n", value);
8837c478bd9Sstevel@tonic-gate 		break;
8847c478bd9Sstevel@tonic-gate 	}
8857c478bd9Sstevel@tonic-gate 	return (0);
8867c478bd9Sstevel@tonic-gate }
8877c478bd9Sstevel@tonic-gate 
8887c478bd9Sstevel@tonic-gate int
8897c478bd9Sstevel@tonic-gate main(int argc, char **argv)
8907c478bd9Sstevel@tonic-gate {
8917c478bd9Sstevel@tonic-gate 	register struct sctab *scp;
8927c478bd9Sstevel@tonic-gate 	int c;
8937c478bd9Sstevel@tonic-gate 	int exstat = 0;
8947c478bd9Sstevel@tonic-gate 
8957c478bd9Sstevel@tonic-gate 	(void) setlocale(LC_ALL, "");
8967c478bd9Sstevel@tonic-gate #if	!defined(TEXT_DOMAIN)	/* Should be defined by cc -D */
8977c478bd9Sstevel@tonic-gate #define	TEXT_DOMAIN "SYS_TEST"
8987c478bd9Sstevel@tonic-gate #endif
8997c478bd9Sstevel@tonic-gate 	(void) textdomain(TEXT_DOMAIN);
9007c478bd9Sstevel@tonic-gate 
9017c478bd9Sstevel@tonic-gate 	while ((c = getopt(argc, argv, "av:")) != -1)
9027c478bd9Sstevel@tonic-gate 		switch (c) {
9037c478bd9Sstevel@tonic-gate 		case 'a':
9047c478bd9Sstevel@tonic-gate 			aflag = 1;
9057c478bd9Sstevel@tonic-gate 			break;
9067c478bd9Sstevel@tonic-gate 		case 'v':
9077c478bd9Sstevel@tonic-gate 			/*
9087c478bd9Sstevel@tonic-gate 			 * Unix98 adds the -v option to allow
9097c478bd9Sstevel@tonic-gate 			 * programming 'specifications' to be
9107c478bd9Sstevel@tonic-gate 			 * indicated, for present purposes
9117c478bd9Sstevel@tonic-gate 			 * the specification isn't really
9127c478bd9Sstevel@tonic-gate 			 * doing anything of value, so for
9137c478bd9Sstevel@tonic-gate 			 * the moment getopt just processes the
9147c478bd9Sstevel@tonic-gate 			 * option value and argv[1] is adjusted.
9157c478bd9Sstevel@tonic-gate 			 *
9167c478bd9Sstevel@tonic-gate 			 * At some later date we might want to
9177c478bd9Sstevel@tonic-gate 			 * do specification processing at this
9187c478bd9Sstevel@tonic-gate 			 * point.
9197c478bd9Sstevel@tonic-gate 			 */
9207c478bd9Sstevel@tonic-gate 			break;
9217c478bd9Sstevel@tonic-gate 		case '?':
9227c478bd9Sstevel@tonic-gate 			return (usage());
9237c478bd9Sstevel@tonic-gate 		}
9247c478bd9Sstevel@tonic-gate 	argc -= optind-1;
9257c478bd9Sstevel@tonic-gate 	argv += optind-1;
9267c478bd9Sstevel@tonic-gate 
9277c478bd9Sstevel@tonic-gate 	if ((aflag && argc >= 2) || (!aflag && argc < 2))
9287c478bd9Sstevel@tonic-gate 		return (usage());
9297c478bd9Sstevel@tonic-gate 	if (aflag) {
9307c478bd9Sstevel@tonic-gate 
9317c478bd9Sstevel@tonic-gate #define	TabStop		8
9327c478bd9Sstevel@tonic-gate #define	RightColumn	32
9337c478bd9Sstevel@tonic-gate #define	DefPathName	"."
9347c478bd9Sstevel@tonic-gate 
9357c478bd9Sstevel@tonic-gate 		/*
9367c478bd9Sstevel@tonic-gate 		 * sort the table by the "name" field
9377c478bd9Sstevel@tonic-gate 		 * so we print it in sorted order
9387c478bd9Sstevel@tonic-gate 		 */
9397c478bd9Sstevel@tonic-gate 	qsort(&sctab[0], (sizeof (sctab)/sizeof (struct sctab))-1,
9407c478bd9Sstevel@tonic-gate 	    sizeof (struct sctab), namecmp);
9417c478bd9Sstevel@tonic-gate 
9427c478bd9Sstevel@tonic-gate 		/*
9437c478bd9Sstevel@tonic-gate 		 * print all the known symbols and their values
9447c478bd9Sstevel@tonic-gate 		 */
9457c478bd9Sstevel@tonic-gate 		for (scp = &sctab[0]; scp->name != NULL; ++scp) {
9467c478bd9Sstevel@tonic-gate 			int stat;
9477c478bd9Sstevel@tonic-gate 
9487c478bd9Sstevel@tonic-gate 			/*
9497c478bd9Sstevel@tonic-gate 			 * create 2 columns:
9507c478bd9Sstevel@tonic-gate 			 *   variable name in the left column,
9517c478bd9Sstevel@tonic-gate 			 *   value in the right column.
9527c478bd9Sstevel@tonic-gate 			 * The right column starts at a tab stop.
9537c478bd9Sstevel@tonic-gate 			 */
9547c478bd9Sstevel@tonic-gate 			(void) printf("%s:\t", scp->name);
9557c478bd9Sstevel@tonic-gate 
9567c478bd9Sstevel@tonic-gate 			c = strlen(scp->name) + 1;
9577c478bd9Sstevel@tonic-gate 			c = (c+TabStop) / TabStop, c *= TabStop;
9587c478bd9Sstevel@tonic-gate 			for (; c < RightColumn; c += TabStop)
9597c478bd9Sstevel@tonic-gate 				(void) putchar('\t');
9607c478bd9Sstevel@tonic-gate 
9617c478bd9Sstevel@tonic-gate 			/*
9627c478bd9Sstevel@tonic-gate 			 * for pathconf() related variables that require
9637c478bd9Sstevel@tonic-gate 			 * a pathname, use "."
9647c478bd9Sstevel@tonic-gate 			 */
9657c478bd9Sstevel@tonic-gate 			stat = getconf(scp, scp->type == PATHCONF ? 3 : 2,
9667c478bd9Sstevel@tonic-gate 			    scp->name, DefPathName);
9677c478bd9Sstevel@tonic-gate 
9687c478bd9Sstevel@tonic-gate 			exstat |= stat;
9697c478bd9Sstevel@tonic-gate 
9707c478bd9Sstevel@tonic-gate 			/*
9717c478bd9Sstevel@tonic-gate 			 * if stat != 0, then an error message was already
9727c478bd9Sstevel@tonic-gate 			 * printed in getconf(),
9737c478bd9Sstevel@tonic-gate 			 * so don't need to print one here
9747c478bd9Sstevel@tonic-gate 			 */
9757c478bd9Sstevel@tonic-gate 		}
9767c478bd9Sstevel@tonic-gate 	} else {
9777c478bd9Sstevel@tonic-gate 
9787c478bd9Sstevel@tonic-gate 		/*
9797c478bd9Sstevel@tonic-gate 		 * find the name of the specified variable (argv[1])
9807c478bd9Sstevel@tonic-gate 		 * and print its value.
9817c478bd9Sstevel@tonic-gate 		 */
9827c478bd9Sstevel@tonic-gate 		for (scp = &sctab[0]; scp->name != NULL; ++scp)
9837c478bd9Sstevel@tonic-gate 			if (strcmp(argv[1], scp->name) == 0) {
9847c478bd9Sstevel@tonic-gate 				exstat = getconf(scp, argc, argv[1], argv[2]);
9857c478bd9Sstevel@tonic-gate 				break;
9867c478bd9Sstevel@tonic-gate 			}
9877c478bd9Sstevel@tonic-gate 
9887c478bd9Sstevel@tonic-gate 		/*
9897c478bd9Sstevel@tonic-gate 		 * if at last entry in table, then the user specified
9907c478bd9Sstevel@tonic-gate 		 * variable is invalid
9917c478bd9Sstevel@tonic-gate 		 */
9927c478bd9Sstevel@tonic-gate 		if (scp->name == NULL) {
9937c478bd9Sstevel@tonic-gate 			errno = EINVAL;
9947c478bd9Sstevel@tonic-gate 			(void) fprintf(stderr, gettext(INVAL_ARG), argv[1]);
9957c478bd9Sstevel@tonic-gate 			return (1);
9967c478bd9Sstevel@tonic-gate 		}
9977c478bd9Sstevel@tonic-gate 	}
9987c478bd9Sstevel@tonic-gate 	return (exstat);
9997c478bd9Sstevel@tonic-gate }
1000