summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib
Commit message (Collapse)AuthorAgeFilesLines
* Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add atheraven2011-12-077-3/+204
| | | | | | | | | | | | | | | | __noreturn macro and modify the other exiting functions to use it. The __noreturn macro, unlike __dead2, must be used BEFORE the function. This is in line with the C and C++ specifications that place _Noreturn (c1x) and [[noreturn]] (C++11) in front of the functions. As with __dead2, this macro falls back to using the GCC attribute. Unfortunately, clang currently sets the same value for the C version macro in C99 and C1x modes, so these functions are hidden by default. At some point before 10.0, I need to go through the headers and clean up the C1x / C++11 visibility. Reviewed by: brooks (mentor)
* Implement xlocale APIs from Darwin, mainly for use by libc++. This adds atheraven2011-11-2012-20/+203
| | | | | | | | | | | | load of _l suffixed versions of various standard library functions that use the global locale, making them take an explicit locale parameter. Also adds support for per-thread locales. This work was funded by the FreeBSD Foundation. Please test any code you have that uses the C standard locale functions! Reviewed by: das (gdtoa changes) Approved by: dim (mentor)
* Fix a warning emitted by Clang.ed2011-11-041-1/+2
| | | | | | The size passed to strlcat() must depend on the input length, not the output length. Because the input and output buffers are equal in size, the resulting binary does not change at all.
* Fix building of 32-bit compat libraries on amd64 with clang, and usingdim2011-07-181-4/+0
| | | | | | | | | | | | | | -g, by reverting r219139. The LLVM PR referenced in that revision was fixed in the mean time, and we imported a clang snapshot soon afterwards, so the temporary workaround of disabling clang's integrated assembler is no longer needed. In this particular case, using e.g. DEBUG_FLAGS=-g causes clang to output certain directives into assembly that our version of GNU as chokes on. Reported by: dougb Approved by: re (kib)
* Fix whitespace inconsistencies in libc in files copyrighted by me.ed2011-06-261-1/+1
|
* Change sparc64 to use the initial exec TLS model, too. This avoids randommarius2011-06-211-1/+1
| | | | assertion failures in _malloc_thread_cleanup().
* Don't add sigwait.c to MISRCS here when sigwait.c lives under ../sys andmarcel2011-03-171-1/+1
| | | | it's already added to SRCS there.
* Now that TLS generally is available on sparc64 since r219534 turn onmarius2011-03-111-1/+1
| | | | | | support for it. Note that while sparc64 also supports the static TLS model and thus tls_model("initial-exec"), using the default model turned out to yield slightly better buildstone performance.
* Correct a typo in the malloc(3) manpage. Malloc options are set in therstone2011-03-071-2/+2
| | | | | | | MALLOC_OPTIONS environment variable, not JEMALLOC_OPTIONS. Reviewed by: jasone Approved by: emaste (mentor)
* Put in a temporary workaround for ctfmerge hanging on processingdim2011-03-011-0/+4
| | | | | | | | | | | | | | | | kernel.debug (or possibly other files), when WITH_CTF is active. This is caused by a bug in clang's integrated assembler, causing malloc to sometimes hang during initialization in statically linked executables that use threading, such as the copy of ctfmerge that is built during the bootstrap stage of buildworld. The bug has been submitted upstream: http://llvm.org/bugs/show_bug.cgi?id=9352 Note that you might have to rebuild and install libc first, to get your kernel build to finish, because the ctfmerge binary built during bootstrap is linked with your base system's copy of libc.a, which might already contain a bad copy of malloc.o.
* Fix some style(9) issues.kib2011-01-081-4/+5
| | | | | | | Do not use strlcpy() where simple assignment is enough. Noted by: bde (long time ago) MFC after: 1 week
* Revert to r214147, errno is not clobbered as originallybcr2010-10-221-2/+0
| | | | thought.
* Document strtonum()s behavior of setting errno to 0 when no error is found.bcr2010-10-211-0/+2
| | | | | | | PR: docs/143330 Submitted by: Efstratios Karatzas (gpf dot kira at gmail dot com) Discussed with: ru@ MFC after: 7 days
* Sync with OpenBSD rev. 1.13:bcr2010-10-211-2/+1
| | | | | | | | strtonum does not require limits.h Obtained from: OpenBSD Discussed with: ru@ MFC after: 5 days
* mdoc: drop redundant .Pp and .LP callsuqs2010-10-082-2/+0
| | | | They have no effect when coming in pairs, or before .Bl/.Bd
* Missed space.kib2010-10-061-1/+1
| | | | | Submitted by: brueffer MFC after: 1 week
* Add cross-references to lrand48(3) and arc4random(3) from rand(3)kib2010-10-062-1/+11
| | | | | | | and random(3). Submitted by: Valentin Nechayev <netch netch kiev ua> MFC after: 1 week
* Revert changes of 'assure' to 'ensure' made in r211936.brucec2010-09-111-2/+2
| | | | Approved by: rrs (mentor)
* Because POSIX does not allow EINTR to be returned from sigwait(),davidxu2010-09-101-1/+1
| | | | | | | | add a wrapper for it in libc and rework the code in libthr, the system call still can return EINTR, we keep this feature. Discussed on: thread Reviewed by: jilles
* Fix incorrect usage of 'assure' and 'insure'.brucec2010-08-281-2/+2
| | | | Approved by: rrs (mentor)
* Do not call __pthread_cxa_finalize with invalid struct dl_phdr_info.kib2010-08-271-1/+1
| | | | | Reported and tested by: Fabian Keil <freebsd-listen fabiankeil de> MFC after: 17 days
* Powerpc is special here. powerpc and powerpc64 use different ABIs, soimp2010-08-241-2/+2
| | | | | | their implementations aren't in the same files. Introduce LIBC_ARCH and use that in preference to MACHINE_CPUARCH. Tested by amd64 and powerpc64 builds (thanks nathanw@)
* MFtbemd:imp2010-08-231-2/+2
| | | | | Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want to test of all the CPUs of a given family conform.
* On shared object unload, in __cxa_finalize, call and clear all installedkib2010-08-231-3/+20
| | | | | | | | | | | | | | | | | | | | | | atexit and __cxa_atexit handlers that are either installed by unloaded dso, or points to the functions provided by the dso. Use _rtld_addr_phdr to locate segment information from the address of private variable belonging to the dso, supplied by crtstuff.c. Provide utility function __elf_phdr_match_addr to do the match of address against dso executable segment. Call back into libthr from __cxa_finalize using weak __pthread_cxa_finalize symbol to remove any atfork handler which function points into unloaded object. The rtld needs private __pthread_cxa_finalize symbol to not require resolution of the weak undefined symbol at initialization time. This cannot work, since rtld is relocated before sym_zero is set up. Idea by: kan Reviewed by: kan (previous version) MFC after: 3 weeks
* Style.kib2010-08-231-2/+2
| | | | MFC after: 3 days
* Use aux vector to get values for SSP canary, pagesize, pagesizes array,kib2010-08-171-7/+16
| | | | | | | | | | | number of host CPUs and osreldate. This eliminates the last sysctl(2) calls from the dynamically linked image startup. No objections from: kan Tested by: marius (sparc64) MFC after: 1 month
* Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki whilejoel2010-08-161-2/+2
| | | | | | translating these manual pages. Minor corrections by me. Submitted by: Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
* Fix typos and spelling mistakes.joel2010-08-061-1/+1
|
* Comment out IEEE Std 1003.1-2001 conformance proclaimed too early,ache2010-08-051-5/+5
| | | | | see problems described in the comment to: http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/128933
* mdoc: remove unbalanced quotesuqs2010-08-021-2/+2
|
* Provide 64-bit PowerPC support in libc.nwhitehorn2010-07-101-1/+6
| | | | Obtained from: projects/ppc64
* In threaded processes, destroy the mutex atexit_mutex when we'vecperciva2010-06-131-0/+3
| | | | | | | | | | finished using it. This allows the mutex's allocated memory to be freed. This is one sense a rather silly change, since at this point we're less than a microsecond away from calling _exit; but fixing this memory leak is likely to make life easier for anyone trying to track down other memory leaks.
* mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to theuqs2010-05-131-12/+12
| | | | | | | | | | | bottom of the manpages and order them consistently. GNU groff doesn't care about the ordering, and doesn't even mention CAVEATS and SECURITY CONSIDERATIONS as common sections and where to put them. Found by: mdocml lint run Reviewed by: ru
* The previous revision actually removed the bug being hinted at, sobrueffer2010-05-121-3/+2
| | | | | | | | go ahead and remove the hint. PR: 143944 Submitted by: Jeremy Huddleston <jeremyhu@apple.com> MFC after: 1 week
* C language does not has references, it provides pointers.kib2010-04-211-2/+2
| | | | | Suggested by: bde MFC after: 2 weeks
* Add standards section, improve wording, taking into account the handlingkib2010-04-211-6/+8
| | | | | | | of NULL and changed type in declaration. Suggested by: bde MFC after: 2 weeks
* Free() is not allowed to modify errno, remove safety brackets around it [1].kib2010-04-201-13/+5
| | | | | | | | | Add small optimization, do not copy a string to the buffer that is to be freed immediately after. Noted by: jh [1] Reviewed by: jh MFC after: 2 weeks
* Slightly modernize realpath(3).kib2010-04-202-8/+65
| | | | | | | | | | | SUSv4 requires that implementation returns EINVAL if supplied path is NULL, and ENOENT if path is empty string [1]. Bring prototype in conformance with SUSv4, adding restrict keywords. Allow the resolved path buffer pointer be NULL, in which case realpath(3) allocates storage with malloc(). PR: kern/121897 [1] MFC after: 2 weeks
* mdoc: order prologue macros consistently by Dd/Dt/Osuqs2010-04-142-2/+2
| | | | | | | | Although groff_mdoc(7) gives another impression, this is the ordering most widely used and also required by mdocml/mandoc. Reviewed by: ru Approved by: philip, ed (mentors)
* In reallocf(3), free the memory only when size != 0. Otherwise, when thejh2010-03-031-1/+8
| | | | | | | | System V compatibility option (malloc "V" flag) is in effect a zero sized reallocf() could cause a double free. PR: bin/141753 Submitted by: Dan Lukes
* Rewrite red-black trees to do lazy balance fixup. This improvesjasone2010-02-282-772/+837
| | | | insert/remove speed by ~30%.
* Define TLS_MODEL for PowerPC as well. Since PowerPC uses variant I,marcel2010-02-161-0/+1
| | | | like ia64, leave it empty (default model).
* Unbreak ia64: tls_model("initial-exec") is invalid, because it assumesmarcel2010-02-161-11/+9
| | | | | | the static TLS model, which is fundamentally different from the dynamic TLS model. The consequence was data corruption. Limit the attribute to i386 and amd64.
* Fix PRcracauer2010-02-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/143350 Empty string test gone wrong. Testing this requires that you have a locale that has the sign string unset but has int_n_sign_posn set (the default locale falls through to use "()" around negative numbers which is probably another bug). I created that setup by hand and indeed without this fix negative numbers are put out as positive numbers (doesn't fall through to use "-" as default indicator). Unfixed example in nl_NL.ISO8859-1 with lc->negative_sign set to empty string: strfmon(buf, sizeof(buf), "%-8i", -42.0); ==> example2: 'EUR 42,00' 'Eu 42,00' Fixed: example2: 'EUR 42,00-' 'Eu 42,00-' This file and suggested fix are identical in at least freebsd-8. Backport might be appropriate but some expert on locales should probably have a look at us defaulting to negative numbers in parenthesis when LC_* is default. That doesn't look right and is not what other OSes are doing. PR: 143350 Submitted by: Corinna Vinschen Reviewed by: bug reporter submitted, tested by me
* Fix bugs:jasone2010-01-314-1352/+2256
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix a race in chunk_dealloc_dss(). * Check for allocation failure before zeroing memory in base_calloc(). Merge enhancements from a divergent version of jemalloc: * Convert thread-specific caching from magazines to an algorithm that is more tunable, and implement incremental GC. * Add support for medium size classes, [4KiB..32KiB], 2KiB apart by default. * Add dirty page tracking for pages within active small/medium object runs. This allows malloc to track precisely which pages are in active use, which makes dirty page purging more effective. * Base maximum dirty page count on proportion of active memory. * Use optional zeroing in arena_chunk_alloc() to avoid needless zeroing of chunks. This is useful in the context of DSS allocation, since a long-lived application may commonly recycle chunks. * Increase the default chunk size from 1MiB to 4MiB. Remove feature: * Remove the dynamic rebalancing code, since thread caching reduces its utility.
* Add missing return, in a rare case where we can't allocate memory inemaste2010-01-271-0/+1
| | | | | | | deallocate. Submitted by: Ryan Stone (rysto32 at gmail dot com) Approved by: jasone
* Simplify arena_run_reg_dalloc(), and remove a bug that was due to incorrectjasone2009-12-101-89/+28
| | | | initialization of ssize_invs.
* Fix the posix_memalign() changes in r196861 to actually return a NULL pointerjasone2009-12-101-0/+1
| | | | | | as intended. PR: standards/138307
* Revert behavior change to setenv(), unsetenv() and putenv() until a morescf2009-12-071-3/+6
| | | | thorough security review has been completed.
* Update the getenv(3) man page to reflect the recent change to the behaviorscf2009-12-061-9/+9
| | | | | | | of setenv(), putenv() and unsetenv() when dealing with corrupt entries in environ. They now output a warning and complete their task without error. MFC after: 1 week
OpenPOWER on IntegriCloud