summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen (follow)
Commit message (Collapse)AuthorAgeFilesLines
* article fixes; from eddie yousephjmc2021-02-021-3/+3
|
* Make fts_{alloc,safe_changed}() const correcttb2021-01-081-5/+5
| | | | | | | | | | | Previously, this code was passing string constants to functions that did not declare their parameters as const. After this patch, the functions now declare that they do not modify these arguments, making it safe to pass string constants. Fixes -Wincompatible-pointer-types-discards-qualifiers. From Adam Barth <abarth google com> ok millert
* sleep(3): don't bypass nanosleep(2) if seconds is zerocheloha2021-01-071-4/+1
| | | | | | | | | | | | | | | | | | | | | | sleep(3) does not call nanosleep(2) if seconds is zero. This is bad. As a simplified interface to nanosleep(2), sleep(3) should delegate all decisions about whether or not to yield the CPU to nanosleep(2). This patch removes the nanosleep(2) bypass from sleep(3). This means that this code: sleep(0); will block for up to 1 tick, just like the equivalent nanosleep(2) call. Neither FreeBSD nor NetBSD bypass nanosleep(2) in the zero case, so this commit brings our sleep(3) closer to theirs in behavior. As an added bonus, sleep(3) will now *always* appear in a ktrace(1) as a call to nanosleep(2). ok millert@
* Constify dktypenames and fstypenames in libc.guenther2020-11-141-3/+3
| | | | | | Adjust variable declaration in disklabel to match. ok millert@ deraadt@
* Align the basename(3) and dirname(3) prototypes with the POSIX spec:naddy2020-10-204-10/+10
| | | | | | | Both functions take a non-const parameter. Implementations may modify the passed string, even though ours do not. ok stsp@ deraadt@ millert@
* Do some easy .data -> .rodata/.data.rel.ro conversionsguenther2020-10-134-8/+8
| | | | ok millert@ deraadt@
* make fixed-sized fixed-value mib[] arrays be constderaadt2020-10-127-28/+15
| | | | ok guenther tb millert
* mib[2] is no longer used; ok guentherderaadt2020-10-121-2/+2
|
* Add support for timeconting in userland.pirofti2020-07-064-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | This diff exposes parts of clock_gettime(2) and gettimeofday(2) to userland via libc eliberating processes from the need for a context switch everytime they want to count the passage of time. If a timecounter clock can be exposed to userland than it needs to set its tc_user member to a non-zero value. Tested with one or multiple counters per architecture. The timing data is shared through a pointer found in the new ELF auxiliary vector AUX_openbsd_timekeep containing timehands information that is frequently updated by the kernel. Timing differences between the last kernel update and the current time are adjusted in userland by the tc_get_timecount() function inside the MD usertc.c file. This permits a much more responsive environment, quite visible in browsers, office programs and gaming (apparently one is are able to fly in Minecraft now). Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others! OK from at least kettenis@, cheloha@, naddy@, sthen@
* Prevent infinite for loop since i went from ssize_t to size_t. Patch fromdtucker2020-04-211-3/+3
| | | | eagleoflqj via OpenSSH github PR#178, ok djm@, feedback & ok millert@
* typo in commentdjm2020-03-131-2/+2
| | | | spotted at https://fossies.org/linux/misc/openssh-8.2p1.tar.gz/codespell.html
* correct Research Unix edition "appeared in" use in HISTORYjsg2020-02-082-6/+6
| | | | | | | | | | | | | | | | | Starting from "Combined Table of Contents" in Doug McIlroy's "A Research UNIX Reader" a table of which edition manuals appeared in. Checked against manuals from bitsavers/TUHS and source from TUHS where available. Ingo points out there are cases where something is included but not documented until a later release. bcd(6) v6 v7 printf(3) v2 v4 abort(3) v5 v6 system(3) v6 v7 fmod(3) v5 v6 ok schwarze@
* More precision regarding the openlog(3) *ident argument;schwarze2020-02-051-21/+61
| | | | | | | | | direction suggested by Laurence Tratt <laurie at tratt dot net>, part of the wording from deraadt@. While here, add the missing STANDARDS section, correct HISTORY, drop redundant verbiage from RETURN VALUES, and garbage collect .Tn. OK sthen@ jmc@ millert@ and Laurence Tratt, and deraadt@ likes one line of the patch in particular.
* Warn that auth_call(3) users should include a "--" argument beforejsg2019-12-211-2/+7
| | | | | | non-optional arguments to stop getopt(3) processing. ok deraadt@
* Remove includes that are no longer neeed after tedu's simplification.millert2019-12-101-4/+1
| | | | OK jca@
* libc's authentication privsep layer performed insufficient usernamederaadt2019-12-042-10/+39
| | | | | | | | validation. Repair work mostly by markus and millert, first of all solving the primary problem, then adding some additional validation points. And then futher validation in login and su. This will be 6.5/021_libcauth.patch.sig and 6.6/010_libcauth.patch.sig Reported by Qualys
* setting uid to -1 won't work with setresuid, so detect that conditiontedu2019-10-181-1/+19
| | | | | and return an error instead. may prevent some unset/missing confusion. ok deraadt millert
* More correction of section 3 layout. directory->opendir, fts->fts_open,deraadt2019-09-027-59/+36
| | | | | getcap->cgetent. pwcache->user_from_uid. And then repair references. ok jmc
* ypclnt -> yp_bind;jmc2019-08-301-3/+3
|
* mop up stdarg rename; ok deraadtjmc2019-08-301-3/+3
|
* No specific called "exec(3)", so move primary manpage to a name whichderaadt2019-08-113-14/+10
| | | | | | | | does exist -- execv(3). Still call this a family but without "Nm". Adjust Xr in various pages to refer to the precise function used rather than the family, in most cases the semantics of execve(2) are being referenced, so change the Xr. ok jmc
* Replace cross-references to sigvec(3) with sigaction(2).millert2019-07-261-5/+3
| | | | OK guenther@
* improve verb-tense for explaining the calling convention of __deraadt2019-07-051-3/+3
| | | | ok guenther jmc
* snprintf/vsnprintf return < 0 on error, rather than -1.deraadt2019-07-031-2/+2
|
* The "always hint that getpw operation is happening with access() the YPderaadt2019-07-023-3/+16
| | | | | | | lock file" would trash errno, creating confusion. One instance found by richardipsum@fastmail, other two identified from original commit ok millert
* tweak previous; ok guentherjmc2019-06-301-5/+6
|
* Document that getcwd() and realpath() are built on system calls thatguenther2019-06-291-2/+17
| | | | | | | have a different calling convention than the standard function...as seen in kdump output. ok deraadt@ schwarze@
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-2817-55/+55
| | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
* delete duplicate .Xr below SEE ALSOschwarze2019-06-281-3/+2
|
* More consistently put remarks about the less useful LC_* categoties,schwarze2019-05-163-6/+37
| | | | | | i.e. those other than LC_CTYPE, into the CAVEATS section, and standardize wording somewhat. OK jmc@
* The fd used by nlist() isn't application visible, so mark it close-on-execguenther2019-05-131-2/+2
| | | | | | to avoid leaking it ok deraadt@
* Remove useless secure_path(3) calls.millert2019-03-232-25/+12
| | | | | | There is no point in checking permissions of files in root-owned directories. If it even was a problem, secure_path(3) suffers from unsolvable TOCTOU issues. OK deraadt@
* remove a sentence that was once helpful when dirname.3 and basename.3benno2019-03-081-3/+3
| | | | | shared one manpage. ok florian@
* Make gl_pathc, gl_matchc and gl_offs size_t in glob_t to match POSIX.millert2019-02-042-25/+24
| | | | This requires a libc major version bump. OK deraadt@
* I am retiring my old email address; replace it with my OpenBSD one.millert2019-01-2517-40/+40
|
* Restore .Xr to pthread_sigmaskjca2019-01-131-3/+4
| | | | Pointed out by naddy@
* Move sigwait(3) from libpthread to libcjca2019-01-123-3/+153
| | | | | | | | POSIX wants it in libc, that's where the function can be found on other systems. Reported by naddy@, input from naddy@ and guenther@. "looks ok" guenther@, ok deraadt@ Note: riding the libc/libpthread major cranks earlier today.
* getgruid_r -> getgrgid_rtb2018-12-281-3/+3
| | | | from Lauri Tirkkonen
* Mention aligned_alloc(), prompted by Brad; ok jmc@otto2018-11-051-4/+6
|
* typo; fix from hiltjo posthumaderaadt2018-10-311-3/+3
|
* use Mdocdate;jmc2018-10-301-2/+2
|
* Add C11's timespec_get(3); minor bump for libc.guenther2018-10-303-3/+136
| | | | | | Tweaked diff from brad@ manpage tweaks florian@ and jmc@ ok deraadt@ millert@
* Fix a "copy-and-paste" error that Coverity picked up in the augment codedlg2018-10-091-2/+2
| | | | | | | | This brings it back in line with the macros. via Paco A. and the FRRouting project. ok deraadt@ visa@ guenther@ tb@
* Correct the uid_from_user() and gid_from_group() comments.millert2018-09-221-7/+7
|
* missing comma in previous;jmc2018-09-131-2/+2
|
* Add uid_from_user() and gid_from_group(), derived from pax's cache.c.millert2018-09-133-86/+442
| | | | | | It replaces the existing pwcache.c functions user_from_uid(3) and group_from_gid(3) with the pax equivalents. Adapted from NetBSD (mycroft) changes from our own pax's cache.c. OK guenther@
* Use an mmap()'d buffer instead of a static buffer for the contentsmillert2018-08-213-80/+136
| | | | | | | | of the pointer returned by getpw{ent,nam,uid}(). We unmap the buffer each time to catch callers using a stale passwd struct pointer. As a special case, we do not unmap the buffer if the previous lookup was for the same name or uid. This special case may be removed in the future. OK deraadt@
* 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
* <sys/mount.h> and <sys/swap.h> no longer require <sys/param.h>guenther2018-04-271-3/+3
| | | | ok krw@
* improve markup quality in the cases found by the new "--" style messageschwarze2018-03-161-5/+4
|