summaryrefslogtreecommitdiff
path: root/src/lib/libc (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Move __cxa_thread_atexit* to its own .c file to avoid pulling the codeguenther2017-12-164-39/+64
| | | | | | | (w/ _dlctl reference) into static executables. It's all Mark's code so put his preferred copyright on it. ok kettenis@
* Remove DEF_STRONG(__cxa_thread_atexit_impl). This produces an unwantedkettenis2017-12-051-2/+1
| | | | | _libc___cxa_thread_atexit_impl reference on gcc architectures that breaks the build.
* Implement __cxa_thread_atexit to support C++11 thread_local scope. Thekettenis2017-12-053-3/+58
| | | | | | | interface is also made available as __cxa_thread_atexit_impl to satisfy the needs of GNU libstdc++. ok guenther@, millert@
* clang doesn't propagate attributes like "asm labels" and "visibility(hidden)"guenther2017-11-294-11/+23
| | | | | | | | | to builtins like mem{set,cpy,move} and __stack_smash_handler. So, when building with clang, instead mark those as protected visibility to get rid of the PLT relocations. We can't take the address of them then, but that's ok: it's a build-time error not a run-time error. ok kettenis@
* Add the missing STANDARDS section (kettenis@ noticed that these areschwarze2017-11-281-6/+14
| | | | | POSIX functions) and turn the weird DIAGNOSTICS section into a normal RETURN VALUES section while here.
* GNU ld has prefixed the contents of .gnu.warning.SYMBOL sectionstb2017-11-287-15/+15
| | | | | | | | with "warning: " since 2003, so the messages themselves need not contain the prefix anymore. From Scott Cheloha ok jca, deraadt
* Revert recent changes to unbreak ports/net/sambajca2017-11-041-2/+8
| | | | | | | | While it is not clear (to me) why that ports ends up with corrupted shared libs, reverting those changes fixes the issue and should allow us to close p2k17 more smoothly. Discussed with a bunch, ok ajacoutot@ guenther@
* 's' should include 'f'; from Jacqueline Jolicoeurotto2017-11-021-2/+2
|
* Change pthread_cleanup_{push,pop} to macros that store the cleanup infoguenther2017-10-281-8/+2
| | | | | | | | | | | | | | on the stack instead of mallocing the list and move the APIs from libpthread to libc so that they can be used inside libc. Note: the standard was explicitly written to permit/support this "macro with unmatched brace" style and it's what basically everyone else already does. We xor the info with random cookies with a random magic to detect/trip-up overwrites. Major bump to both libc and libpthread due to the API move. ok mpi@
* Restore a return that was inadvertently removed from freezero() in r1.234,jsing2017-10-191-1/+2
| | | | | | | which results in an internal double free when internal functions are not in use. ok otto@
* Add STANDARDS: denis@ spotted that it was missing.schwarze2017-10-121-2/+19
| | | | OK deraadt@ jca@ jmc@
* do not return f() where f is a void function; loop var type fixotto2017-10-051-4/+5
|
* Use dprintf instead of snprintf/writeotto2017-10-051-82/+36
|
* Make delayed free non-optional and make F do an extensive double free check.otto2017-09-231-21/+26
| | | | ok tb@ tedu@
* mapalign returns MAP_FAILED for failuer; from George Koehlerotto2017-09-121-2/+2
|
* check double free before canary for chunks; ok millert@otto2017-09-111-5/+5
|
* New POSIX xlocale implementation written from scratch.libressl-v2.6.1schwarze2017-09-0511-96/+396
| | | | | | | | | | | | Complete in the sense that all POSIX *locale(3) and *_l(3) functions are included, but in OpenBSD, we of course only really care about LC_CTYPE and we only support ASCII and UTF-8. With important help from kettenis@, guenther@, and jca@. Repeated testing in ports bulk builds by naddy@. Additional testing by jca@, sebastia@, dcoppa@, and others. OK kettenis@ dcoppa@, and guenther@ on an earlier version. Riding guenther@'s libc/librthread major bump.
* Move mutex, condvar, and thread-specific data routes, pthread_once, andguenther2017-09-052-11/+182
| | | | | | | | pthread_exit from libpthread to libc, along with low-level bits to support them. Major bump to both libc and libpthread. Requested by libressl team. Ports testing by naddy@ ok kettenis@
* delete pointless .Tn ASCII found by jca@ with mandoc -Tlintschwarze2017-09-021-5/+4
|
* Mention strtok_r in STANDARDSjca2017-08-311-2/+6
| | | | POSIX 2001 instead of POSIX.1c suggested by millert@ and jmc@, ok jmc@
* two MALLOC_STATS only tweaks; one from David CARLIER, the other found by clangotto2017-08-201-8/+4
|
* Use sendsyslog() directly instead of syslog_r() for the "backwards memcpy"guenther2017-08-141-3/+12
| | | | | | | messages, to avoid pulling in piles of other machinery unnecessarily problem observed by schwarze@ ok deraadt@ millert@
* Minimize #includes, particularly to avoid thread_private.hguenther2017-08-122-7/+3
| | | | ok tedu@
* add missing and correct misspelled names, most in NAME sections;schwarze2017-08-012-6/+8
| | | | | found with regress/usr.bin/mandoc/db/dbm_dump; OK jmc@
* zap trailing whitespace;jmc2017-07-221-2/+2
|
* rework the page a bit, clarify a few things, maybe better wordingtedu2017-07-221-8/+13
|
* one more instance of the previous commit; also initialize ->offset to aotto2017-07-101-2/+3
| | | | definite value in the size == 0 case
* update the little endian processor list to give it a chance of matchingtedu2017-07-082-6/+6
| | | | what the reader is using.
* Only access offset if canaries are enabled *and* size > 0, otherwise offsetotto2017-07-071-2/+2
| | | | is not initialized. Problem spotted by Carlin Bingham; ok phessler@ tedu@
* The 0x (or 0X) prefix in base 16 is optional so only skip over themillert2017-07-066-18/+18
| | | | | | prefix if the character following it is a valid hex char. The C99 standard is clear that given the string "0xy" zero should be returned and endptr set to point to the "x". OK deraadt@ espie@
* void functions don't return 0tb2017-07-051-6/+2
| | | | From Klemens Nanni
* port the RBT code to userland by making it part of libc.dlg2017-06-191-10/+11
| | | | | | | | | | | | | | src/lib/libc/gen/tree.c is a copy of src/sys/kern/subr_tree.c, but with annotations for symbol visibility. changes to one should be reflected in the other. the malloc debug code that uses RB code is ported to RBT. because libc provides the RBT code, procmap doesn't have to reach into the kernel and build subr_tree.c itself now. mild enthusiasm from many ok guenther@
* Don't fall back to heapsort() if we would otherwise switch tomillert2017-05-301-7/+7
| | | | insertion sort (when the number of elements is < 7).
* Support swapping 32-bit aligned elements on 64-bit platforms.millert2017-05-241-22/+63
| | | | | Previously they would be swapped a byte at a time when sizeof(int) != sizeof(long). Idea from FreeBSD.
* Document that qsort falls back to heapsort() if the recursion depthmillert2017-05-201-3/+13
| | | | exceeds 2 lg N and add a reference to the introsort paper.
* Use David Musser's introsort algorithm to fall back to heapsort(3)millert2017-05-202-14/+45
| | | | | | when the recursion depth reaches 2*lg(n + 1). This avoids quicksort's quadratic behavior for pathological input without appreciably changing the average run time.
* The BSD qsort() performs tail recursion elimination on the secondmillert2017-05-171-10/+25
| | | | | | | | side of the array being partitioned to save on stack space. Greater savings can be gained by choosing recursion for the smaller side of the partition and eliminating recursion for the larger side. This also results in a small but measurable performance gain. OK otto@ schwarze@
* Typo: freezeo -> freezerotb2017-05-151-3/+3
| | | | From "fenderq" on freenode via tj@
* - fix bug wrt posix_memalign(3) of blocks between half a page and a pageotto2017-05-132-8/+18
| | | | | - document posix_memalign() does not play nice with reacallocarray(3) and freezero(3)
* make the description strings match the codederaadt2017-05-031-10/+10
|
* Remove "len < 0" check; len is socklen_t (uint32_t) so can't bemillert2017-04-271-2/+2
| | | | negative. Quiets a warning from clang. OK bluhm@
* Rearrange text a bit to make it clear what "discarded" means; ok jmc@ deraadt@otto2017-04-231-8/+13
|
* For small allocations (chunk) freezero only validates the givenotto2017-04-221-5/+10
| | | | | | | | size if canaries are enabled. In that case we have the exact requested size of the allocation. But we can at least check the given size against the chunk size if C is not enabled. Plus add some braces so my brain doesn't have to scan for dangling else problems when I see this code.
* Fix previous.visa2017-04-201-2/+2
|
* Get TCB address using the RDHWR instruction instead of __get_tcb().visa2017-04-201-4/+5
| | | | | | | | | | | This gives fast access to the address on systems that implement the UserLocal register. TCB caching is still used when running in the single-threaded mode in order not to penalize old systems. The kernel counterpart of this change must be in place before using this diff! With guenther@
* don't forget to fill in canary bytes for posix_memalign(3); reported byotto2017-04-181-1/+4
| | | | and ok jeremy@
* consictently use .Dv NULL and a few other tweaks; ok schwarze@otto2017-04-171-20/+17
|
* whitespace fixesotto2017-04-171-14/+14
|
* allow clearing less than allocated and document freezero(3) betterotto2017-04-132-13/+26
|
* New strstr() implementation from musl libc by Rich Felker. Thismillert2017-04-121-44/+180
| | | | | | | | version uses the two-way string matching algorithm and is faster than the old implementation. With this change, ports that check for strstr having linear complexity time strstr will no longer replace the libc strstr with a private version. OK deraadt@ espie@