History log of /openbsd-current/lib/libc/gen/sysconf.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.28 19-Jul-2022 claudio

Use sysctl CTL_NET.PF_INET6 to check if IPv6 is available or not.
With this sysconf(3) no longer needs the inet pledge.
The kernel has been updated for this for a while now.
OK sthen@ deraadt@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.27 12-Oct-2020 deraadt

mib[2] is no longer used; ok guenther


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.26 12-Jul-2018 cheloha

Add hw.ncpuonline to count the number of online CPUs.

The introduction of hw.smt means that logical CPUs can be disabled
after boot and prior to suspend/resume. If hw.smt=0 (the default),
there needs to be a way to count the number of hardware threads
available on the system at any given time.

So, import HW_NCPUONLINE/hw.ncpuonline from NetBSD and document it.
hw.ncpu becomes equal to the number of CPUs given to sched_init_cpu()
during boot, while hw.ncpuonline is equal to the number of CPUs available
to the scheduler in the cpuset "sched_all_cpus". Set_SC_NPROCESSORS_ONLN
equal to this new sysctl and keep _SC_NPROCESSORS_CONF equal to hw.ncpu.

This is preferable to adding a new sysctl to count the number of
configured CPUs and keeping hw.ncpu equal to the number of online
CPUs because such a change would break software in the ecosystem
that relies on HW_NCPU/hw.ncpu to measure CPU usage and the like.
Such software in base includes top(1), systat(1), and snmpd(8),
and perhaps others.

We don't need additional locking to count the cardinality of a cpuset
in this case because the only interfaces that can modify said cardinality
are sysctl(2) and ioctl(2), both of which are under the KERNEL_LOCK.

Software using HW_NCPU/hw.ncpu to determine optimal parallism will need
to be updated to use HW_NCPUONLINE/hw.ncpuonline. Until then, such software
may perform suboptimally. However, most changes will be similar to the
change included here for libcxx's std::thread:hardware_concurrency():
using HW_NCPUONLINE in lieu of HW_NCPU should be sufficient for determining
optimal parallelism for most software if the change to _SC_NPROCESSORS_ONLN
is insufficient.

Prompted by deraadt. Discussed at length with kettenis, deraadt, and sthen.
Lots of patch tweaks from kettenis.

ok kettenis, "proceed" deraadt


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.25 10-Sep-2017 guenther

shm_open(), sysconf(), tcflow(), and tcsendbreak() are not permitted to be
cancellation points in POSIX, so change them to invoke the non-cancellation
point versions of open(), close(), nanosleep(), and write()

ok deraadt@ millert@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.24 20-Mar-2016 guenther

Rearrange C runtime bits: now that ld.so exports environ and __progname,
move their definitions and initialization in static links to libc.a
Make crt0 always invoke a new func _csu_finish() in libc to process the auxv
and to either register the ld.so cleanup function (in dynamic links) or
initialize environ and __progname and do MC_DISABLE_KBIND (in static links).
In libc, get pagesize from auxv; cache that between getpagesize() and
sysconf(_SC_PAGESIZE)

ok mpi@ "good time" deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.23 12-Sep-2015 guenther

Wrap <unistd.h> so that internal calls go direct and they're all weak symbols
Delete unused 'fd' argument from internal function oldttyname()


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.22 16-Jan-2015 millert

Replace HOST_NAME_MAX+1-1 with HOST_NAME_MAX. OK deraad@


# 1.21 16-Jan-2015 deraadt

Move to the <limits.h> universe.
review by millert, binary checking process with doug, concept with guenther


Revision tags: OPENBSD_5_6_BASE
# 1.20 08-Jul-2014 deraadt

decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.h
don't need to be married.
ok guenther miod beck jsing kettenis


# 1.19 08-Apr-2014 mpi

Use VM_UVMEXP instead of VM_METER for memory usages and directly
include <sys/vmmeter.h> where it is needed instead of relying on
it being included by <uvm/uvm_extern.h>.

