Commit Graph

410 Commits

Author SHA1 Message Date
ache
a523e1e45b Remove unneccessary <unistd.h> 2004-02-23 03:30:02 +00:00
phk
b3acd67aa2 Remove the triplicity in the public functions by vectoring them all
through a realloc like function.

Make the malloc_active variable a local static to this new function.

Don't warn about recursion more than once per base call.

constify malloc_func.
2004-02-21 09:14:38 +00:00
phk
0048baa46a Move the check for sensitive processes to the point where the exception
has been hit, this makes it cover more cases.

Call the message function directly rather than fiddle with flag-saving
when we find an unknown character in our options.

The 'A' flag should not trigger on legal out of memory conditions.
2004-02-21 08:55:38 +00:00
ru
86fc5ce7eb Unbreak the upgrade path from 4.9 after removal of GNU getopt and
<gnuregex.h>.
2004-02-20 11:55:14 +00:00
cperciva
1401a97d0e style cleanup: Remove duplicate $FreeBSD$ tags.
These files had tags after the copyright notice,
inside the comment block (incorrect, removed),
and outside the comment block (correct).

Approved by:	rwatson (mentor)
2004-02-10 20:42:33 +00:00
das
bd170c7fdd Use 'uint32_t' instead of 'long' when a 32-bit integer is intended.
This results in no functional change, aside from fixing a data
corruption bug on LP64 platforms.  The code here could still use a
significant amount of cleanup.

PR:		56502
Submitted by:	hrs (earlier version)
2004-01-20 03:02:18 +00:00
kan
df02c97e7f Implement __cxa_atexit/__cxa_finalize as specified by the cross-vendor
ó++ 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)
2003-12-19 17:11:21 +00:00
kan
a731a9a63c Implement __cxa_atexit/__cxa_finalize as specified by the cross-vendor
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)
2003-12-19 17:11:20 +00:00
marcel
ef414e7345 Do not adjust to the pagesize at runtime. Besides for the one-time
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
2003-11-28 18:03:22 +00:00
kientzle
62c6692124 Improve the performance of radixsort() when
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)
2003-11-11 04:59:23 +00:00
deischen
912c41f152 Externalize malloc's spinlock so that a thread library can take
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
2003-11-04 19:49:56 +00:00
tjr
4c2243c43d Remove incomplete support for running FreeBSD userland on old NetBSD kernels
lacking the issetugid() and utrace() syscalls.
2003-10-29 10:45:01 +00:00
peter
2bde5decd6 Don peril sensitive (ie: bikeshed sensitive) sunglasses and quietly
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!
2003-10-28 22:36:54 +00:00
phk
9d7f274612 Consistently cast to (u_char *) when filling with junk. 2003-10-25 23:47:33 +00:00
phk
ac3ecd2933 Style changes. Inching closer to convergence with OpenBSD. 2003-10-25 12:56:51 +00:00
tjr
03a7afc8c9 Cite the published version of "Engineering a Sort Function" instead of
an email address.  Spell McIlroy correctly.
2003-09-30 07:05:46 +00:00
phk
fe0e97f849 More style fixes to improve diffability with OpenBSD.
Pull 'A' evilness for realloc(3) from OpenBSD.
2003-09-27 18:58:26 +00:00
phk
ebbf74a5d9 Style changes to improve diffability against OpenBSD version. 2003-09-27 17:29:03 +00:00
ru
f501f1b590 Get rid of duplicates. 2003-09-14 13:41:59 +00:00
ru
c581c0c568 mdoc(7): Properly mark C headers. 2003-09-10 19:24:35 +00:00
ru
b8e742a388 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
davidxu
161ca2a047 Replace some syscalls with libc version, this makes abort work better with
libkse. Tested under libc_r, libkse, libthr.

