minix/lib/libc/gen/sysconf.3
Ben Gras 2fe8fb192f Full switch to clang/ELF. Drop ack. Simplify.
There is important information about booting non-ack images in
docs/UPDATING. ack/aout-format images can't be built any more, and
booting clang/ELF-format ones is a little different. Updating to the
new boot monitor is recommended.

Changes in this commit:

	. drop boot monitor -> allowing dropping ack support
	. facility to copy ELF boot files to /boot so that old boot monitor
	  can still boot fairly easily, see UPDATING
	. no more ack-format libraries -> single-case libraries
	. some cleanup of OBJECT_FMT, COMPILER_TYPE, etc cases
	. drop several ack toolchain commands, but not all support
	  commands (e.g. aal is gone but acksize is not yet).
	. a few libc files moved to netbsd libc dir
	. new /bin/date as minix date used code in libc/
	. test compile fix
	. harmonize includes
	. /usr/lib is no longer special: without ack, /usr/lib plays no
	  kind of special bootstrapping role any more and bootstrapping
	  is done exclusively through packages, so releases depend even
	  less on the state of the machine making them now.
	. rename nbsd_lib* to lib*
	. reduce mtree
2012-02-14 14:52:02 +01:00

329 lines
9.2 KiB
Groff

.\" $NetBSD: sysconf.3,v 1.37 2010/03/22 19:30:54 joerg Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS 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.
.\"
.\" @(#)sysconf.3 8.3 (Berkeley) 4/19/94
.\"
.Dd August 6, 2008
.Dt SYSCONF 3
.Os
.Sh NAME
.Nm sysconf
.Nd get configurable system variables
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In unistd.h
.Ft long
.Fn sysconf "int name"
.Sh DESCRIPTION
This interface is defined by
.St -p1003.1-88 .
A far more complete interface is available using
.Xr sysctl 3 .
.Pp
The
.Fn sysconf
function provides a method for applications to determine the current
value of a configurable system limit or option variable.
The
.Fa name
argument specifies the system variable to be queried.
Symbolic constants for each name value are found in the include file
.In unistd.h .
.Pp
The available values are as follows:
.Bl -tag -width "123456"
.It Li _SC_ARG_MAX
The maximum bytes of argument to
.Xr execve 2 .
.It Li _SC_ATEXIT_MAX
The maxmimum number of functions that may be registered with
.Xr atexit 3 .
.It Li _SC_BARRIERS
The version of
.St -p1003.1
and its
Barriers
option to which the system attempts to conform,
otherwise \-1.
.It Li _SC_CLOCK_SELECTION
Return the
.Tn POSIX
version the implementation of the Clock Selection Option
on this system conforms to,
or \-1 if unavailable.
.It Li _SC_CHILD_MAX
The maximum number of simultaneous processes per user id.
.It Li _SC_CLK_TCK
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
structures that a process has available for use with
.Xr preadv 2 ,
.Xr pwritev 2 ,
.Xr readv 2 ,
.Xr recvmsg 2 ,
.Xr sendmsg 2
or
.Xr writev 2 .
.It Li _SC_JOB_CONTROL
Return 1 if job control is available on this system, otherwise \-1.
.It Li _SC_LOGIN_NAME_MAX
Returns the size of the storage required for a login name, in bytes,
including the terminating NUL.
.It Li _SC_MAPPED_FILES
Return 1 if the Memory Mapped Files Option is available on this system,
otherwise \-1.
.It Li _SC_MEMLOCK
Return 1 if the Process Memory Locking Option is available on this system,
otherwise \-1.
.It Li _SC_MEMLOCK_RANGE
Return 1 if the Range Memory Locking Option is available on this system,
otherwise \-1.
.It Li _SC_MEMORY_PROTECTION
Return 1 if the Memory Protection Option is available on this system,
otherwise \-1.
.It Li _SC_MONOTONIC_CLOCK
Return the
.Tn POSIX
version the implementation of the Monotonic Clock Option
on this system conforms to,
or \-1 if unavailable.
.It Li _SC_NGROUPS_MAX
The maximum number of supplemental groups.
.It Li _SC_OPEN_MAX
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
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
and its
Semaphores
option to which the system attempts to conform,
otherwise \-1.
.Pp
Availability of the
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
and its
Spin Locks
option to which the system attempts to conform,
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.
.It Li _SC_THREADS
The version of
.St -p1003.1
and its
Threads
option to which the system attempts to conform,
otherwise \-1.
.It Li _SC_TIMERS
The version of
.St -p1003.1
and its
Timers
option to which the system attempts to conform,
otherwise \-1.
.It Li _SC_TZNAME_MAX
The minimum maximum number of types supported for the name of a
timezone.
.It Li _SC_SAVED_IDS
Returns 1 if saved set-group and saved set-user ID is available,
otherwise \-1.
.It Li _SC_VERSION
The version of ISO/IEC 9945 (POSIX 1003.1) with which the system
attempts to comply.
.It Li _SC_XOPEN_SHM
Return 1 if the
.St -xpg4.2
Shared Memory
option is available on this system,
otherwise \-1.
.Pp
Availability of the
Shared Memory
option depends on the
.Li SYSVSHM
kernel option.
.It Li _SC_BC_BASE_MAX
The maximum ibase/obase values in the
.Xr bc 1
utility.
.It Li _SC_BC_DIM_MAX
The maximum array size in the
.Xr bc 1
utility.
.It Li _SC_BC_SCALE_MAX
The maximum scale value in the
.Xr bc 1
utility.
.It Li _SC_BC_STRING_MAX
The maximum string length in the
.Xr bc 1
utility.
.It Li _SC_COLL_WEIGHTS_MAX
The maximum number of weights that can be assigned to any entry of
the LC_COLLATE order keyword in the locale definition file.
.It Li _SC_EXPR_NEST_MAX
The maximum number of expressions that can be nested within
parenthesis by the
.Xr expr 1
utility.
.It Li _SC_LINE_MAX
The maximum length in bytes of a text-processing utility's input
line.
.It Li _SC_RE_DUP_MAX
The maximum number of repeated occurrences of a regular expression
permitted when using interval notation.
.It Li _SC_2_VERSION
The version of POSIX 1003.2 with which the system attempts to comply.
.It Li _SC_2_C_BIND
Return 1 if the system's C-language development facilities support the
C-Language Bindings Option, otherwise \-1.
.It Li _SC_2_C_DEV
Return 1 if the system supports the C-Language Development Utilities Option,
otherwise \-1.
.It Li _SC_2_CHAR_TERM
Return 1 if the system supports at least one terminal type capable of
all operations described in POSIX 1003.2, otherwise \-1.
.It Li _SC_2_FORT_DEV
Return 1 if the system supports the FORTRAN Development Utilities Option,
otherwise \-1.
.It Li _SC_2_FORT_RUN
Return 1 if the system supports the FORTRAN Runtime Utilities Option,
otherwise \-1.
.It Li _SC_2_LOCALEDEF
Return 1 if the system supports the creation of locales, otherwise \-1.
.It Li _SC_2_SW_DEV
Return 1 if the system supports the Software Development Utilities Option,
otherwise \-1.
.It Li _SC_2_UPE
Return 1 if the system supports the User Portability Utilities Option,
otherwise \-1.
.It Li _SC_GETGR_R_SIZE_MAX
The minimum size of the
.Fa buffer
passed to
.Xr getgrgid_r 3
and
.Xr getgrnam_r 3 .
.It Li _SC_GETPW_R_SIZE_MAX
The minimum size of the
.Fa buffer
passed to
.Xr getpwnam_r 3
and
.Xr getpwuid_r 3 .
.It Li _SC_NPROCESSORS_CONF
The number of processors configured.
.It Li _SC_NPROCESSORS_ONLN
The number of processors online (capable of running processes).
.El
.Sh RETURN VALUES
If the call to
.Nm sysconf
is not successful, \-1 is returned and
.Va errno
is set appropriately.
Otherwise, if the variable is associated with functionality that is not
supported, \-1 is returned and
.Va errno
is not modified.
Otherwise, the current variable value is returned.
.Sh ERRORS
The
.Fn sysconf
function may fail and set
.Va errno
for any of the errors specified for the library functions
.Xr sysctl 3 .
In addition, the following error may be reported:
.Bl -tag -width Er
.It Bq Er EINVAL
The value of the
.Fa name
argument is invalid.
.El
.Sh SEE ALSO
.Xr sysctl 3
.Sh STANDARDS
The
.Fn sysconf
function conforms to
.St -p1003.1-90 .
The constants
.Li _SC_NPROCESSORS_CONF
and
.Li _SC_NPROCESSORS_ONLN
are not part of the standard, but are provided by many systems.
.Sh HISTORY
The
.Nm sysconf
function first appeared in
.Bx 4.4 .
.Sh BUGS
The value for _SC_STREAM_MAX is a minimum maximum, and required to be
the same as ANSI C's FOPEN_MAX, so the returned value is a ridiculously
small and misleading number.