Commit Graph

143 Commits

Author SHA1 Message Date
peter
70fc0d318e Go to a bit more trouble to make it absolutely clear that malloc(3)
does not zero the allocated memory.
1999-11-12 16:41:21 +00:00
chris
63b5167082 Change .Fn to .Xr on a couple of lines where abort(3) is referenced. 1999-09-25 22:42:12 +00:00
peter
93f9277c83 Tidy up $Log$ debris. 1999-09-05 17:42:45 +00:00
peter
c81dbb3c98 $Header$ -> $FreeBSD$ 1999-08-28 05:11:36 +00:00
peter
76f0c923fe $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
mpp
b813f67e2a Various man page cleanup:
- Sort xrefs
- FreeBSD.ORG -> FreeBSD.org
- Be consistent with section names as outlines in mdoc(7)
- Other misc mdoc cleanup.

PR:		doc/13144
Submitted by:	Alexy M. Zelkin <phantom@cris.net>
1999-08-15 09:51:25 +00:00
chris
d680f15828 Fix .Xr line for `getpagesize' 1999-08-14 07:33:15 +00:00
hoek
6a57215607 Mention that EXIT_SUCCESS and EXIT_FAILURE are preferred over
sysexits.h-values as exit codes for portable programs.
1999-08-01 20:46:45 +00:00
nik
f7a8bc4c04 Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:50:10 +00:00
des
dfaa48d6e0 Back out previous commit after discussing it with Dmitrij Tejblum. 1999-07-07 21:01:20 +00:00
des
8987e649ca Always set errno to ENOMEM when returning 0 from malloc() or realloc().
Approved by:	phk
1999-07-07 19:54:08 +00:00
wes
07cfb42e12 Added Posix rand_r function. 1999-05-24 23:30:14 +00:00
phk
eed7c97f34 Disable the "Hint" option in phkmalloc as default. Recent VM system
changes have made this too expensive.  This gains about 1.25% on
worldstone on my SMP machine.

Swap-less machines, for instance PicoBSDs, and machines which experience
page-out trafic, check with top(1), will probably want to reenable this
with:
	ln -s H /etc/malloc.conf

Suggested by: alc (&dyson ?)
1999-03-28 14:16:05 +00:00
ghelmer
7a5b08f806 Correct synopsys: getsubopt is declared in unistd.h, not stdlib.h.
PR:		docs/9376
1999-03-02 02:35:57 +00:00
ache
a36bb76941 fix tabs lost apparently in copy&paste 1999-02-12 19:45:53 +00:00
jkoshy
2c3bd3ad9c Clarify format of exit status code. Note when a return code of -1 can
be expected.

PR:		docs/9701
Submitted by:	Marc van Kempen <marc@bowtie.nl>
1999-01-27 03:54:09 +00:00
rnordier
6037124de3 Include mergesort() in description of errors. 1998-11-04 09:27:03 +00:00
rnordier
05e7da8d39 Drop unused labels. 1998-11-04 09:22:07 +00:00
rnordier
6ffb967233 Handle a zero elements argument.
PR:		8566
Submitted by:	Archie Cobbs <archie@whistle.com>
1998-11-04 08:55:34 +00:00
jb
8d80497304 Delete the XXX comments that refer to spinlock recursion. The malloc/free/
realloc functions check for recursion within the malloc code itself. In
a thread-safe library, the single spinlock ensures that no two threads
go inside the protected code at the same time. The thread implementation
is responsible for ensuring that the spinlock does in fact protect malloc.
There was a window of opportunity in which this was not the case. I'll fix
that with a commit RSN.
1998-09-30 06:13:59 +00:00
dfr
7fdf235da0 Use 8k pagesize on alpha, not 4k. 1998-09-23 21:26:04 +00:00
alex
6afe7a9f53 Back out part of previous commit (even though it's technically correct).
Our spinlock implementation allows a particular thread to obtain a lock
multiple times, but release the lock with a single unlock call.  Since
we're detecting recursion, we know the lock is already owned by the
current thread in a previous call and must not be released in the
current call.  This is really far too dependent on this particular
spinlock implementation, so I've added commented out calls to
THREAD_UNLOCK in the appropriate places.  We can activate this code when
spinlock is taught to count each lock operation.
1998-09-20 01:07:50 +00:00
alex
2945cc62f8 Correctly back out of free if a recursive call into malloc.c is detected.
Set malloc_func *after* grabbing the thread lock.

Noticed by:	Simon Coggins <simon@oz.org>
1998-09-19 20:55:36 +00:00
imp
bfe73fd683 Replace memory leaking instances of realloc with non-leaking reallocf.
In some cases replace if (a == null) a = malloc(x); else a =
realloc(a, x); with simple reallocf(a, x).  Per ANSI-C, this is
guaranteed to be the same thing.

I've been running these on my system here w/o ill effects for some
time.  However, the CTM-express is at part 6 of 34 for the CAM
changes, so I've not been able to do a build world with the CAM in the
tree with these changes.  Shouldn't impact anything, but...
1998-09-16 04:17:47 +00:00
imp
5c7c8dfbe2 o Don't reference non-existant function freealloc.
o Properly order things

Pointed out by: bde
1998-09-16 04:07:31 +00:00
imp
f706ca01b7 Fix style problems noted by Bruce:
o No copyright on reallocf.
	o Order makefile list correctly.
	o indent reallocf properly.
1998-09-16 03:16:06 +00:00
imp
d54a12dd1f Add reallocf to the library. This function is simliar to realloc, but
when it returns NULL to indicate failure, it will also free the memory
that was passed to it, if that was non-null.

This does not change the semantics of realloc.

A second commit will be done to commit the conversion of those places in
the code that can safely use this to avoid memory leaks when confronted
with low memory situations.

Beaten-to-death-but-finally-approved-in: -current
1998-09-14 20:34:34 +00:00
peter
03956e03bf preserve errno across the readlink() calls. There is no value in trashing
errno during a successful malloc() call.
1998-06-18 09:13:16 +00:00
jb
439aa43648 Add support for thread lock debug. No impact of the malloc code. 1998-06-09 08:30:32 +00:00
jb
1baebded07 This is a hack to workaround source that is coded to use long variables
but also assumes that they are 32-bits. This is one place where I don't
think it is appropriate to change 'long' to 'int'. I don't see why the
code couldn't be fixed so that using natural long variables does the
right thing. It's spaggetti code so it'll take some effort. Obviously
NetBSD thought so too because they change 'long' to 'int32_t' etc
and left it at that. As a temporary measure FreeBSD/Alpha can use the
NetBSD code and put this on the list of things to fix.
1998-05-08 05:41:57 +00:00
rnordier
f35a3f07ec Fix a few nits in quoted code fragments and elsewhere. 1998-05-04 23:16:50 +00:00
jb
f1fb79481d Replace the threaded locking with spinlock calls for both threaded
and non-threaded programs. This makes malloc thread safe for linking
with libpthread and kernel threads.

Reviewed by: phk
1998-04-29 09:10:58 +00:00
jb
0d8f4028af Reference an external variable in threaded programs so that the
autoinitialiser gets linked in and therefore called before main().
1998-04-29 09:08:43 +00:00
jb
44b61e0100 Use signal() in both the threaded and non-threaded cases. 1998-04-29 09:06:13 +00:00
dima
f475e872ad indent 1998-04-20 22:13:50 +00:00
phk
525c97c21d Remove a nolonger implented "BUGS" description.
PR:		6240
Reviewed by:	phk
Submitted by:	Niall Smart rotel@indigo.ie
1998-04-11 07:37:44 +00:00
jb
4c358b50ec Add a global variable called __isthreaded that can be tested throughout
libc to determine if locking is required. This is needed in libc
for use with kernel threads, but until a thread is created, we don't
really want to bother locking things. The variable was added here
because the crt code calls exit(main()) so all programs will get the
variable.
1998-04-11 07:02:58 +00:00
jb
43c2287620 Change in name of the static initializer define. 1998-04-04 11:03:07 +00:00
charnier
79fc0e5555 .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq 1998-03-19 07:34:22 +00:00
jb
1b6316f0e7 NetBSD doesn't have a utrace syscall, so don't define that if
__NETBSD_SYSCALLS is defined.
1998-03-09 07:00:38 +00:00
jb
7bfcc9edbb Change MACHINE references to MACHINE_ARCH. 1998-02-20 08:41:46 +00:00
alex
eac766f136 Drop the use of caddr_t in conjunction with mmap(2). 1997-12-31 03:15:06 +00:00
jb
da6ab2349a Fix recursion problem which occurs when a signal is received during
a malloc. The signal handler creates a thread which requires a malloc...
For now, the only thing to do is to block signals. When we move user
pthreads to use the kernel threads, mutexes will be implemented in kernel
space and then malloc can revert.
1997-12-15 02:12:42 +00:00
bde
ea35ce8d73 Sorted lists. 1997-10-21 08:41:15 +00:00
bde
d1bc3e7989 Handle machine-dependent (stdlib) sources more automatically.
This fixes bugs in the manual handling.  abs.[cS] was handled too
specially and the wrong (.c) variant for each of div.[cS], labs.[cS]
and ldiv.[cS] was added to SRCS.  This caused the .c variant to be
used if `depend' was made and the .S version to be used otherwise.
1997-10-16 14:58:30 +00:00
bde
ef5c98dd45 Removed the subdirectory paths from the definitions of MAN[1-9]. They
were a workaround for limitations in bsd.man.mk that were fixed about
2 years ago.
1997-10-15 16:16:41 +00:00
charnier
1754071cd4 environmental -> environment. 1997-09-18 06:55:21 +00:00
phk
6152eccaa4 Another 32bits of 64bits conformance.
Reviewed by:	phk
Submitted by:	jdp
1997-08-31 05:59:39 +00:00
phk
cb8d9886a9 Improvement of type independency for the bitmap.
This makes 64bit operation more likely.

Reviewed by:	phk
Submitted by:	jdp
1997-08-27 12:04:33 +00:00
phk
f276c66ddf Malloc option H is now default. 1997-08-27 06:40:34 +00:00