summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
Commit message (Collapse)AuthorAgeFilesLines
* Remove extra debuggin gsupport that is turned on for head but turned offKen Smith2011-10-151-1/+1
| | | | | | | | | | | | | | | | | for stable branches: - shift to MALLOC_PRODUCTION - turn off automatic crash dumps - remove kernel debuggers, INVARIANT*[1], WITNESS* from GENERIC kernel config files [1] INVARIANT* left on for ia64 at least temporarily, marcel@ will test to see if they are still required as they had been for stable/8. Approved by: re (implicit) Notes: svn path=/stable/9/; revision=226405
* Fix building of 32-bit compat libraries on amd64 with clang, and usingDimitry Andric2011-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) Notes: svn path=/head/; revision=224201
* Fix whitespace inconsistencies in libc in files copyrighted by me.Ed Schouten2011-06-261-1/+1
| | | | Notes: svn path=/head/; revision=223576
* Change sparc64 to use the initial exec TLS model, too. This avoids randomMarius Strobl2011-06-211-1/+1
| | | | | | | assertion failures in _malloc_thread_cleanup(). Notes: svn path=/head/; revision=223369
* Don't add sigwait.c to MISRCS here when sigwait.c lives under ../sys andMarcel Moolenaar2011-03-171-1/+1
| | | | | | | it's already added to SRCS there. Notes: svn path=/head/; revision=219709
* Now that TLS generally is available on sparc64 since r219534 turn onMarius Strobl2011-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. Notes: svn path=/head/; revision=219535
* Correct a typo in the malloc(3) manpage. Malloc options are set in theRyan Stone2011-03-071-2/+2
| | | | | | | | | | MALLOC_OPTIONS environment variable, not JEMALLOC_OPTIONS. Reviewed by: jasone Approved by: emaste (mentor) Notes: svn path=/head/; revision=219377
* Put in a temporary workaround for ctfmerge hanging on processingDimitry Andric2011-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. Notes: svn path=/head/; revision=219139
* Fix some style(9) issues.Konstantin Belousov2011-01-081-4/+5
| | | | | | | | | | Do not use strlcpy() where simple assignment is enough. Noted by: bde (long time ago) MFC after: 1 week Notes: svn path=/head/; revision=217144
* Revert to r214147, errno is not clobbered as originallyBenedict Reuschling2010-10-221-2/+0
| | | | | | | thought. Notes: svn path=/head/; revision=214200
* Document strtonum()s behavior of setting errno to 0 when no error is found.Benedict Reuschling2010-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 Notes: svn path=/head/; revision=214148
* Sync with OpenBSD rev. 1.13:Benedict Reuschling2010-10-211-2/+1
| | | | | | | | | | | strtonum does not require limits.h Obtained from: OpenBSD Discussed with: ru@ MFC after: 5 days Notes: svn path=/head/; revision=214147
* mdoc: drop redundant .Pp and .LP callsUlrich Spörlein2010-10-082-2/+0
| | | | | | | They have no effect when coming in pairs, or before .Bl/.Bd Notes: svn path=/head/; revision=213573
* Missed space.Konstantin Belousov2010-10-061-1/+1
| | | | | | | | Submitted by: brueffer MFC after: 1 week Notes: svn path=/head/; revision=213477
* Add cross-references to lrand48(3) and arc4random(3) from rand(3)Konstantin Belousov2010-10-062-1/+11
| | | | | | | | | | and random(3). Submitted by: Valentin Nechayev <netch netch kiev ua> MFC after: 1 week Notes: svn path=/head/; revision=213476
* Revert changes of 'assure' to 'ensure' made in r211936.Rebecca Cran2010-09-111-2/+2
| | | | | | | Approved by: rrs (mentor) Notes: svn path=/head/; revision=212463
* Because POSIX does not allow EINTR to be returned from sigwait(),David Xu2010-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 Notes: svn path=/head/; revision=212405
* Fix incorrect usage of 'assure' and 'insure'.Rebecca Cran2010-08-281-2/+2
| | | | | | | Approved by: rrs (mentor) Notes: svn path=/head/; revision=211936
* Do not call __pthread_cxa_finalize with invalid struct dl_phdr_info.Konstantin Belousov2010-08-271-1/+1
| | | | | | | | Reported and tested by: Fabian Keil <freebsd-listen fabiankeil de> MFC after: 17 days Notes: svn path=/head/; revision=211894
* Powerpc is special here. powerpc and powerpc64 use different ABIs, soWarner Losh2010-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@) Notes: svn path=/head/; revision=211774
* MFtbemd:Warner Losh2010-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. Notes: svn path=/head/; revision=211725
* On shared object unload, in __cxa_finalize, call and clear all installedKonstantin Belousov2010-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 Notes: svn path=/head/; revision=211706
* Style.Konstantin Belousov2010-08-231-2/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=211704
* Use aux vector to get values for SSP canary, pagesize, pagesizes array,Konstantin Belousov2010-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 Notes: svn path=/head/; revision=211416
* Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki whileJoel Dahl2010-08-161-2/+2
| | | | | | | | | translating these manual pages. Minor corrections by me. Submitted by: Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp> Notes: svn path=/head/; revision=211397
* Fix typos and spelling mistakes.Joel Dahl2010-08-061-1/+1
| | | | Notes: svn path=/head/; revision=210933
* Comment out IEEE Std 1003.1-2001 conformance proclaimed too early,Andrey A. Chernov2010-08-051-5/+5
| | | | | | | | see problems described in the comment to: http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/128933 Notes: svn path=/head/; revision=210853
* mdoc: remove unbalanced quotesUlrich Spörlein2010-08-021-2/+2
| | | | Notes: svn path=/head/; revision=210765
* Provide 64-bit PowerPC support in libc.Nathan Whitehorn2010-07-101-1/+6
| | | | | | | Obtained from: projects/ppc64 Notes: svn path=/head/; revision=209878
* In threaded processes, destroy the mutex atexit_mutex when we'veColin Percival2010-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. Notes: svn path=/head/; revision=209117
* mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to theUlrich Spörlein2010-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 Notes: svn path=/head/; revision=208027
* The previous revision actually removed the bug being hinted at, soChristian Brueffer2010-05-121-3/+2
| | | | | | | | | | | go ahead and remove the hint. PR: 143944 Submitted by: Jeremy Huddleston <jeremyhu@apple.com> MFC after: 1 week Notes: svn path=/head/; revision=207946
* C language does not has references, it provides pointers.Konstantin Belousov2010-04-211-2/+2
| | | | | | | | Suggested by: bde MFC after: 2 weeks Notes: svn path=/head/; revision=207009
* Add standards section, improve wording, taking into account the handlingKonstantin Belousov2010-04-211-6/+8
| | | | | | | | | | of NULL and changed type in declaration. Suggested by: bde MFC after: 2 weeks Notes: svn path=/head/; revision=206998
* Free() is not allowed to modify errno, remove safety brackets around it [1].Konstantin Belousov2010-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 Notes: svn path=/head/; revision=206898
* Slightly modernize realpath(3).Konstantin Belousov2010-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 Notes: svn path=/head/; revision=206893
* mdoc: order prologue macros consistently by Dd/Dt/OsUlrich Spörlein2010-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) Notes: svn path=/head/; revision=206622
* In reallocf(3), free the memory only when size != 0. Otherwise, when theJaakko Heinonen2010-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 Notes: svn path=/head/; revision=204636
* Rewrite red-black trees to do lazy balance fixup. This improvesJason Evans2010-02-282-772/+837
| | | | | | | insert/remove speed by ~30%. Notes: svn path=/head/; revision=204493
* Define TLS_MODEL for PowerPC as well. Since PowerPC uses variant I,Marcel Moolenaar2010-02-161-0/+1
| | | | | | | like ia64, leave it empty (default model). Notes: svn path=/head/; revision=203969
* Unbreak ia64: tls_model("initial-exec") is invalid, because it assumesMarcel Moolenaar2010-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. Notes: svn path=/head/; revision=203950
* Fix PRMartin Cracauer2010-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 Notes: svn path=/head/; revision=203734
* Fix bugs:Jason Evans2010-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. Notes: svn path=/head/; revision=203329
* Add missing return, in a rare case where we can't allocate memory inEd Maste2010-01-271-0/+1
| | | | | | | | | | deallocate. Submitted by: Ryan Stone (rysto32 at gmail dot com) Approved by: jasone Notes: svn path=/head/; revision=203077
* Simplify arena_run_reg_dalloc(), and remove a bug that was due to incorrectJason Evans2009-12-101-89/+28
| | | | | | | initialization of ssize_invs. Notes: svn path=/head/; revision=200345
* Fix the posix_memalign() changes in r196861 to actually return a NULL pointerJason Evans2009-12-101-0/+1
| | | | | | | | | as intended. PR: standards/138307 Notes: svn path=/head/; revision=200340
* Revert behavior change to setenv(), unsetenv() and putenv() until a moreSean Farley2009-12-071-3/+6
| | | | | | | thorough security review has been completed. Notes: svn path=/head/; revision=200198
* Update the getenv(3) man page to reflect the recent change to the behaviorSean Farley2009-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 Notes: svn path=/head/; revision=200195
* Change the behavior of setenv(), putenv() and unsetenv() to continue parsingSean Farley2009-12-061-6/+3
| | | | | | | | | | | | | | | instead of returning an error if a corrupt (not a "name=value" string) entry in the environ array is detected when (re)-building the internal environment. This should prevent applications or libraries from experiencing issues arising from the expectation that these calls will complete even with corrupt entries. The behavior is now as it was prior to 7.0. Reviewed by: jilles MFC after: 1 week Notes: svn path=/head/; revision=200191
* Improve the comment within getenv() explaining the search order it takes toSean Farley2009-12-061-8/+9
| | | | | | | | | | | | | find a variable. Include a note that it must not cause the internal environment to be generated since malloc() depends upon getenv(). To call malloc() would create a circular dependency. Recommended by: green Approved by: jilles MFC after: 1 week Notes: svn path=/head/; revision=200190