summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib
Commit message (Collapse)AuthorAgeFilesLines
* Implement __cxa_atexit/__cxa_finalize as specified by the cross-vendorkan2003-12-192-13/+2
| | | | | | | | | | | | | รณ++ ABI document at http://www.codesourcery.com/cxx-abi/abi.html#dso-dtor The ABI was initially defined for ia64, but GCC3 and Intel compilers have adopted it on other platforms. This is the patch from PR bin/59552 with a number of changes by me. PR: bin/59552 Submitted by: Bradley T Hughes (bhughes at trolltech dot com)
* Implement __cxa_atexit/__cxa_finalize as specified by the cross-vendorkan2003-12-191-7/+101
| | | | | | | | | | | | | C++ ABI document at http://www.codesourcery.com/cxx-abi/abi.html#dso-dtor The ABI was initially defined for ia64, but GCC3 and Intel compilers have adopted it on other platforms. This is the patch from PR bin/59552 with a number of changes by me. PR: bin/59552 Submitted by: Bradley T Hughes (bhughes at trolltech dot com)
* Do not adjust to the pagesize at runtime. Besides for the one-timemarcel2003-11-281-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | initialization overhead, there's a problem in that we never call imalloc() and thus malloc_init() for zero-sized allocations. As a result, malloc(0) returns NULL when it's the first or only malloc in the program. Any non-zero allocation will initialize the malloc code with the side-effect that subsequent zero-sized allocations return a non-NULL pointer. This is because the pointer we return for zero- sized allocations is calculated from malloc_pageshift, which needs to be initialized at runtime on ia64. The result of the inconsistent behaviour described above is that configure scripts failed the test for a GNU compatible malloc. This resulted in a lot of broken ports. Other, even simpler, solutions were possible as well: 1. initialize malloc_pageshift with some non-zero value (say 13 for 8KB pages) and keep the runtime adjustment. 2. Stop using malloc_pageshift to calculate ZEROSIZEPTR. Removal of the runtime adjustment was chosen because then ia64 is the same as any other platform. It is not to say that using a page size obtained at runtime is bad per se. It's that there's currently a high level of gratuity for its existence and the moment it causes problems is the moment you need to get rid of it. Hence, it's not unthinkable that this commit is (partially) reverted some time in the future when we do have a good reason for it and a good way to achieve it. Approved by: re@ (rwatson) Reported by: kris (portmgr@) -- may the ports be with you
* Improve the performance of radixsort() whenkientzle2003-11-111-0/+11
| | | | | | | | | | | | | sorting strings with common prefixes by noting when all the strings land in just one bin. Testing shows significant speedups (on the order of 30%) on strings with common prefixes and no slowdowns on any of my test cases. Submitted by: Markus Bjartveit Kruger <markusk@pvv.ntnu.no> PR: 58860 Approved by: gordon (mentor)
* Externalize malloc's spinlock so that a thread library can takedeischen2003-11-041-0/+1
| | | | | | | | | | | it around an application's fork() call. Our new thread libraries (libthr, libpthread) can now have threads running while another thread calls fork(). In this case, it is possible for malloc to be left in an inconsistent state in the child. Our thread libraries, libpthread in particular, need to use malloc internally after a fork (in the child). Reviewed by: davidxu
* Remove incomplete support for running FreeBSD userland on old NetBSD kernelstjr2003-10-291-3/+1
| | | | lacking the issetugid() and utrace() syscalls.
* Don peril sensitive (ie: bikeshed sensitive) sunglasses and quietlypeter2003-10-282-408/+1
| | | | | | | | | | | send strhash(3) off to sleep with the fishes. Nothing in our tree uses it. It has no documentation. It is nonstandard and in spite of the filename strhash.c and strhash.h, it lives in application namespace by providing compulsory global symbols hash_create()/hash_destroy()/hash_search()/ hash_traverse()/hash_purge()/hash_stats() regardless of whether you #include <strhash.h> or not. If it turns out that there is a huge application for this after all, I can repocopy it somewhere safer and we can revive it elsewhere. But please, not in libc!
* Consistently cast to (u_char *) when filling with junk.phk2003-10-251-3/+3
|
* Style changes. Inching closer to convergence with OpenBSD.phk2003-10-251-61/+60
|
* Cite the published version of "Engineering a Sort Function" instead oftjr2003-09-301-4/+7
| | | | an email address. Spell McIlroy correctly.
* More style fixes to improve diffability with OpenBSD.phk2003-09-271-46/+54
| | | | Pull 'A' evilness for realloc(3) from OpenBSD.
* Style changes to improve diffability against OpenBSD version.phk2003-09-271-91/+91
|
* Get rid of duplicates.ru2003-09-142-2/+2
|
* mdoc(7): Properly mark C headers.ru2003-09-101-1/+1
|
* mdoc(7): Use the new feature of the .In macro.ru2003-09-082-2/+2
|
* Replace some syscalls with libc version, this makes abort work better withdavidxu2003-08-161-10/+7
| | | | | | libkse. Tested under libc_r, libkse, libthr. Reviewed by: deischen
* For type 0 rng lower initial drop to 50, it is enough to hide linearityache2003-08-101-1/+5
| | | | Reorganize historic #ifdef section
* Cross-reference arc4random(3).das2003-07-311-0/+4
|
* Minor constification.phk2003-07-291-2/+2
|
* mdoc(7) fix: Use the normal AT&T macro (.At) rather than itsru2003-06-281-1/+1
| | | | internal string in the macro context.
* mdoc policeobrien2003-06-251-6/+6
|
* Be more specific in BUGS.obrien2003-06-251-5/+7
| | | | | | Submitted by: ru Add history.
* Assorted mdoc(7) fixes.ru2003-06-011-27/+28
|
* Clarify the code a bit.phk2003-06-011-1/+2
| | | | Submitted by: Nadav Eiron <nadav@TheEirons.org>
* Fix grammar bogons.schweikh2003-05-311-1/+1
| | | | MFC after: 3 days
* Fix stripping last path component when only one path component left.fjoe2003-05-281-2/+2
| | | | | PR: 52686 MFC after: 1 day
* Assorted mdoc(7) fixes.ru2003-05-221-5/+6
| | | | Approved by: re (blanket)
* Back out the `hiding' of strlcpy and strlcat. Several peoplenectar2003-05-011-6/+6
| | | | vocally objected to this safety belt.
* Tell malloc.c that AMD64 uses the same pagesize as i386.peter2003-04-301-0/+4
|
* `Hide' strlcpy and strlcat (using the namespace.h / __weak_referencenectar2003-04-291-6/+6
| | | | | | | technique) so that we don't wind up calling into an application's version if the application defines them. Inspired by: qpopper's interfering and buggy version of strlcpy
* MFp4: Link strtof.3 and strtold.3 to strtod.3.tjr2003-04-051-0/+1
|
* BDE'ifyfjoe2003-03-291-79/+89
|
* fix truncation check and buffer overflow checkfjoe2003-03-291-11/+11
|
* - MAXPATHLEN -> PATH_MAX (pass correct buffer size to readlink as well)fjoe2003-03-281-17/+17
| | | | Requested by: bde
* Make realpath() thread-safe. New implementation does not use chdir(2) at all.fjoe2003-03-272-111/+128
| | | | Submitted by: Constantin S. Svintsoff <kostik (at) iclub.nsu.ru>
* According to C99 decimal_point can't be emptyache2003-03-201-4/+1
|
* The gdtoa import apparently hasn't caused anything or anyone todas2003-03-151-2429/+0
| | | | | explode, so nix the old strtod() / dtoa(). This change is part of the gdtoa patches reviewed on standards@.
* Document strtof() and strtold(). Update vendor license.das2003-03-121-32/+75
| | | | Reviewed by: bde (briefly), mike (mentor), obrien
* Replace our ancient dtoa/strtod implementation with the gdtoadas2003-03-121-1/+1
| | | | | | | | | | | | | | | | | | package, a more recent, generalized set of routines. Among the changes: - Declare strtof() and strtold() in stdlib.h. - Add glue to libc to support these routines for all kinds of ``long double''. - Update printf() to reflect the fact that dtoa works slightly differently now. As soon as I see that nothing has blown up, I will kill src/lib/libc/stdlib/strtod.c. Soon printf() will be able to use the new routines to output long doubles without loss of precision, but numerous bugs in the existing code must be addressed first. Reviewed by: bde (briefly), mike (mentor), obrien
* Document the fact that hdestory calls free on the keys added withdwmalone2003-03-121-5/+25
| | | | | | | hsearch(.., ENTER). Make the example reflect this. PR: 49951 Submitted by: Peter Jeremy <peterjeremy@optushome.com.au>
* Fix typo.robert2003-02-251-1/+1
|
* Use strlcpy instead of strncpy.johan2003-02-221-2/+1
| | | | | Submitted by: imp Reviewed by: silence on -audit
* Back out "drop first N values" method of removing monotonically increasedache2003-02-171-7/+1
| | | | | | | | | | | | | | | seed->first value correlation. It breaks rand_r()... Other possible methods like shuffling inside aray will breaks rand_r() too, because it assumes only one word state, i.e. nothing extra can be added after seed assignment in srand(). BTW, for old formulae seed->first value correlation is not so monotonically increased as with other Linear Congruential Generators of this type only becase arithmetic overflow happens. But overflow affects distribution and lower bits very badly, as many articles says, such type of overflow not improves PRNG. So, monotonically increased seed->first value correlation problem remains...
* Since we drop NSHUFF values now, set default seed to what it becomesache2003-02-051-3/+3
| | | | after srand(1)
* For rand(3) and random(3) TYPE_0 drop NSHUFF values right after srand{om}()ache2003-02-042-6/+15
| | | | | | | to remove part of seed -> 1st value correlation. Correlation still remains because of algorithm limits. Note that old algorithm have even stronger correlation, especially in the lower bits area, but not eye-visible, as current one.
* Park & Miller PRNG can be safely initialized with any value but 0 and stuckache2003-02-032-2/+8
| | | | | | | at 0 as designed. Its BSD adaptation tries to fight it by mapping 0 to 2147483647 after calculation, but this method not works since 2147483647 seed returns to 0 again on the next interation. Instead of after calculation mapping, map 0 to another value _before_ calculation, so it never stucks.
* For some combinations of variable sizes and RAND_MAX value rand_r()ache2003-02-021-2/+4
| | | | may store less amount bits for seed, than available. Fix it.
* Catch some cases where asking for ridiculously large allocations couldphk2003-01-301-0/+4
| | | | result in a segfault. Instead just return NULL.
* Add an MLINK malloc.conf(5) -> malloc(3).mike2003-01-241-1/+2
|
* For "sensitive" processes, we always set the 'A' flag which causes abort()phk2003-01-231-0/+7
| | | | | | | | | | | | | to be called on first sight of trouble. "sensitive" is somewhat arbitrarily defined as "setuid, setgid, uid == root or gid == wheel". The 'A' option carries no performance penalty. It is not possible to override this setting: fix the program instead. Absentmindedly nodded OK to by: various
OpenPOWER on IntegriCloud