miod@ likes it, ok guenther@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.18 24-Mar-2013 guenther

sysconf(_SC_SEM_VALUE_MAX) should return SEM_VALUE_MAX, not some
unrelated sysv sem limit. Similarly, sysconf(_SC_SEM_NSEMS_MAX)
should return -1 instead of another sysv sem limit.


Revision tags: OPENBSD_5_3_BASE
# 1.17 29-Aug-2012 matthew

Fix _SC_CHILD_MAX, _SC_OPEN_MAX, and _SC_STREAM_MAX to correctly
handle rlim_cur set to RLIM_INFINITY or values greater than LONG_MAX,
as unlikely as those are to happen. Further limit _SC_STREAM_MAX to
at most SHRT_MAX, because struct __sFILE uses a short int for storing
the file descriptor.

While here, also remove a dead label that Clang complains about.

From FreeBSD via Brad.


Revision tags: OPENBSD_5_2_BASE
# 1.16 24-Jun-2012 matthew

In sysconf(), don't bother querying the kernel for userspace-only
values or features that POSIX now requires to always be provided.

From Brad; ok guenther and me; incorporates feedback from millert too


# 1.15 14-May-2012 matthew

More sysconf(3)-y and pathconf(3)-y goodness from Brad.
ok guenther, millert (and me); bulk build test by naddy


# 1.14 06-Mar-2012 ajacoutot

Add the _POSIX_MONOTONIC_CLOCK symbol and the sysconf(3)
_SC_MONOTONIC_CLOCK variable.
from Brad

No libc minor crank needed, as no API has been changed, per se (deraadt).

ports bulk testing by landry@
small man rewording from thib@
ok millert@ otto@ deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.13 25-Apr-2011 sthen

Teach sysconf(_SC_GETGR_R_SIZE_MAX) the correct size of a buffer for the
reentrant getgrent functions (getgrgid_r, getgrnam_r).

seems reasonable to millert@, ok deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.12 28-Oct-2010 deraadt

support _SC_HOST_NAME_MAX; from brad
a libc crank is happening in < 24 hours


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.11 15-Jan-2010 sthen

Add support to sysconf(3) for the variables _SC_NPROCESSORS_CONF and
_SC_NPROCESSORS_ONLN, implemented by AIX/Tru64/Solaris/Linux/SCO/FreeBSD/NetBSD.
Bump libc minor.

From Brad, ok deraadt@ guenther@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.10 25-Jun-2008 millert

Implement _SC_GETGR_R_SIZE_MAX, _SC_GETPW_R_SIZE_MAX, _SC_LOGIN_NAME_MAX,
and _SC_THREAD_SAFE_FUNCTIONS for sysconf(3). OK deraadt@


# 1.9 16-Mar-2008 kettenis

Add the semi-standard _SC_PHYS_PAGES and _SC_AVPHYS_PAGES, sysconf(3) variable.

ok espie@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.8 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.7 18-May-2004 jfb

