diff --git a/include/limits.h b/include/limits.h index 7c52361b3539..8422db5cdf77 100644 --- a/include/limits.h +++ b/include/limits.h @@ -41,18 +41,27 @@ #if __POSIX_VISIBLE #define _POSIX_ARG_MAX 4096 -#define _POSIX_CHILD_MAX 6 +#define _POSIX_CHILD_MAX 25 #define _POSIX_LINK_MAX 8 #define _POSIX_MAX_CANON 255 #define _POSIX_MAX_INPUT 255 #define _POSIX_NAME_MAX 14 -#define _POSIX_NGROUPS_MAX 0 -#define _POSIX_OPEN_MAX 16 -#define _POSIX_PATH_MAX 255 +#define _POSIX_NGROUPS_MAX 8 +#define _POSIX_OPEN_MAX 20 +#define _POSIX_PATH_MAX 256 #define _POSIX_PIPE_BUF 512 #define _POSIX_SSIZE_MAX 32767 #define _POSIX_STREAM_MAX 8 -#define _POSIX_TZNAME_MAX 3 +#define _POSIX_TZNAME_MAX 6 + +#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */ +#define BC_DIM_MAX 2048 /* max array elements in bc(1) */ +#define BC_SCALE_MAX 99 /* max scale value in bc(1) */ +#define BC_STRING_MAX 1000 /* max const string length in bc(1) */ +#define COLL_WEIGHTS_MAX 0 /* max weights for order keyword */ +#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */ +#define LINE_MAX 2048 /* max bytes in an input line */ +#define RE_DUP_MAX 255 /* max RE's in interval notation */ #define _POSIX2_BC_BASE_MAX 99 #define _POSIX2_BC_DIM_MAX 2048 @@ -70,19 +79,40 @@ #define _POSIX_DELAYTIMER_MAX 32 #define _POSIX_MQ_OPEN_MAX 8 #define _POSIX_MQ_PRIO_MAX 32 -#define _POSIX_RTSIG_MAX 0 +#define _POSIX_RTSIG_MAX 8 #define _POSIX_SEM_NSEMS_MAX 256 #define _POSIX_SEM_VALUE_MAX 32767 #define _POSIX_SIGQUEUE_MAX 32 #define _POSIX_TIMER_MAX 32 #endif +#if __POSIX_VISIBLE >= 199506 +#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 +#define _POSIX_THREAD_KEYS_MAX 128 +#define _POSIX_THREAD_THREADS_MAX 64 +#endif + #if __POSIX_VISIBLE >= 200112 #define _POSIX_HOST_NAME_MAX 255 +#define _POSIX_LOGIN_NAME_MAX 9 +#define _POSIX_SS_REPL_MAX 4 +#define _POSIX_SYMLINK_MAX 255 +#define _POSIX_SYMLOOP_MAX 8 +#define _POSIX_TRACE_EVENT_NAME_MAX 30 +#define _POSIX_TRACE_NAME_MAX 8 +#define _POSIX_TRACE_SYS_MAX 8 +#define _POSIX_TRACE_USER_EVENT_MAX 32 +#define _POSIX_TTY_NAME_MAX 9 +#define _POSIX2_CHARCLASS_NAME_MAX 14 +#define _POSIX2_COLL_WEIGHTS_MAX 2 + +#define _POSIX_RE_DUP_MAX _POSIX2_RE_DUP_MAX #endif #if __XSI_VISIBLE #define _XOPEN_IOV_MAX 16 +#define _XOPEN_NAME_MAX 255 +#define _XOPEN_PATH_MAX 1024 #define PASS_MAX 128 /* _PASSWORD_LEN from */ #define NL_ARGMAX 99 /* max # of position args for printf */ diff --git a/include/unistd.h b/include/unistd.h index e893da7d4dc7..c101a1ed222d 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -260,6 +260,9 @@ typedef __uid_t_ uid_t; #define _SC_V6_ILP32_OFFBIG 104 /* user */ #define _SC_V6_LP64_OFF64 105 /* user */ #define _SC_V6_LPBIG_OFFBIG 106 /* user */ +#define _SC_IPV6 118 +#define _SC_RAW_SOCKETS 119 +#define _SC_SYMLOOP_MAX 120 #endif #if __XSI_VISIBLE diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c index ee596a2942de..2f1dccad4e93 100644 --- a/lib/libc/gen/sysconf.c +++ b/lib/libc/gen/sysconf.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -176,9 +177,13 @@ sysconf(name) return (value); case _SC_ASYNCHRONOUS_IO: +#if _POSIX_ASYNCHRONOUS_IO == 0 mib[0] = CTL_P1003_1B; mib[1] = CTL_P1003_1B_ASYNCHRONOUS_IO; - goto yesno; + break; +#else + return (_POSIX_ASYNCHRONOUS_IO); +#endif case _SC_MAPPED_FILES: return (_POSIX_MAPPED_FILES); case _SC_MEMLOCK: @@ -545,6 +550,23 @@ yesno: if (sysctl(mib, 2, &value, &len, NULL, 0) == -1) case _SC_XOPEN_XCU_VERSION: return (_XOPEN_XCU_VERSION); #endif + case _SC_SYMLOOP_MAX: + return (MAXSYMLINKS); + case _SC_RAW_SOCKETS: + return (_POSIX_RAW_SOCKETS); + case _SC_IPV6: +#if _POSIX_IPV6 == 0 + sverrno = errno; + value = socket(PF_INET6, SOCK_DGRAM, 0); + errno = sverrno; + if (value >= 0) { + close(value); + return (200112L); + } else + return (0); +#else + return (_POSIX_IPV6); +#endif case _SC_NPROCESSORS_CONF: case _SC_NPROCESSORS_ONLN: diff --git a/sys/sys/syslimits.h b/sys/sys/syslimits.h index 159944300489..20e8a47480de 100644 --- a/sys/sys/syslimits.h +++ b/sys/sys/syslimits.h @@ -37,6 +37,14 @@ #ifndef _SYS_SYSLIMITS_H_ #define _SYS_SYSLIMITS_H_ +#if !defined(_KERNEL) && !defined(_LIMITS_H_) && !defined(_SYS_PARAM_H_) +#error "No user-serviceable parts inside." +#endif + +/* + * Do not add any new variables here. (See the comment at the end of + * the file for why.) + */ #define ARG_MAX 65536 /* max bytes for an exec function */ #ifndef CHILD_MAX #define CHILD_MAX 40 /* max simultaneous processes */ @@ -53,20 +61,14 @@ #define PIPE_BUF 512 /* max bytes for atomic pipe writes */ #define IOV_MAX 1024 /* max elements in i/o vector */ -/* XXX - these don't belong here */ -#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */ -#define BC_DIM_MAX 2048 /* max array elements in bc(1) */ -#define BC_SCALE_MAX 99 /* max scale value in bc(1) */ -#define BC_STRING_MAX 1000 /* max const string length in bc(1) */ -#define COLL_WEIGHTS_MAX 0 /* max weights for order keyword */ -#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */ -#define LINE_MAX 2048 /* max bytes in an input line */ -#define RE_DUP_MAX 255 /* max RE's in interval notation */ - /* * We leave the following values undefined to force applications to either * assume conservative values or call sysconf() to get the current value. * * HOST_NAME_MAX + * LOGIN_NAME_MAX + * + * (We should do this for most of the values currently defined here, + * but many programs are not prepared to deal with this yet.) */ #endif diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h index dc4004b3bc9a..b185a356c7dd 100644 --- a/sys/sys/unistd.h +++ b/sys/sys/unistd.h @@ -59,6 +59,7 @@ #define _POSIX_CLOCK_SELECTION -1 #define _POSIX_CPUTIME -1 #define _POSIX_FSYNC 200112L +#define _POSIX_IPV6 0 #define _POSIX_JOB_CONTROL 1 #define _POSIX_MAPPED_FILES 200112L #define _POSIX_MEMLOCK -1 @@ -142,6 +143,7 @@ #define _PC_REC_MAX_XFER_SIZE 15 #define _PC_REC_MIN_XFER_SIZE 16 #define _PC_REC_XFER_ALIGN 17 +#define _PC_SYMLINK_MAX 18 #endif #if __BSD_VISIBLE