summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* add posix_madvise, posix_memalign, strndup, and strnlen. mostly fromtedu2010-05-184-8/+128
| | | | | brad and millert, with hints from guenther, jmc, and otto I think. ok previous.
* - nuke some unneeded Pp; from kristapsjmc2010-04-071-6/+3
| | | | - small tweak while here
* WARNINGS -> CAVEATS, and a little neccessary cleanup;jmc2010-04-012-24/+24
|
* It's unsetenv() that doesn't like `=' in the argument, not putenv().kili2010-03-101-3/+3
| | | | ok millert@
* Use size_t in appropriate places; fixes sorting of big arrays;otto2010-02-081-9/+10
| | | | | after the diff was written, I made it similar to the freebsd fix of the same code; pr6287 ok millert@ guenther@
* use size_t to index arrays; avoids big array bugs; ok millert@ guenther@otto2010-02-081-1/+1
|
* Use MACHINE_CPU instead of MACHINE_ARCH to pick the correct machine dependentmiod2010-02-031-9/+9
| | | | | | | files or directories when applicable. The inspiration and name of MACHINE_CPU come from NetBSD, although the way to provide it to Makefiles is completely different. ok kettenis@
* stucture -> structure;jmc2010-01-251-3/+3
|
* New options 'S', as a shorthand for the options most suitable as anotto2010-01-132-3/+9
| | | | extra safeguard (FGJ). Idea from deraadt@; ok deraadt@ dlg@
* save calls to arc4random() by using a nibble at a time; not becauseotto2009-12-161-24/+27
| | | | | arc4random() is slow, but it induces getpid() calls; also saves a bit on stirring efforts
* Make userland malloc use __LDPGSZ granularity on mips, regardless of themiod2009-12-071-1/+3
| | | | actual kernel page size.
* Switch the chunk_info lists to doubly-linked lists and use the queueotto2009-11-271-51/+34
| | | | | | macros for them. Avoids walking the lists and greatly enhances speed of freeing chunks in reverse or random order at the cost of a little space. Suggested by Fabien Romano and Jonathan Armani; ok djm@
* Don't forget to fill region from the cache with junk if needed in one case;otto2009-11-271-1/+3
| | | | from Fabien Romano and Jonathan Armani
* No need to clear a mmapped region; from Fabien Romano and Jonathanotto2009-11-271-2/+1
| | | | Armani
* permit -DMALLOC_STATS to compile againtodd2009-11-021-2/+2
| | | | | noticed by Jonathan Armani & Fabien Romano ugh+ok otto@
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-271-5/+1
| | | | | | | unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
* Check mmap return value against MAP_FAILED not NULL.pirofti2009-10-201-2/+2
| | | | Okay deraadt@, otto@.
* teach gdtoa & its subroutines that malloc can fail; in which casemartynas2009-10-162-2/+6
| | | | | | ecvt, fcvt, gcvt, *printf, strtof, strtod, strtold act per ieee 1003.1. after these massive changes, remove unused files which would not work now. reported by Maksymilian Arciemowicz; ok theo
* rewrite the history section, prompted by Paul Stoeber; ok deraadt@ jmc@otto2009-10-101-25/+28
|
* abs conforms c99 -> imaxabs conforms c99. ok millert@martynas2009-06-211-3/+3
|
* quieten compiler by converting pointers to uintptr_t before truncating themderaadt2009-06-081-5/+5
| | | | | to u_int32_t to do integer math with (in a situation where that is legit) ok otto millert
* Don't assume that we can overwrite strings in the environment.millert2009-06-041-1/+3
| | | | | Someone may have passed a read-only string to putenv() (I'm looking at you cron!).
* Make putenv(), setenv() and unsetenv() standards compliant. Themillert2009-06-035-86/+117
| | | | | | standard explicitly disallows passing setenv a name with a '=' in it but historic BSD behavior is to allow this but to ignore the '=' and anything after it.
* document that no leading whitespace is permitted between the option andokan2009-04-121-3/+5
| | | | | | argument if the argument is deemed to be optional ('::'). feedback and ok jmc@ and millert@
* kill whitespace at eol;jmc2009-02-131-2/+2
|
* decribe 'F' better and mention flags are debugging aids; ok tedu@ jmc@otto2009-02-131-8/+10
|
* correct function definitions; from Markus Bergkvistjmc2009-02-101-4/+4
|
* reintroduce extra malloc protections, but avoiding the use ofdjm2009-01-031-164/+229
| | | | | | PAGE_(SIZE|SHIFT|MASK) defines that evaluate to variables on the sparc architecture; ok otto@ tested on my reanimated ss20
* PAGE_SIZE is not a valid symbol to use in that way. In particular,deraadt2008-12-311-235/+164
| | | | | | | on sparc, it expands to something that just plain does not work, because the page size can be variable. Sorry we didn't spot this before. Backing it all out to allow sparc to build; please find a different way to fix it.
* Remove mprotecting of struct dir_info introduced in previous commitdjm2008-12-302-46/+4
| | | | | | | (MALLOC_OPTIONS=L). It was too slow to turn on by default, and we don't do optional security. requested by deraadt@ grumbling ok otto@
* extra paranoia for malloc(3):djm2008-12-292-165/+278
| | | | | | | | | | | | | | | | Move all runtime options into a structure that is made read-only (via mprotect) after initialisation to protect against attacks that overwrite options to turn off malloc protections (e.g. use-after-free) Allocate the main bookkeeping data (struct dir_info) using mmap(), thereby giving it an unpredictable address. Place a PROT_NONE guard page on either side to further frustrate attacks on it. Add a new 'L' option that maps struct dir_info PROT_NONE except when in the allocator code itself. Makes attacks on it basically impossible. feedback tedu deraadt otto canacar ok otto
* shave off more bytes than you expect by declaring a few const local arraysotto2008-12-151-4/+4
| | | | as static const
* Fix typo, okay jmc@.pedro2008-11-261-3/+3
|
* move allocations between half a page and a page as close to the end ofotto2008-11-202-4/+5
| | | | | the page as possible (i.e. make malloc option P a default). ok art@ millert@ krw@
* Reduce the leeway malloc allows when moving allocations to the end ofotto2008-11-201-2/+2
| | | | | a page to 0. P default will be changed in a separate commit. ok millert@ art@ krw@
* To allow for easier playing with more strict settings introduceotto2008-11-131-5/+14
| | | | | a separate symbolic constant for the leeway we allow when moving allocations towards the end of a page. No functional change.
* avoid a few strlen calls for constant strings; prompted by tg; ok djm@otto2008-11-121-10/+10
|
* if the freeprot flag (F) is set, do not do delayed frees for chunksotto2008-11-061-6/+10
| | | | | | (might catch errors closer to the trouble spot) and junk fill pages just before reuse instead of immediate (we can't access the page anyway) since we set PROT_NONE in the F case. ok djm@
* fix markup of example line and description of G flag; partly from andotto2008-11-021-5/+4
| | | | ok jmc@
* remove distinction between warnings and errors, ok deraadt@ djm@otto2008-11-022-73/+38
|
* if MALLOC_STATS is defined, record how many "cheap reallocs" wereotto2008-10-291-1/+8
| | | | tried and how many actually succeeded.
* oops, assign errno the right way. caught by david running regress testsotto2008-10-201-2/+2
|
* reduce rbyte cache to 512 bytes, no measurable slowdown (even in theotto2008-10-031-2/+2
| | | | threaded case) but much smaller working set; prompted by and ok deraadt@
* save and restore errno on success. while it is not stricly needed forotto2008-10-031-4/+14
| | | | | non-syscalls, there's just too much code not doing the right thing on error paths; prompted by and ok deraadt@
* when increasing the size of a larger than a page allocation tryotto2008-10-031-3/+41
| | | | | mapping the region next to the existing one first; there's a pretty high chance there's a hole there we can use; ok deraadt@ tedu@
* avoid spitting up regions when purging stuff from the cache, it putsotto2008-10-031-17/+10
| | | | too much pressure on the amaps. ok tedu@ deraadt@
* document strtold. ok millert@martynas2008-09-132-11/+25
|
* strtof has been introduced in c99martynas2008-09-131-4/+6
| | | | from Thomas Pfaff. ok millert@
* - replace dtoa w/ David's gdtoa, version 2008-03-15martynas2008-09-073-2500/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - provide proper dtoa locks - use the real strtof implementation - add strtold, __hdtoa, __hldtoa - add %a/%A support - don't lose precision in printf, don't round to double anymore - implement extended-precision versions of libc functions: fpclassify, isnan, isinf, signbit, isnormal, isfinite, now that the ieee.h is fixed - separate vax versions of strtof, and __hdtoa - add complex math support. added functions: cacos, casin, catan, ccos, csin, ctan, cacosh, casinh, catanh, ccosh, csinh, ctanh, cexp, clog, cabs, cpow, csqrt, carg, cimag, conj, cproj, creal, cacosf, casinf, catanf, ccosf, csinf, ctanf, cacoshf, casinhf, catanhf, ccoshf, csinhf, ctanhf, cexpf, clogf, cabsf, cpowf, csqrtf, cargf, cimagf, conjf, cprojf, crealf - add fdim, fmax, fmin - add log2. (adapted implementation e_log.c. could be more acruate & faster, but it's good enough for now) - remove wrappers & cruft in libm, supposed to work-around mistakes in SVID, etc.; use ieee versions. fixes issues in python 2.6 for djm@ - make _digittoint static - proper definitions for i386, and amd64 in ieee.h - sh, powerpc don't really have extended-precision - add missing definitions for mips64 (quad), m{6,8}k (96-bit) float.h for LDBL_* - merge lead to frac for m{6,8}k, for gdtoa to work properly - add FRAC*BITS & EXT_TO_ARRAY32 definitions in ieee.h, for hdtoa&ldtoa to use - add EXT_IMPLICIT_NBIT definition, which indicates implicit normalization bit - add regression tests for libc: fpclassify and printf - arith.h & gd_qnan.h definitions - update ieee.h: hppa doesn't have quad-precision, hppa64 does - add missing prototypes to gdtoaimp - on 64-bit platforms make sure gdtoa doesn't use a long when it really wants an int - etc., what i may have forgotten... - bump libm major, due to removed&changed symbols - no libc bump, since this is riding on djm's libc major crank from a day ago discussed with / requested by / testing theo, sthen@, djm@, jsg@, merdely@, jsing@, tedu@, brad@, jakemsr@, and others. looks good to millert@ parts of the diff ok kettenis@ this commit does not include: - man page changes
* remove now obsolete calloc implementation; prompted by miodotto2008-09-031-50/+0
|