ansify function definitions and zap some `register'

ok millert@


# 1.6 07-May-2004 millert

Implement _SC_SEM_NSEMS_MAX and _SC_SEM_VALUE_MAX.
Based on a diff from Jean-G�rard Pailloncy.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.5 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.4 02-Jun-1998 deraadt

add sysctl and sysconf support for sysvsem, sysvshm, sysvmsg, and fsync; mostly from kleink


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.3 15-Sep-1996 tholo

Remove dead code
Remove unused variables
Silence some warnings
lint(1) is your friend


# 1.2 19-Aug-1996 tholo

Fix RCS ids
Make sure everything uses {SYS,}LIBC_SCCS properly


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.27 12-Oct-2020 deraadt

mib[2] is no longer used; ok guenther


Revision tags: OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.26 12-Jul-2018 cheloha

Add hw.ncpuonline to count the number of online CPUs.

The introduction of hw.smt means that logical CPUs can be disabled
after boot and prior to suspend/resume. If hw.smt=0 (the default),
there needs to be a way to count the number of hardware threads
available on the system at any given time.

So, import HW_NCPUONLINE/hw.ncpuonline from NetBSD and document it.
hw.ncpu becomes equal to the number of CPUs given to sched_init_cpu()
during boot, while hw.ncpuonline is equal to the number of CPUs available
to the scheduler in the cpuset "sched_all_cpus". Set_SC_NPROCESSORS_ONLN
equal to this new sysctl and keep _SC_NPROCESSORS_CONF equal to hw.ncpu.

This is preferable to adding a new sysctl to count the number of
configured CPUs and keeping hw.ncpu equal to the number of online
CPUs because such a change would break software in the ecosystem
that relies on HW_NCPU/hw.ncpu to measure CPU usage and the like.
Such software in base includes top(1), systat(1), and snmpd(8),
and perhaps others.

We don't need additional locking to count the cardinality of a cpuset
in this case because the only interfaces that can modify said cardinality
are sysctl(2) and ioctl(2), both of which are under the KERNEL_LOCK.

Software using HW_NCPU/hw.ncpu to determine optimal parallism will need
to be updated to use HW_NCPUONLINE/hw.ncpuonline. Until then, such software
may perform suboptimally. However, most changes will be similar to the
change included here for libcxx's std::thread:hardware_concurrency():
using HW_NCPUONLINE in lieu of HW_NCPU should be sufficient for determining
optimal parallelism for most software if the change to _SC_NPROCESSORS_ONLN
is insufficient.

Prompted by deraadt. Discussed at length with kettenis, deraadt, and sthen.
Lots of patch tweaks from kettenis.

ok kettenis, "proceed" deraadt


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.25 10-Sep-2017 guenther

shm_open(), sysconf(), tcflow(), and tcsendbreak() are not permitted to be
cancellation points in POSIX, so change them to invoke the non-cancellation
point versions of open(), close(), nanosleep(), and write()

ok deraadt@ millert@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.24 20-Mar-2016 guenther

Rearrange C runtime bits: now that ld.so exports environ and __progname,
move their definitions and initialization in static links to libc.a
Make crt0 always invoke a new func _csu_finish() in libc to process the auxv
and to either register the ld.so cleanup function (in dynamic links) or
initialize environ and __progname and do MC_DISABLE_KBIND (in static links).
In libc, get pagesize from auxv; cache that between getpagesize() and
sysconf(_SC_PAGESIZE)

ok mpi@ "good time" deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.23 12-Sep-2015 guenther

Wrap <unistd.h> so that internal calls go direct and they're all weak symbols
Delete unused 'fd' argument from internal function oldttyname()


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.22 16-Jan-2015 millert

Replace HOST_NAME_MAX+1-1 with HOST_NAME_MAX. OK deraad@


# 1.21 16-Jan-2015 deraadt

Move to the <limits.h> universe.
review by millert, binary checking process with doug, concept with guenther


Revision tags: OPENBSD_5_6_BASE
# 1.20 08-Jul-2014 deraadt

decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.h
don't need to be married.
ok guenther miod beck jsing kettenis


# 1.19 08-Apr-2014 mpi

Use VM_UVMEXP instead of VM_METER for memory usages and directly
include <sys/vmmeter.h> where it is needed instead of relying on
it being included by <uvm/uvm_extern.h>.

miod@ likes it, ok guenther@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.18 24-Mar-2013 guenther

sysconf(_SC_SEM_VALUE_MAX) should return SEM_VALUE_MAX, not some
unrelated sysv sem limit. Similarly, sysconf(_SC_SEM_NSEMS_MAX)
should return -1 instead of another sysv sem limit.


Revision tags: OPENBSD_5_3_BASE
# 1.17 29-Aug-2012 matthew

Fix _SC_CHILD_MAX, _SC_OPEN_MAX, and _SC_STREAM_MAX to correctly
handle rlim_cur set to RLIM_INFINITY or values greater than LONG_MAX,
as unlikely as those are to happen. Further limit _SC_STREAM_MAX to
at most SHRT_MAX, because struct __sFILE uses a short int for storing
the file descriptor.

While here, also remove a dead label that Clang complains about.

From FreeBSD via Brad.


Revision tags: OPENBSD_5_2_BASE
# 1.16 24-Jun-2012 matthew

In sysconf(), don't bother querying the kernel for userspace-only
values or features that POSIX now requires to always be provided.

From Brad; ok guenther and me; incorporates feedback from millert too


# 1.15 14-May-2012 matthew

More sysconf(3)-y and pathconf(3)-y goodness from Brad.
ok guenther, millert (and me); bulk build test by naddy


# 1.14 06-Mar-2012 ajacoutot

Add the _POSIX_MONOTONIC_CLOCK symbol and the sysconf(3)
_SC_MONOTONIC_CLOCK variable.
from Brad

No libc minor crank needed, as no API has been changed, per se (deraadt).

ports bulk testing by landry@
small man rewording from thib@
ok millert@ otto@ deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.13 25-Apr-2011 sthen

Teach sysconf(_SC_GETGR_R_SIZE_MAX) the correct size of a buffer for the
reentrant getgrent functions (getgrgid_r, getgrnam_r).

seems reasonable to millert@, ok deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.12 28-Oct-2010 deraadt

support _SC_HOST_NAME_MAX; from brad
a libc crank is happening in < 24 hours


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.11 15-Jan-2010 sthen

Add support to sysconf(3) for the variables _SC_NPROCESSORS_CONF and
_SC_NPROCESSORS_ONLN, implemented by AIX/Tru64/Solaris/Linux/SCO/FreeBSD/NetBSD.
Bump libc minor.

From Brad, ok deraadt@ guenther@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.10 25-Jun-2008 millert

Implement _SC_GETGR_R_SIZE_MAX, _SC_GETPW_R_SIZE_MAX, _SC_LOGIN_NAME_MAX,
and _SC_THREAD_SAFE_FUNCTIONS for sysconf(3). OK deraadt@


# 1.9 16-Mar-2008 kettenis

Add the semi-standard _SC_PHYS_PAGES and _SC_AVPHYS_PAGES, sysconf(3) variable.

ok espie@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.8 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.7 18-May-2004 jfb

ansify function definitions and zap some `register'

