summaryrefslogtreecommitdiff
path: root/lib/libc/gen/sysconf.c
AgeCommit message (Collapse)Author
2022-07-19Use sysctl CTL_NET.PF_INET6 to check if IPv6 is available or not.Claudio Jeker
With this sysconf(3) no longer needs the inet pledge. The kernel has been updated for this for a while now. OK sthen@ deraadt@
2020-10-12mib[2] is no longer used; ok guentherTheo de Raadt
2018-07-12Add hw.ncpuonline to count the number of online CPUs.cheloha
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
2017-09-10shm_open(), sysconf(), tcflow(), and tcsendbreak() are not permitted to bePhilip Guenther
cancellation points in POSIX, so change them to invoke the non-cancellation point versions of open(), close(), nanosleep(), and write() ok deraadt@ millert@
2016-03-20Rearrange C runtime bits: now that ld.so exports environ and __progname,Philip Guenther
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@
2015-09-12Wrap <unistd.h> so that internal calls go direct and they're all weak symbolsPhilip Guenther
Delete unused 'fd' argument from internal function oldttyname()
2015-01-16Replace HOST_NAME_MAX+1-1 with HOST_NAME_MAX. OK deraad@Todd C. Miller
2015-01-16Move to the <limits.h> universe.Theo de Raadt
review by millert, binary checking process with doug, concept with guenther
2014-07-08decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hTheo de Raadt
don't need to be married. ok guenther miod beck jsing kettenis
2014-04-08Use VM_UVMEXP instead of VM_METER for memory usages and directlyMartin Pieuchot
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@
2013-03-24sysconf(_SC_SEM_VALUE_MAX) should return SEM_VALUE_MAX, not somePhilip Guenther
unrelated sysv sem limit. Similarly, sysconf(_SC_SEM_NSEMS_MAX) should return -1 instead of another sysv sem limit.
2012-08-29Fix _SC_CHILD_MAX, _SC_OPEN_MAX, and _SC_STREAM_MAX to correctlyMatthew Dempsky
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.
2012-06-24In sysconf(), don't bother querying the kernel for userspace-onlyMatthew Dempsky
values or features that POSIX now requires to always be provided. From Brad; ok guenther and me; incorporates feedback from millert too
2012-05-14More sysconf(3)-y and pathconf(3)-y goodness from Brad.Matthew Dempsky
ok guenther, millert (and me); bulk build test by naddy
2012-03-06Add the _POSIX_MONOTONIC_CLOCK symbol and the sysconf(3)Antoine Jacoutot
_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@
2011-04-25Teach sysconf(_SC_GETGR_R_SIZE_MAX) the correct size of a buffer for theStuart Henderson
reentrant getgrent functions (getgrgid_r, getgrnam_r). seems reasonable to millert@, ok deraadt@
2010-10-28support _SC_HOST_NAME_MAX; from bradTheo de Raadt
a libc crank is happening in < 24 hours
2010-01-15Add support to sysconf(3) for the variables _SC_NPROCESSORS_CONF andStuart Henderson
_SC_NPROCESSORS_ONLN, implemented by AIX/Tru64/Solaris/Linux/SCO/FreeBSD/NetBSD. Bump libc minor. From Brad, ok deraadt@ guenther@
2008-06-25Implement _SC_GETGR_R_SIZE_MAX, _SC_GETPW_R_SIZE_MAX, _SC_LOGIN_NAME_MAX,Todd C. Miller
and _SC_THREAD_SAFE_FUNCTIONS for sysconf(3). OK deraadt@
2008-03-16Add the semi-standard _SC_PHYS_PAGES and _SC_AVPHYS_PAGES, sysconf(3) variable.Mark Kettenis
ok espie@
2005-08-08zap remaining rcsid.Marc Espie
Kill old files that are no longer compiled. okay theo
2004-05-18ansify function definitions and zap some `register'Jean-Francois Brousseau
ok millert@
2004-05-07Implement _SC_SEM_NSEMS_MAX and _SC_SEM_VALUE_MAX.Todd C. Miller
Based on a diff from Jean-Gérard Pailloncy.
2003-06-02Remove the advertising clause in the UCB license which BerkeleyTodd C. Miller
rescinded 22 July 1999. Proofed by myself and Theo.
1998-06-02add sysctl and sysconf support for sysvsem, sysvshm, sysvmsg, and fsync; ↵Theo de Raadt
mostly from kleink
1996-09-15Remove dead codeThorsten Lockert
Remove unused variables Silence some warnings lint(1) is your friend
1996-08-19Fix RCS idsThorsten Lockert
Make sure everything uses {SYS,}LIBC_SCCS properly
1995-10-18initial import of NetBSD treeTheo de Raadt