diff options
| author | matt <matt@NetBSD.org> | 2008-08-06 17:17:03 +0000 |
|---|---|---|
| committer | matt <matt@NetBSD.org> | 2008-08-06 17:17:03 +0000 |
| commit | c331e4623875c5a037e8024ed53839e295f6290a (patch) | |
| tree | e19c3bccbfc1d466b0d13d2dd892081ce97986ac /lib | |
| parent | 4e69f53b477588f7558a85973d8586033f075926 (diff) | |
Add support for missing _SC_* constants for sysconf().
From andy dot shevchenko at gmail dot com
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libc/gen/sysconf.3 | 16 | ||||
| -rw-r--r-- | lib/libc/gen/sysconf.c | 19 |
2 files changed, 30 insertions, 5 deletions
diff --git a/lib/libc/gen/sysconf.3 b/lib/libc/gen/sysconf.3 index 3b1238c72bf..c42a09abfef 100644 --- a/lib/libc/gen/sysconf.3 +++ b/lib/libc/gen/sysconf.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: sysconf.3,v 1.33 2007/10/15 14:12:56 ad Exp $ +.\" $NetBSD: sysconf.3,v 1.34 2008/08/06 17:17:04 matt Exp $ .\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. @@ -87,6 +87,8 @@ The number of clock ticks per second. .It Li _SC_FSYNC Return 1 if the File Synchronization Option is available on this system, otherwise \-1. +.It Li _SC_HOST_NAME_MAX +The maximum size of a hostname, including NULL. .It Li _SC_IOV_MAX The maximum number of .Va iovec @@ -127,6 +129,8 @@ The maximum number of supplemental groups. The maximum number of open files per process. .It Li _SC_PAGESIZE The size of a system page in bytes. +.It Li _SC_PASS_MAX +The maximum length of the password, not counting NULL. .It Li _SC_READER_WRITER_LOCKS The version of .St -p1003.1 @@ -134,6 +138,10 @@ and its Read-Write Locks option to which the system attempts to conform, otherwise \-1. +.It Li _SC_REGEXP +Return 1 if +.Tn POSIX +regular expressions are available on this system, otherwise \-1. .It Li _SC_SEMAPHORES The version of .St -p1003.1 @@ -147,6 +155,10 @@ Semaphores option depends on the .Li P1003_1B_SEMAPHORE kernel option. +.It Li _SC_SHELL +Return 1 if +.Tn POSIX +shell is available on this system, otherwise \-1. .It Li _SC_SPIN_LOCKS The version of .St -p1003.1 @@ -157,6 +169,8 @@ otherwise \-1. .It Li _SC_STREAM_MAX The minimum maximum number of streams that a process may have open at any one time. +.It Li _SC_SYMLOOP_MAX +The maximum number of symbolic links that may be expanded in a path name. .It Li _SC_SYNCHRONIZED_IO Return 1 if the Synchronized I/O Option is available on this system, otherwise \-1. diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c index 9c6b69f74e1..48e47a8e505 100644 --- a/lib/libc/gen/sysconf.c +++ b/lib/libc/gen/sysconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: sysconf.c,v 1.32 2008/06/25 11:46:12 ad Exp $ */ +/* $NetBSD: sysconf.c,v 1.33 2008/08/06 17:17:04 matt Exp $ */ /*- * Copyright (c) 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)sysconf.c 8.2 (Berkeley) 3/20/94"; #else -__RCSID("$NetBSD: sysconf.c,v 1.32 2008/06/25 11:46:12 ad Exp $"); +__RCSID("$NetBSD: sysconf.c,v 1.33 2008/08/06 17:17:04 matt Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -52,6 +52,7 @@ __RCSID("$NetBSD: sysconf.c,v 1.32 2008/06/25 11:46:12 ad Exp $"); #include <time.h> #include <unistd.h> #include <paths.h> +#include <pwd.h> #ifdef __weak_alias __weak_alias(sysconf,__sysconf) @@ -336,13 +337,23 @@ sysconf(int name) case _SC_GETPW_R_SIZE_MAX: return _GETPW_R_SIZE_MAX; +/* Unsorted */ + case _SC_HOST_NAME_MAX: + return MAXHOSTNAMELEN; + case _SC_PASS_MAX: + return _PASSWORD_LEN; + case _SC_REGEXP: + return _POSIX_REGEXP; + case _SC_SHELL: + return _POSIX_SHELL; + case _SC_SYMLOOP_MAX: + return MAXSYMLINKS; + yesno: if (sysctl(mib, mib_len, &value, &len, NULL, 0) == -1) return (-1); if (value == 0) return (-1); return (value); - /*NOTREACHED*/ - break; /* Extensions */ case _SC_NPROCESSORS_CONF: |