ok millert@


# 1.6 07-May-2004 millert

Implement _SC_SEM_NSEMS_MAX and _SC_SEM_VALUE_MAX.
Based on a diff from Jean-G�rard Pailloncy.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.5 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.4 02-Jun-1998 deraadt

add sysctl and sysconf support for sysvsem, sysvshm, sysvmsg, and fsync; mostly from kleink


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.3 15-Sep-1996 tholo

Remove dead code
Remove unused variables
Silence some warnings
lint(1) is your friend


# 1.2 19-Aug-1996 tholo

Fix RCS ids
Make sure everything uses {SYS,}LIBC_SCCS properly


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.26 12-Jul-2018 cheloha

Add hw.ncpuonline to count the number of online CPUs.

The introduction of hw.smt means that logical CPUs can be disabled
after boot and prior to suspend/resume. If hw.smt=0 (the default),
there needs to be a way to count the number of hardware threads
available on the system at any given time.

So, import HW_NCPUONLINE/hw.ncpuonline from NetBSD and document it.
hw.ncpu becomes equal to the number of CPUs given to sched_init_cpu()
during boot, while hw.ncpuonline is equal to the number of CPUs available
to the scheduler in the cpuset "sched_all_cpus". Set_SC_NPROCESSORS_ONLN
equal to this new sysctl and keep _SC_NPROCESSORS_CONF equal to hw.ncpu.

This is preferable to adding a new sysctl to count the number of
configured CPUs and keeping hw.ncpu equal to the number of online
CPUs because such a change would break software in the ecosystem
that relies on HW_NCPU/hw.ncpu to measure CPU usage and the like.
Such software in base includes top(1), systat(1), and snmpd(8),
and perhaps others.

