summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/sysconf.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* mib[2] is no longer used; ok guentherderaadt2020-10-121-2/+2
|
* Add hw.ncpuonline to count the number of online CPUs.cheloha2018-07-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* shm_open(), sysconf(), tcflow(), and tcsendbreak() are not permitted to beguenther2017-09-101-2/+2
| | | | | | | cancellation points in POSIX, so change them to invoke the non-cancellation point versions of open(), close(), nanosleep(), and write() ok deraadt@ millert@
* Rearrange C runtime bits: now that ld.so exports environ and __progname,guenther2016-03-201-1/+3
| | | | | | | | | | | 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@
* Wrap <unistd.h> so that internal calls go direct and they're all weak symbolsguenther2015-09-121-1/+2
| | | | Delete unused 'fd' argument from internal function oldttyname()
* Replace HOST_NAME_MAX+1-1 with HOST_NAME_MAX. OK deraad@millert2015-01-161-2/+2
|
* Move to the <limits.h> universe.deraadt2015-01-161-3/+3
| | | | review by millert, binary checking process with doug, concept with guenther
* decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hderaadt2014-07-081-3/+1
| | | | | don't need to be married. ok guenther miod beck jsing kettenis
* Use VM_UVMEXP instead of VM_METER for memory usages and directlympi2014-04-081-7/+8
| | | | | | | 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@
* sysconf(_SC_SEM_VALUE_MAX) should return SEM_VALUE_MAX, not someguenther2013-03-241-7/+3
| | | | | unrelated sysv sem limit. Similarly, sysconf(_SC_SEM_NSEMS_MAX) should return -1 instead of another sysv sem limit.
* Fix _SC_CHILD_MAX, _SC_OPEN_MAX, and _SC_STREAM_MAX to correctlymatthew2012-08-291-6/+38
| | | | | | | | | | | 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.
* In sysconf(), don't bother querying the kernel for userspace-onlymatthew2012-06-241-40/+19
| | | | | | values or features that POSIX now requires to always be provided. From Brad; ok guenther and me; incorporates feedback from millert too
* More sysconf(3)-y and pathconf(3)-y goodness from Brad.matthew2012-05-141-29/+231
| | | | ok guenther, millert (and me); bulk build test by naddy
* Add the _POSIX_MONOTONIC_CLOCK symbol and the sysconf(3)ajacoutot2012-03-061-1/+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@
* Teach sysconf(_SC_GETGR_R_SIZE_MAX) the correct size of a buffer for thesthen2011-04-251-2/+3
| | | | | | reentrant getgrent functions (getgrgid_r, getgrnam_r). seems reasonable to millert@, ok deraadt@
* support _SC_HOST_NAME_MAX; from bradderaadt2010-10-281-1/+5
| | | | a libc crank is happening in < 24 hours
* Add support to sysconf(3) for the variables _SC_NPROCESSORS_CONF andsthen2010-01-151-1/+10
| | | | | | | _SC_NPROCESSORS_ONLN, implemented by AIX/Tru64/Solaris/Linux/SCO/FreeBSD/NetBSD. Bump libc minor. From Brad, ok deraadt@ guenther@
* Implement _SC_GETGR_R_SIZE_MAX, _SC_GETPW_R_SIZE_MAX, _SC_LOGIN_NAME_MAX,millert2008-06-251-1/+15
| | | | and _SC_THREAD_SAFE_FUNCTIONS for sysconf(3). OK deraadt@
* Add the semi-standard _SC_PHYS_PAGES and _SC_AVPHYS_PAGES, sysconf(3) variable.kettenis2008-03-161-1/+27
| | | | ok espie@
* zap remaining rcsid.espie2005-08-081-4/+1
| | | | | | Kill old files that are no longer compiled. okay theo
* ansify function definitions and zap some `register'jfb2004-05-181-3/+2
| | | | ok millert@
* Implement _SC_SEM_NSEMS_MAX and _SC_SEM_VALUE_MAX.millert2004-05-071-4/+14
| | | | Based on a diff from Jean-Gérard Pailloncy.
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-6/+2
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* add sysctl and sysconf support for sysvsem, sysvshm, sysvmsg, and fsync; mostly from kleinkderaadt1998-06-021-1/+18
|
* Remove dead codetholo1996-09-151-2/+1
| | | | | | Remove unused variables Silence some warnings lint(1) is your friend
* Fix RCS idstholo1996-08-191-7/+1
| | | | Make sure everything uses {SYS,}LIBC_SCCS properly
* initial import of NetBSD treederaadt1995-10-181-0/+194