summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
Commit message (Collapse)AuthorAgeFilesLines
...
* Note that the value from getenv() should not be modified by applications.Tom Rhodes2006-10-121-1/+5
| | | | | | | | PR: 60544 Reviewed by: ru Notes: svn path=/head/; revision=163262
* getenv.3: Put "is" on a line with other wordsTom Rhodes2006-10-071-2/+1
| | | | | | | | | | | getobjformat.3: "takes precedence over" is not an envrionment variable. PR: 75545 Submitted by: n-kogane@syd.odn.ne.jp MFC after: 3 days Notes: svn path=/head/; revision=163108
* Revise markup in recently added manpages.Ruslan Ermilov2006-09-303-43/+48
| | | | Notes: svn path=/head/; revision=162841
* Keep compatible parts in sync with OpenBSD v1.21, add some comments.Andrey A. Chernov2006-09-231-15/+7
| | | | | | | No functional changes. Notes: svn path=/head/; revision=162574
* Remove code #ifndef'ed in prev. commit to stay in sync with OpenBSDAndrey A. Chernov2006-09-221-12/+0
| | | | | | | v1.21 which just do that. Notes: svn path=/head/; revision=162557
* Be more GNU compatible:Andrey A. Chernov2006-09-221-2/+5
| | | | | | | | | don't be greedy on the GNU "::" extension when arg separated by whitespace and POSIX_CORRECTLY is set. From POSIX point of view this is unclear situation, so minimal assumption looks right. Notes: svn path=/head/; revision=162555
* Markup fixes.Ruslan Ermilov2006-09-171-51/+51
| | | | Notes: svn path=/head/; revision=162385
* Change the way base allocation is done for internal malloc dataJason Evans2006-09-081-56/+93
| | | | | | | | | | structures, in order to avoid the possibility of attempted recursive lock acquisition for chunks_mtx. Reported by: Slawa Olhovchenkov <slw@zxy.spb.ru> Notes: svn path=/head/; revision=162163
* alloca() cannot check if the allocation is valid; mention the consequences.Ruslan Ermilov2006-09-051-4/+13
| | | | | | | Obtained from: OpenBSD Notes: svn path=/head/; revision=162040
* Enable TLS on PowerPC.Marcel Moolenaar2006-09-011-1/+0
| | | | Notes: svn path=/head/; revision=161831
* Enable TLS on ia64.Marcel Moolenaar2006-09-011-1/+0
| | | | Notes: svn path=/head/; revision=161803
* Correctly handle the case in calloc(num, size) whereColin Percival2006-08-131-1/+1
| | | | | | | | | | | | | | (size_t)(num * size) == 0 but both num and size are nonzero. Reported by: Ilja van Sprundel Approved by: jasone Security: Integer overflow; calloc was allocating 1 byte in response to a request for a multiple of 2^32 (or 2^64) bytes instead of returning NULL. Notes: svn path=/head/; revision=161263
* Define NO_TLS on PowerPC.Marcel Moolenaar2006-08-091-0/+1
| | | | | | | See also: PR ia64/91846 Notes: svn path=/head/; revision=161131
* Conditionally expand the size_invs lookup table in arena_run_reg_dalloc()Jason Evans2006-07-271-1/+12
| | | | | | | | | | | so that architectures with a quantum of 8 (rather than 16) work. Restore arm's quantum to 8. Submitted by: jmg Notes: svn path=/head/; revision=160761
* Use 4 as QUANTUM_2POW_MIN on arm as it is on any other architecture, to avoidOlivier Houchard2006-07-271-1/+1
| | | | | | | triggering an assertion later. Notes: svn path=/head/; revision=160751
* Fix cpp logic in arena_malloc() to adjust size when assertions are enabled,Jason Evans2006-07-271-23/+19
| | | | | | | | | | | even if stats gathering is disabled. [1] Remove 'size' parameter from several functions that do not use it. Reported by: [1] ache Notes: svn path=/head/; revision=160736
* Use some math tricks in arena_run_reg_dalloc() to avoid actual division, asJason Evans2006-07-011-83/+90
| | | | | | | | | | | | | | | | | | | | well as avoiding a switch statement. This change has no significant impact to performance when branch prediction is successful at predicting the sizes of objects passed to free(), but in the case that the object sizes are semi-random, this change has the potential to prevent many branch prediction misses, thus improving performance substantially. Take advantage of alignment guarantees in ipalloc(), and pad object sizes to something less than a power of two when possible. This has the potential to substantially reduce internal fragmentation for objects allocated via posix_memalign(). Avoid an unnecessary pow2_ceil() call in arena_ralloc(). Submitted by: djam8193ah@hotmail.com Notes: svn path=/head/; revision=160066
* Make the behavior of malloc(0) standards-compliant by getting rid of nil,Jason Evans2006-06-301-48/+46
| | | | | | | | | | | | and instead creating a small allocation for each malloc(0) call. The optional SysV compatibility behavior remains unchanged. Add a couple of assertions. Fix a couple of typos in error message strings. Notes: svn path=/head/; revision=160055
* twalk() expects an `action' function not a comparison function.Giorgos Keramidas2006-06-231-1/+1
| | | | | | | | | | | | The text is correct in the "DESCRIPTION" section, so fix "SYNOPSIS" to use the correct name. PR: docs/90498 Submitted by: Vasil Dimov MFC after: 3 days Notes: svn path=/head/; revision=159879
* Add a missing case for the switch statement in arena_run_reg_dalloc(). [1]Jason Evans2006-06-201-8/+20
| | | | | | | | | | Fix a leak in chunk_dealloc(). [2] Reported by: [1] djam8193ah@hotmail.com, [2] Ville-Pertti Keinonen <will@exomi.com> Notes: svn path=/head/; revision=159798
* o .Xr strtonum(3).Maxim Konovalov2006-05-202-0/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=158774
* Correct decoding a string containing '/'.Jung-uk Kim2006-05-191-1/+1
| | | | | | | | PR: 97485 Submitted by: Mikko Tyolajarvi < mbsd at pacbell dot net > Notes: svn path=/head/; revision=158749
* Increase the minimum chunk size by a power of two (32kB --> 64kB, assumingJason Evans2006-05-101-2/+2
| | | | | | | | | | | 4kB pages), in order to avoid dangerous rounding error when calculating fullness limits during run promotion/demotion. Convert a structure bitfield to a normal field in areana_run_t. This should have been changed along with the other fields in revision 1.120. Notes: svn path=/head/; revision=158383
* Change the semantics of brk_max to dynamically deal with data segmentJason Evans2006-04-271-71/+83
| | | | | | | | | | | | | | | | | | bounds. [1] Modify logic for utilizing the data segment, such that it is possible to create huge allocations there. Shrink the data segment when deallocating a chunk, if it is at the end of the data segment. Rename chunk_size to csize in huge_malloc(), in order to avoid masking a static variable of the same name. [1] Reported by: Paul Allen <nospam@ugcs.caltech.edu> Notes: svn path=/head/; revision=158062
* s/soley/solelyJens Schweikhardt2006-04-131-1/+1
| | | | Notes: svn path=/head/; revision=157735
* Add an unreachable return statement, in order to avoid a compiler warningJason Evans2006-04-051-0/+1
| | | | | | | | | for non-standard optimization levels. Reported by: Michael Zach <zach@webges.com> Notes: svn path=/head/; revision=157539
* Only initialize the first per-chunk page map element for free runs. ThisJason Evans2006-04-051-31/+16
| | | | | | | makes run split/coalesce operations of complexity lg(n) rather than n. Notes: svn path=/head/; revision=157532
* Add malloc_usable_size() to the RETURN VALUES section.Jason Evans2006-04-041-1/+6
| | | | Notes: svn path=/head/; revision=157508
* Add init_lock, and use it to protect against allocator initializationJason Evans2006-04-041-8/+21
| | | | | | | | | | | races. This isn't currently necessary for libpthread or libthr, but without it external threads libraries like the linuxthreads port are not safe to use. Reported by: ganbold@micom.mng.net Notes: svn path=/head/; revision=157498
* Refactor per-run bitmap manipulation functions so that bitmap offsets onlyJason Evans2006-04-041-69/+131
| | | | | | | | | | | | | | | | | | | | have to be calculated once per allocator operation. Make nil const. Update various comments. Remove/avoid division where possible. For the one division operation that remains in the critical path, add a switch statement that has a case for each small size class, and do division with a constant divisor in each case. This allows the compiler to generate optimized code that does not use hardware division [1]. Obtained from: peter [1] Notes: svn path=/head/; revision=157463
* Optimize runtime performance, primary using the following techniques:Jason Evans2006-03-301-285/+294
| | | | | | | | | | | | | | | | | | * Avoid choosing an arena until it's certain that an arena is needed for allocation. * Convert division/multiplication to bitshifting where possible. * Avoid accessing TLS variables in single-threaded code. * Reduce the amount of pointer dereferencing. * Move lock acquisition in critical paths to only protect the the code that requires synchronization, and completely remove locking where possible. Notes: svn path=/head/; revision=157310
* Add malloc_usable_size(3).Jason Evans2006-03-284-3/+47
| | | | | | | Discussed with: arch@ Notes: svn path=/head/; revision=157236
* Allow the 'n' option to decrease the number of arenas below the default,Jason Evans2006-03-261-2/+16
| | | | | | | | to as little as one arena. Also, limit the number of arenas to avoid a potential invariant violation in base_alloc(). Notes: svn path=/head/; revision=157162
* Add comments and reformat/rearrange code. There are no significantJason Evans2006-03-261-208/+224
| | | | | | | functional changes in this commit. Notes: svn path=/head/; revision=157161
* Convert TINY_MIN_2POW from a cpp macro to tiny_min_2pow (a variable), andJason Evans2006-03-241-21/+37
| | | | | | | | | | | | | | | | | | determine its value at run time according to other relevant values. This avoids the creation of runs that are incompletely utilized, as long as pagesize isn't too large (>32kB, given the current RUN_MIN_REGS_2POW setting). Increase the size of several structure bitfields in arena_run_t in order to avoid integer overflow in the case that a run's header does not overlap with the space that is usable as application allocation regions. Given the tiny_min_2pow change, this fix has no additional impact unless pagesize is >32kB. Reported by: kris Notes: svn path=/head/; revision=157106
* Add USE_BRK-specific code in malloc_init_hard() to allow the firstJason Evans2006-03-241-65/+110
| | | | | | | | | | | | | | | | | | | | | | internally used chunk to start at the beginning of the heap, rather than at a chunk-aligned address. This reduces mapped memory somewhat for 32-bit architectures. Add the arena_run_link_t type and use it wherever a run object is only used as a ring 'header'. This saves approximately 40 kB of memory per arena. Remove an obsolete (no longer used) code path from base_alloc(), which supported the internal allocation of objects larger than the chunk size. Enhance chunk_dealloc() to cache chunk addresses for all deallocated chunks. This has no impact for most programs, but has the potential to reduce VM map fragmentation for programs that use huge allocations. Notes: svn path=/head/; revision=157070
* Separate completely full runs from runs that are merely almost full, soJason Evans2006-03-201-61/+71
| | | | | | | | | | that no linear searching is necessary if we resort to allocating from a run that is known to be mostly full. There are pathological edge cases that could have caused severely degraded performance, and this change fixes that. Notes: svn path=/head/; revision=156902
* Optimize realloc() to reallocate in place if the old and new sizes areJason Evans2006-03-191-105/+167
| | | | | | | | | | | | | | close enough to each other that reallocation would allocate a new region of the same size. This improves the performance of repeated incremental reallocations by up to three orders of magnitude. [1] Fix arena_new() to properly constrain run size if a small chunk size was specified during runtime configuration. Suggested by: se [1] Notes: svn path=/head/; revision=156890
* Modify allocation policy, in order to avoid excessive fragmentation forJason Evans2006-03-172-2503/+1070
| | | | | | | | | | | | | | | | | | allocation patterns that involve a relatively even mixture of many different size classes. Reduce the chunk size from 16 MB to 2 MB. Since chunks are now carved up using an address-ordered first best fit policy, VM map fragmentation is much less likely, which makes smaller chunks not as much of a risk. This reduces the virtual memory size of most applications. Remove redzones, since program buffer overruns are no longer as likely to corrupt malloc data structures. Remove the C MALLOC_OPTIONS flag, and add H and S. Notes: svn path=/head/; revision=156800
* Add a non-optional newline after ".Bx".Ruslan Ermilov2006-03-151-1/+2
| | | | Notes: svn path=/head/; revision=156741
* Revert previous changes as we do support the .Ox macro for OpenBSD.Andre Oppermann2006-03-151-2/+4
| | | | | | | Pointed out by: ceri, ru, delphij Notes: svn path=/head/; revision=156739
* POSIXed strtoll() (and ours one too) can set errno to EINVAL, so checkAndrey A. Chernov2006-03-141-1/+1
| | | | | | | | | it first. Approved by: andre Notes: svn path=/head/; revision=156716
* Fix HISTORY and point to OpenBSD.Andre Oppermann2006-03-141-5/+2
| | | | Notes: svn path=/head/; revision=156708
* Import of OpenBSD's strtonum(3) which is a nicer version of strtoll(3)Andre Oppermann2006-03-144-3/+227
| | | | | | | | | | | providing proper error checking and other improvements. Obtained from: OpenBSD Requested by: flz (to port Open[BGP|OSPF]D) MFC after: 3 days Notes: svn path=/head/; revision=156707
* Add each directory's symbol map file to SYM_MAPS.Daniel Eischen2006-03-131-0/+2
| | | | Notes: svn path=/head/; revision=156613
* Add symbol maps and initial symbol version definitions to libc.Daniel Eischen2006-03-131-0/+98
| | | | | | | Reviewed by: davidxu Notes: svn path=/head/; revision=156608
* Fix typo in manual page reference.Wojciech A. Koszek2006-02-261-1/+1
| | | | | | | | Approved by: cognet (mentor) MFC after: 3 days Notes: svn path=/head/; revision=156043
* Remove extra slash from pty slave device name returned by ptsname.Alexander Kabaev2006-02-131-1/+1
| | | | Notes: svn path=/head/; revision=155593
* Fix calculation of the number of arenas to use on multi-processor systems.Jason Evans2006-02-041-1/+1
| | | | Notes: svn path=/head/; revision=155272
* Expand contractions.Joel Dahl2006-02-011-1/+1
| | | | Notes: svn path=/head/; revision=155181