We don't need additional locking to count the cardinality of a cpuset
in this case because the only interfaces that can modify said cardinality
are sysctl(2) and ioctl(2), both of which are under the KERNEL_LOCK.

Software using HW_NCPU/hw.ncpu to determine optimal parallism will need
to be updated to use HW_NCPUONLINE/hw.ncpuonline. Until then, such software
may perform suboptimally. However, most changes will be similar to the
change included here for libcxx's std::thread:hardware_concurrency():
using HW_NCPUONLINE in lieu of HW_NCPU should be sufficient for determining
optimal parallelism for most software if the change to _SC_NPROCESSORS_ONLN
is insufficient.

Prompted by deraadt. Discussed at length with kettenis, deraadt, and sthen.
Lots of patch tweaks from kettenis.

ok kettenis, "proceed" deraadt


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.25 10-Sep-2017 guenther

shm_open(), sysconf(), tcflow(), and tcsendbreak() are not permitted to be
cancellation points in POSIX, so change them to invoke the non-cancellation
point versions of open(), close(), nanosleep(), and write()

ok deraadt@ millert@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.24 20-Mar-2016 guenther

Rearrange C runtime bits: now that ld.so exports environ and __progname,
move their definitions and initialization in static links to libc.a
Make crt0 always invoke a new func _csu_finish() in libc to process the auxv
and to either register the ld.so cleanup function (in dynamic links) or
initialize environ and __progname and do MC_DISABLE_KBIND (in static links).
In libc, get pagesize from auxv; cache that between getpagesize() and
sysconf(_SC_PAGESIZE)

ok mpi@ "good time" deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.23 12-Sep-2015 guenther

Wrap <unistd.h> so that internal calls go direct and they're all weak symbols
Delete unused 'fd' argument from internal function oldttyname()


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.22 16-Jan-2015 millert

Replace HOST_NAME_MAX+1-1 with HOST_NAME_MAX. OK deraad@


# 1.21 16-Jan-2015 deraadt

Move to the <limits.h> universe.
review by millert, binary checking process with doug, concept with guenther


Revision tags: OPENBSD_5_6_BASE
# 1.20 08-Jul-2014 deraadt

decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.h
don't need to be married.
ok guenther miod beck jsing kettenis


# 1.19 08-Apr-2014 mpi

Use VM_UVMEXP instead of VM_METER for memory usages and directly
include <sys/vmmeter.h> where it is needed instead of relying on
it being included by <uvm/uvm_extern.h>.

miod@ likes it, ok guenther@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.18 24-Mar-2013 guenther

sysconf(_SC_SEM_VALUE_MAX) should return SEM_VALUE_MAX, not some
unrelated sysv sem limit. Similarly, sysconf(_SC_SEM_NSEMS_MAX)
should return -1 instead of another sysv sem limit.


Revision tags: OPENBSD_5_3_BASE
# 1.17 29-Aug-2012 matthew

Fix _SC_CHILD_MAX, _SC_OPEN_MAX, and _SC_STREAM_MAX to correctly
handle rlim_cur set to RLIM_INFINITY or values greater than LONG_MAX,
as unlikely as those are to happen. Further limit _SC_STREAM_MAX to
at most SHRT_MAX, because struct __sFILE uses a short int for storing
the file descriptor.

While here, also remove a dead label that Clang complains about.

From FreeBSD via Brad.


Revision tags: OPENBSD_5_2_BASE
# 1.16 24-Jun-2012 matthew

In sysconf(), don't bother querying the kernel for userspace-only
values or features that POSIX now requires to always be provided.

From Brad; ok guenther and me; incorporates feedback from millert too


# 1.15 14-May-2012 matthew

More sysconf(3)-y and pathconf(3)-y goodness from Brad.
ok guenther, millert (and me); bulk build test by naddy


# 1.14 06-Mar-2012 ajacoutot

