Commit Graph

409 Commits

Author SHA1 Message Date
Andrey A. Chernov
75207c7a43 Add optarg, optind, opterr, optopt, optreset to SYNOPSYS 2004-02-23 05:07:11 +00:00
Andrey A. Chernov
60fb481f43 POSIX clearly states that getsubopt() should be declared in <stdlib.h>
not in <unistd.h>
2004-02-23 03:32:10 +00:00
Andrey A. Chernov
f0d82b33be Remove unneccessary <unistd.h> 2004-02-23 03:30:02 +00:00
Poul-Henning Kamp
1b105d0c6e 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
Poul-Henning Kamp
1044082184 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
Ruslan Ermilov
f3b6219857 Unbreak the upgrade path from 4.9 after removal of GNU getopt and
<gnuregex.h>.
2004-02-20 11:55:14 +00:00
Colin Percival
d623b765cf 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
David Schultz
307649e2f3 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
Alexander Kabaev
50bcce79ff 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
Alexander Kabaev
61cf73b3eb 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 Moolenaar
fd7707aa50 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
Tim Kientzle
669073a7e6 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
Daniel Eischen
358702366c 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
Tim J. Robbins
4539e95a0f 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 Wemm
dc196afb2e 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
Poul-Henning Kamp
ba5455f25c Consistently cast to (u_char *) when filling with junk. 2003-10-25 23:47:33 +00:00
Poul-Henning Kamp
ea0ae15a06 Style changes. Inching closer to convergence with OpenBSD. 2003-10-25 12:56:51 +00:00
Tim J. Robbins
5e24a42489 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
Poul-Henning Kamp
9aa1994ce8 More style fixes to improve diffability with OpenBSD.
Pull 'A' evilness for realloc(3) from OpenBSD.
2003-09-27 18:58:26 +00:00
Poul-Henning Kamp
dcd2766979 Style changes to improve diffability against OpenBSD version. 2003-09-27 17:29:03 +00:00
Ruslan Ermilov
959d6c24f6 Get rid of duplicates. 2003-09-14 13:41:59 +00:00
Ruslan Ermilov
743d5d518c mdoc(7): Properly mark C headers. 2003-09-10 19:24:35 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
David Xu
1d29b48683 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
Andrey A. Chernov
40220dde01 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
David Schultz
e02cc8e419 Cross-reference arc4random(3). 2003-07-31 06:18:34 +00:00
Poul-Henning Kamp
df6989b848 Minor constification. 2003-07-29 11:16:14 +00:00
Ruslan Ermilov
f5913c9736 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
David E. O'Brien
ea5a1812ba mdoc police 2003-06-25 21:31:43 +00:00
David E. O'Brien
4c861aeb86 Be more specific in BUGS.
Submitted by:	ru

Add history.
2003-06-25 19:18:44 +00:00
Ruslan Ermilov
0e35e492fc Assorted mdoc(7) fixes. 2003-06-01 19:19:59 +00:00
Poul-Henning Kamp
b600adca79 Clarify the code a bit.
Submitted by:	Nadav Eiron <nadav@TheEirons.org>
2003-06-01 09:16:50 +00:00
Jens Schweikhardt
f8f6970098 Fix grammar bogons.
MFC after:	3 days
2003-05-31 21:14:41 +00:00
Max Khon
f4203da86c 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
Ruslan Ermilov
3a5146d9e2 Assorted mdoc(7) fixes.
Approved by:	re (blanket)
2003-05-22 13:02:28 +00:00
Jacques Vidrine
d05090827f 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 Wemm
5aed8cd5f6 Tell malloc.c that AMD64 uses the same pagesize as i386. 2003-04-30 19:30:34 +00:00
Jacques Vidrine
5723e501ab `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
Tim J. Robbins
63e6ca586e MFp4: Link strtof.3 and strtold.3 to strtod.3. 2003-04-05 07:33:46 +00:00
Max Khon
839e119ec8 BDE'ify 2003-03-29 21:56:59 +00:00
Max Khon
057e4034dd fix truncation check and buffer overflow check 2003-03-29 21:34:13 +00:00
Max Khon
be6a158e0f - MAXPATHLEN -> PATH_MAX (pass correct buffer size to readlink as well)
Requested by:		bde
2003-03-28 12:05:45 +00:00
Max Khon
226a0f0f8b 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
Andrey A. Chernov
85bebbc156 According to C99 decimal_point can't be empty 2003-03-20 08:18:55 +00:00
David Schultz
e31c9eb10b 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
David Schultz
703d65601d Document strtof() and strtold(). Update vendor license.
Reviewed by:	bde (briefly), mike (mentor), obrien
2003-03-12 20:31:05 +00:00
David Schultz
6a66acb565 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
David Malone
5560a5abb3 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 Drehmel
9eddd2bf34 Fix typo. 2003-02-25 21:59:36 +00:00
Johan Karlsson
484251e7c4 Use strlcpy instead of strncpy.
Submitted by:	imp
Reviewed by:	silence on -audit
2003-02-22 18:08:34 +00:00