Reviewed by: deischen
2003-08-16 11:43:57 +00:00
ache
e8021e9302 For type 0 rng lower initial drop to 50, it is enough to hide linearity
Reorganize historic #ifdef section
2003-08-10 17:49:55 +00:00
das
a485104831 Cross-reference arc4random(3). 2003-07-31 06:18:34 +00:00
phk
6fb62c0d8e Minor constification. 2003-07-29 11:16:14 +00:00
ru
6371072878 mdoc(7) fix: Use the normal AT&T macro (.At) rather than its
internal string in the macro context.
2003-06-28 22:12:30 +00:00
obrien
6bb58a9f03 mdoc police 2003-06-25 21:31:43 +00:00
obrien
6254b70e40 Be more specific in BUGS.
Submitted by:	ru

Add history.
2003-06-25 19:18:44 +00:00
ru
a3f71f1ca5 Assorted mdoc(7) fixes. 2003-06-01 19:19:59 +00:00
phk
5eb69cae82 Clarify the code a bit.
Submitted by:	Nadav Eiron <nadav@TheEirons.org>
2003-06-01 09:16:50 +00:00
schweikh
7aeeb23d67 Fix grammar bogons.
MFC after:	3 days
2003-05-31 21:14:41 +00:00
fjoe
67cac19473 Fix stripping last path component when only one path component left.
PR:		52686
MFC after:	1 day
2003-05-28 08:23:01 +00:00
ru
182d112c40 Assorted mdoc(7) fixes.
Approved by:	re (blanket)
2003-05-22 13:02:28 +00:00
nectar
01e1a49bba Back out the `hiding' of strlcpy and strlcat. Several people
vocally objected to this safety belt.
2003-05-01 19:03:14 +00:00
peter
65dca2a881 Tell malloc.c that AMD64 uses the same pagesize as i386. 2003-04-30 19:30:34 +00:00
nectar
39a560b55d `Hide' strlcpy and strlcat (using the namespace.h / __weak_reference
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
2003-04-29 21:13:50 +00:00
tjr
96e0986add MFp4: Link strtof.3 and strtold.3 to strtod.3. 2003-04-05 07:33:46 +00:00
fjoe
a87c81f600 BDE'ify 2003-03-29 21:56:59 +00:00
fjoe
37f52e9a78 fix truncation check and buffer overflow check 2003-03-29 21:34:13 +00:00
fjoe
b472435f67 - MAXPATHLEN -> PATH_MAX (pass correct buffer size to readlink as well)
Requested by:		bde
2003-03-28 12:05:45 +00:00
fjoe
e6d7ec5eb0 Make realpath() thread-safe. New implementation does not use chdir(2) at all.
Submitted by:	Constantin S. Svintsoff <kostik (at) iclub.nsu.ru>
2003-03-27 20:48:53 +00:00
ache
2c3ffb2689 According to C99 decimal_point can't be empty 2003-03-20 08:18:55 +00:00
das
b79d3aeb6f The gdtoa import apparently hasn't caused anything or anyone to
explode, so nix the old strtod() / dtoa().  This change is part
of the gdtoa patches reviewed on standards@.
2003-03-15 09:47:05 +00:00
das
f4c037a71b Document strtof() and strtold(). Update vendor license.
Reviewed by:	bde (briefly), mike (mentor), obrien
2003-03-12 20:31:05 +00:00
das
0d06d6f3be Replace our ancient dtoa/strtod implementation with the gdtoa
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
2003-03-12 20:30:00 +00:00
dwmalone
c3d851cf20 Document the fact that hdestory calls free on the keys added with
hsearch(.., ENTER). Make the example reflect this.

PR:		49951
Submitted by:	Peter Jeremy <peterjeremy@optushome.com.au>
2003-03-12 14:18:14 +00:00
robert
349715039e Fix typo. 2003-02-25 21:59:36 +00:00
johan
f7bb1e99c7 Use strlcpy instead of strncpy.
Submitted by:	imp
Reviewed by:	silence on -audit
2003-02-22 18:08:34 +00:00
ache
cbae0f6a5f Back out "drop first N values" method of removing monotonically increased
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...
2003-02-17 03:52:35 +00:00
ache
1aab8e2503 Since we drop NSHUFF values now, set default seed to what it becomes
after srand(1)
2003-02-05 21:25:50 +00:00