Add the _POSIX_MONOTONIC_CLOCK symbol and the sysconf(3)
_SC_MONOTONIC_CLOCK variable.
from Brad

No libc minor crank needed, as no API has been changed, per se (deraadt).

ports bulk testing by landry@
small man rewording from thib@
ok millert@ otto@ deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.13 25-Apr-2011 sthen

Teach sysconf(_SC_GETGR_R_SIZE_MAX) the correct size of a buffer for the
reentrant getgrent functions (getgrgid_r, getgrnam_r).

seems reasonable to millert@, ok deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.12 28-Oct-2010 deraadt

support _SC_HOST_NAME_MAX; from brad
a libc crank is happening in < 24 hours


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.11 15-Jan-2010 sthen

Add support to sysconf(3) for the variables _SC_NPROCESSORS_CONF and
_SC_NPROCESSORS_ONLN, implemented by AIX/Tru64/Solaris/Linux/SCO/FreeBSD/NetBSD.
Bump libc minor.

From Brad, ok deraadt@ guenther@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.10 25-Jun-2008 millert

Implement _SC_GETGR_R_SIZE_MAX, _SC_GETPW_R_SIZE_MAX, _SC_LOGIN_NAME_MAX,
and _SC_THREAD_SAFE_FUNCTIONS for sysconf(3). OK deraadt@


# 1.9 16-Mar-2008 kettenis

Add the semi-standard _SC_PHYS_PAGES and _SC_AVPHYS_PAGES, sysconf(3) variable.

ok espie@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.8 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.7 18-May-2004 jfb

ansify function definitions and zap some `register'

ok millert@


# 1.6 07-May-2004 millert

Implement _SC_SEM_NSEMS_MAX and _SC_SEM_VALUE_MAX.
Based on a diff from Jean-G�rard Pailloncy.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.5 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.4 02-Jun-1998 deraadt

add sysctl and sysconf support for sysvsem, sysvshm, sysvmsg, and fsync; mostly from kleink


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.3 15-Sep-1996 tholo

Remove dead code
Remove unused variables
Silence some warnings
lint(1) is your friend


# 1.2 19-Aug-1996 tholo

Fix RCS ids
Make sure everything uses {SYS,}LIBC_SCCS properly


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_6_2_BASE
# 1.25 10-Sep-2017 guenther

shm_open(), sysconf(), tcflow(), and tcsendbreak() are not permitted to be
cancellation points in POSIX, so change them to invoke the non-cancellation
point versions of open(), close(), nanosleep(), and write()

ok deraadt@ millert@


Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
# 1.24 20-Mar-2016 guenther

Rearrange C runtime bits: now that ld.so exports environ and __progname,
move their definitions and initialization in static links to libc.a
Make crt0 always invoke a new func _csu_finish() in libc to process the auxv
and to either register the ld.so cleanup function (in dynamic links) or
initialize environ and __progname and do MC_DISABLE_KBIND (in static links).
In libc, get pagesize from auxv; cache that between getpagesize() and
sysconf(_SC_PAGESIZE)

ok mpi@ "good time" deraadt@


Revision tags: OPENBSD_5_9_BASE
# 1.23 12-Sep-2015 guenther

Wrap <unistd.h> so that internal calls go direct and they're all weak symbols
Delete unused 'fd' argument from internal function oldttyname()


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.22 16-Jan-2015 millert

Replace HOST_NAME_MAX+1-1 with HOST_NAME_MAX. OK deraad@


# 1.21 16-Jan-2015 deraadt

Move to the <limits.h> universe.
review by millert, binary checking process with doug, concept with guenther


Revision tags: OPENBSD_5_6_BASE
# 1.20 08-Jul-2014 deraadt

decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.h
don't need to be married.
ok guenther miod beck jsing kettenis


# 1.19 08-Apr-2014 mpi

Use VM_UVMEXP instead of VM_METER for memory usages and directly
include <sys/vmmeter.h> where it is needed instead of relying on
it being included by <uvm/uvm_extern.h>.

miod@ likes it, ok guenther@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.18 24-Mar-2013 guenther

sysconf(_SC_SEM_VALUE_MAX) should return SEM_VALUE_MAX, not some
unrelated sysv sem limit. Similarly, sysconf(_SC_SEM_NSEMS_MAX)
should return -1 instead of another sysv sem limit.


Revision tags: OPENBSD_5_3_BASE
# 1.17 29-Aug-2012 matthew

Fix _SC_CHILD_MAX, _SC_OPEN_MAX, and _SC_STREAM_MAX to correctly
handle rlim_cur set to RLIM_INFINITY or values greater than LONG_MAX,
as unlikely as those are to happen. Further limit _SC_STREAM_MAX to
at most SHRT_MAX, because struct __sFILE uses a short int for storing
the file descriptor.

While here, also remove a dead label that Clang complains about.

From FreeBSD via Brad.


Revision tags: OPENBSD_5_2_BASE
# 1.16 24-Jun-2012 matthew

In sysconf(), don't bother querying the kernel for userspace-only
values or features that POSIX now requires to always be provided.

From Brad; ok guenther and me; incorporates feedback from millert too


# 1.15 14-May-2012 matthew

More sysconf(3)-y and pathconf(3)-y goodness from Brad.
ok guenther, millert (and me); bulk build test by naddy


# 1.14 06-Mar-2012 ajacoutot

Add the _POSIX_MONOTONIC_CLOCK symbol and the sysconf(3)
_SC_MONOTONIC_CLOCK variable.
from Brad

No libc minor crank needed, as no API has been changed, per se (deraadt).

ports bulk testing by landry@
small man rewording from thib@
ok millert@ otto@ deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.13 25-Apr-2011 sthen

Teach sysconf(_SC_GETGR_R_SIZE_MAX) the correct size of a buffer for the
reentrant getgrent functions (getgrgid_r, getgrnam_r).

seems reasonable to millert@, ok deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.12 28-Oct-2010 deraadt

support _SC_HOST_NAME_MAX; from brad
a libc crank is happening in < 24 hours


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.11 15-Jan-2010 sthen

Add support to sysconf(3) for the variables _SC_NPROCESSORS_CONF and
_SC_NPROCESSORS_ONLN, implemented by AIX/Tru64/Solaris/Linux/SCO/FreeBSD/NetBSD.
Bump libc minor.

From Brad, ok deraadt@ guenther@


Revision tags: OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.10 25-Jun-2008 millert

Implement _SC_GETGR_R_SIZE_MAX, _SC_GETPW_R_SIZE_MAX, _SC_LOGIN_NAME_MAX,
and _SC_THREAD_SAFE_FUNCTIONS for sysconf(3). OK deraadt@


# 1.9 16-Mar-2008 kettenis

Add the semi-standard _SC_PHYS_PAGES and _SC_AVPHYS_PAGES, sysconf(3) variable.

ok espie@


Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.8 08-Aug-2005 espie

zap remaining rcsid.

Kill old files that are no longer compiled.

okay theo


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE
# 1.7 18-May-2004 jfb

ansify function definitions and zap some `register'

ok millert@


# 1.6 07-May-2004 millert

Implement _SC_SEM_NSEMS_MAX and _SC_SEM_VALUE_MAX.
Based on a diff from Jean-G�rard Pailloncy.


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE
# 1.5 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE OPENBSD_3_0_BASE OPENBSD_3_1_BASE OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.4 02-Jun-1998 deraadt

add sysctl and sysconf support for sysvsem, sysvshm, sysvmsg, and fsync; mostly from kleink


Revision tags: OPENBSD_2_0_BASE OPENBSD_2_1_BASE OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.3 15-Sep-1996 tholo

Remove dead code
Remove unused variables
Silence some warnings
lint(1) is your friend


# 1.2 19-Aug-1996 tholo

Fix RCS ids
Make sure everything uses {SYS,}LIBC_SCCS properly


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision