Commit Graph

410 Commits

Author SHA1 Message Date
phk
52eadcfa6b If 'VX' is given, realloc(foo,0) will bail, it shouldn't.
PR:		29376
Submitted by:	Farooq Mela <fmela0@sm.socccd.cc.ca.us>
2001-11-17 10:57:04 +00:00
phk
f5a65809cf Correctly call THREAD_UNLOCK() if the recursive call trap is sprung.
Pointed out by:		knu
2001-11-16 18:15:33 +00:00
mike
103fa4ca48 o Implement imaxabs(), imaxdiv(), llabs(), lldiv().
o Update abs(3), div(3), labs(3), ldiv(3) to reflect standards
  conformance and add additional references.

Reviewed by:	bde, wollman
2001-11-15 02:05:03 +00:00
dd
d7894dcef6 malloc and calloc do not free memory.
PR:		31365
Submitted by:	SUZUKI Koichi <koich@cac.co.jp>
2001-11-05 00:39:27 +00:00
peter
e99496b69b Make strtod.c work on Alpha as well. strtod.c has got locale support,
the netbsd_strtod.c file we have does not.  More still should be done
here, but this works happily on my Alpha.  I have not (yet?) changed
the Makefile.inc to use this.
2001-11-04 21:30:12 +00:00
peter
b77df30c32 Slightly closer to netbsd_strtod.c:
s/IEEE_8087/IEEE_LITTLE_ENDIAN/
s/IEEE_MC68k/IEEE_BIG_ENDIAN/
2001-11-04 18:04:00 +00:00
phk
0aeb564985 phkmalloc->evilchecks++;
If zero bytes are allocated, return pointer to the middle of page-zero
(which is protected) so that the program will crash if it dereferences
this illgotten pointer.

Inspired & Urged by:	Theo de Raadt <deraadt@cvs.openbsd.org>
2001-11-02 11:32:28 +00:00
markm
73fa39dbf7 Add a long-overdue nail to the deprecated /dev/urandom interface
by asking some things that need unpredictable numbers to read
/dev/random instead.
2001-10-30 21:26:50 +00:00
dfr
938988ca22 Make this work on ia64. I have no idea why it works on alpha - it
shouldn't.
2001-10-06 15:58:54 +00:00
alfred
db8b7f5d13 Avoid getting stuck in system(3) when the internal call to wait4()
is interrupted by saving the pid.

The old code would assign the return value to pid which would trash
it, to fix the problem save a copy of the pid to be used as the
paramter to wait4().

Submitted by: Toshihiko ARAI <toshi@jp.FreeBSD.org>
2001-10-03 11:01:39 +00:00
ru
9e260fdb3e mdoc(7) police: don't split author names in the AUTHORS section. 2001-10-01 13:50:03 +00:00
ru
d15a85ee23 mdoc(7) police: s/atof/atoi/ 2001-10-01 12:44:24 +00:00
asmodai
715aa84d63 Add ERRORS section.
Mention thread safety and async-cancel safety status [not].
Add standards compliancy references.
Note strtol() is preferred over atoi().

MFC after:	2 weeks
2001-09-26 20:22:44 +00:00
asmodai
7254a98259 Be explicit about the POSIX version it conforms to [in this case 1990].
Put the error comment under the more appropriate ERRORS section.
2001-09-26 20:10:10 +00:00
asmodai
1057e03061 Change standards compliancy order so that C and POSIX are grouped. 2001-09-26 19:42:39 +00:00
mike
343aaecd7d style(9)
Silence from:	phantom
2001-09-17 00:23:19 +00:00
ru
48443e707b mdoc(7) police: changed pure POSIX text; added missing markup bits. 2001-09-11 09:39:23 +00:00
asmodai
fb1ad2a222 Add more standards which we conform to.
Note our implementation is not thread nor async-cancel safe.
Explicitely note atof() does not check nor report errors.
Note that strtod() should be used instead.
2001-09-09 21:09:53 +00:00
asmodai
cb6fa75c43 Detail thread-safe and async-cancel-safe status.
Also add C99 conformity status plus clarification that C99 leaves the
flushing of unwritten data, closure of open streams, and removal of
temporary files to the implementation.
2001-09-09 18:52:00 +00:00
asmodai
f0fdba1cc7 Move to using .In instead of .Fd #include <> for include mark-up.
Inspired by comment from:	dd
2001-09-07 14:46:36 +00:00
phantom
8fd828771b reconnect strfmon.c to build list 2001-09-07 13:03:16 +00:00
asmodai
c6e3253504 Fix some mdoc nits caused by my knowledge not being too up-to-date on
mdocNG.

Submitted by:	dd
2001-09-07 12:38:10 +00:00
dfr
c5cd6f57fa Port to ia64, taking into account the fact that pagesizes may be variable. 2001-09-07 12:32:43 +00:00
asmodai
7c671a32ab Add strfmon.3 to the fray.
This is a first cut, but enough to help people interested in using it
further than before.
More text coming to illustrate use and provide more details.

Based on standards' text.
2001-09-07 09:55:28 +00:00
phantom
9784bbd50b correctly wrap macros with { } 2001-09-06 09:26:28 +00:00
obrien
484d437d06 strfmon(3) is not ready to go live. 2001-09-06 08:58:42 +00:00
phantom
0b2a8aa112 Add strfmon(3) implementation. It still contains few XXX's because I lost
my last version of this work due to HDD crash, but this version cleanly
passed all POSIX and SuSv2 tests. I am working on testing scripts which
should test this implementation against all locales and surely more fixes
will come soon.

Reviewed by:	ache, silence at -audit & -developers
2001-09-05 18:50:02 +00:00
ache
36a7b5dd63 Portability fix: use unsigned cast to guaranteed positive part of expression
in case {L}LONG_MAX > abs({L}LONG_MIN).  Non-functional change - we don't
have any such platforms.
2001-09-04 21:28:01 +00:00
ache
ed895616ff Remove rcsids and unneded include 2001-09-04 17:41:20 +00:00
ache
5d51401b40 'acc' is not initialized in one hypotetical case, fix it 2001-09-04 17:12:15 +00:00
ache
05ced81948 Locale *is* used in strto*l*(), at least for isspace(), so remove
'locale not used' statement from comments and BUGS section of manpage.

strtol(): fix non-portable 'cutoff' calculation using the same method as
in strtoll().

Cleanup 'cutoff' calculation, remove unneded casts. Misc. cleanup to
make all functions looks the same.

Implement EINVAL reaction per POSIX, document it in manpage, corresponding
POSIX example quotes here:

------------------------------------------------
If the subject sequence is empty or does not have the expected form, no
conversion is performed; the value of str is stored in the object pointed
to by endptr, provided that endptr is not a null pointer.

If no conversion could be performed, 0 shall be returned and errno may be
set to [EINVAL].

[EINVAL] The value of base is not supported.

Since 0, {LONG_MIN} or {LLONG_MIN}, and {LONG_MAX} or {LLONG_MAX} are
returned on error and are also valid returns on success, an application
wishing to check for error situations should set errno to 0, then call
strtol( ) or strtoll ( ), then check errno.
-----------------------------------------------------
2001-09-04 16:39:11 +00:00
ru
62a7940402 Use ``.Rv -std'' wherever possible.
Submitted by:	yar
2001-08-31 09:57:38 +00:00
jkoshy
ac15012658 If the string specifying the allowed options starts with a leading `:',
`getopt(3)' should not print a warning for missing argument values.

PR:		bin/29625
Reviewed by:	mikeh
MFC after:	1 week
2001-08-16 03:27:03 +00:00
ru
851afc2760 Fixed style bugs (dot `.' at the end of error and warning messages).
Noticed by:	bde
2001-08-10 11:46:37 +00:00
ru
808d735df0 Markup nits: use diagnostic type lists for error and warning messages.
Backout previous revision.  We should not expand plain text xrefs if
they appear in the literal text, e.g. in the error or warning message
of the library function.  (Submitted by: bde)

Moved "out of memory" from warning to errors section.
2001-08-10 11:41:55 +00:00
yar
e180065a4c Use the ``.Rv -std'' mdoc(7) macro in appropriate cases.
Reviewed by:	ru
2001-08-09 13:32:13 +00:00
ru
21e67062d5 mdoc(7) police: expand plain text xrefs. 2001-08-08 11:48:28 +00:00
mp
8da00dc18e Only pull in the MD files if they exist. This allows for progressive
implementation and compilation when bringing up a new architecture.
2001-07-31 16:34:52 +00:00
dd
c49a4e6620 Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
ru
940dc0c680 mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 13:41:46 +00:00
ru
ae06dbeeb4 mdoc(7) police: eliminate -ww warnings. 2001-07-09 15:54:36 +00:00
dd
978810079e mdoc(7) police: remove extraneous .Pp before and/or after .Sh. 2001-07-09 09:54:33 +00:00
ru
891aecc820 mdoc(7) police: mark NULL with .Dv. 2001-07-04 12:04:25 +00:00
dd
5d47a5c202 mdoc(7) police: the BUGS section should go after HISTORY and AUTHORS. 2001-06-24 20:58:20 +00:00
dd
249f484d9a The fact that phk wrote this is not a bug! 2001-06-24 20:56:39 +00:00
dd
0b677720fe Reword a sentence to make it proper English. 2001-06-24 18:11:42 +00:00
dd
9c768350d2 urandom(4) -> random(4) in comments.
PR:		27858
Submitted by:	Yoshihiro Koya <Yoshihiro.Koya@math.yokohama-cu.ac.jp>
Reviewed by:	md5(1)
Approved by:	markm
2001-06-07 02:32:18 +00:00
dd
001f69c69f urandom(4) -> random(4)
PR:		27858
Submitted by:	Yoshihiro Koya <Yoshihiro.Koya@math.yokohama-cu.ac.jp>
Approved by:	markm
2001-06-07 02:31:03 +00:00
ru
d197fc2a1d Add new, from scratch implementation of hsearch() et al that actually works.
Obtained from:	NetBSD
MFC after:	1 month
2001-05-15 07:08:20 +00:00
ru
884d29a1dc Grammar nit. 2001-04-27 08:16:57 +00:00
ache
0687f79c15 Add sranddev.3 to MLINKS 2001-04-23 11:11:00 +00:00
ache
b09219a282 Add #include "un-namespace.h" 2001-04-23 10:38:26 +00:00
ache
d1316207c5 srand*dev() fallback code: change ^getpid() to ^(getpid() << 16) to allow
change of high word part too to produce more interesting seed distribution.
2001-04-23 10:14:28 +00:00
ache
d7cec69300 Add sranddev() since srand() is not vary much with seed, typical time 2001-04-23 02:29:10 +00:00
ru
f85a17a1d7 MAN[1-9] -> MAN. 2001-03-27 17:27:19 +00:00
dd
a5ed797e7e Make tdelete(3), tfind(3), and twalk(3) links to tsearch(3).
Approved by:	nik
2001-03-15 01:53:17 +00:00
obrien
ac7e3b1218 Merge in strtoul.3 rev 1.11 mdoc(7) police changes:
.Nd line broken in rev 1.10
	use .Bx for ``BSD''
2001-02-28 17:46:56 +00:00
ru
af53167ba5 mdoc(7) police: fix the .Nd line broken in previous revision.
Noticed by:	bde

Use .Bx for ``BSD''.
2001-02-28 12:54:16 +00:00
ache
51e220082c Use formula with better random distribution for rand()
Even better formula from random() could not be intetgrated because rand_r()
supposed to store its state in the single variable (but table needed for
random() algorithm integration).
2001-02-27 14:42:19 +00:00
obrien
3cdfa59ee2 I accidently deleted an include when I added the $FreeBSD$ so I could
check in my changes.
2001-02-27 14:30:42 +00:00
obrien
9890a827d4 Impliment the ISO-C99 strto[u]ll()
and rewrite strto[u]q() in terms of it.
2001-02-27 13:33:07 +00:00
ru
f2ef0fa6fe .St -ansiC -> .St -isoC 2001-02-26 13:23:47 +00:00
tegge
5996b6cbc7 Update unused __dtoa prototypes to match reality. 2001-02-25 08:51:41 +00:00
tegge
38ec42f445 Remove freelists managed by Balloc/Bfree.
Change __dtoa to not free the string it allocated the previous time it was
called.  The caller now frees the string after usage if appropiate.

PR:		15070
Reviewed by:	deischen
2001-02-15 22:12:50 +00:00
ru
7a05da09bb "Cross references in the SEE ALSO section should be sorted by section
number, and then placed in alphabetical order and comma separated.",
mdoc.samples(7) said.
2001-02-12 08:30:22 +00:00
ru
65c172fed6 mmap(3) -> mmap(2). 2001-02-12 08:27:06 +00:00
nik
fcd90bc751 Include mmap(2) in the list of memory allocation functions.
Reviewed by:	hackers
2001-02-11 19:28:36 +00:00
nik
958d489b0f .Xr to mmap. 2001-02-11 18:53:50 +00:00
ru
88f1741804 mdoc(7) police: mark LC_NUMERIC with .Dv. 2001-02-10 10:26:52 +00:00
ache
88e0ba5ec8 Note that decimal point taken from locale 2001-02-10 06:42:32 +00:00
ache
d158cad1b5 Note the fact that decimal point taken from locale (according to SUSv2) 2001-02-10 05:16:41 +00:00
ache
e77c6214bc Use decimap_point from localeconv() instead of hardcoded '.'
Obtained from:	inspired by NetBSD strtod
2001-02-10 05:05:09 +00:00
tegge
a6c2a1d602 Backout previous commit. Use of spinlocks was not approved.
PR:		15070
2001-02-09 20:31:48 +00:00
tegge
330a36514c Protect freelists managed by Balloc/Bfree with a spinlock.
Change __dtoa to not free the string it allocated the previous time it was
called.  The caller now frees the string after usage if appropiate.

PR:		15070
2001-02-08 20:22:28 +00:00
ru
74ecc06fa7 mdoc(7) police: Change -filled displays (which just happen
to be the same as -ragged in the current implementation) to
-ragged.  With mdocNG, -filled displays produce the correct
output, formatted and justified to both margins.
2001-02-07 13:45:30 +00:00
bde
c206f12afe Fixed C error(s) in synopsis. Many were hiding under mdoc errors. 2001-02-05 15:19:56 +00:00
phk
0bf1ab543a Remove a sizeof(void *) == sizeof(int) assumption.
Submitted by:	Loren James Rittle <rittle@latour.rsch.comm.mot.com>
2001-02-04 10:06:24 +00:00
ru
b1c3961564 mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:38:02 +00:00
deischen
dd8c04d769 Remove _THREAD_SAFE and make libc thread-safe by default by
adding (weak definitions to) stubs for some of the pthread
functions.  If the threads library is linked in, the real
pthread functions will pulled in.

Use the following convention for system calls wrapped by the
threads library:
	__sys_foo - actual system call
	_foo - weak definition to __sys_foo
	foo - weak definition to __sys_foo

Change all libc uses of system calls wrapped by the threads
library from foo to _foo.  In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde).  All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes.  <db.h> is an exception
and shouldn't be included in between namespace.h and
un-namespace.h  namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.

Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE.  We have recursive mutexes, but would like to avoid
using them if possible.

Remove uneeded includes of <errno.h> from a few files.

Add $FreeBSD$ to a few files in order to pass commitprep.

Approved by:	-arch
2001-01-24 13:01:12 +00:00
ru
0a2b2f2e94 Prepare for mdoc(7)NG. 2001-01-16 09:08:22 +00:00
ru
b4fcb19df2 mdoc(7) police: Ft/Vt now accept punctuation-type arguments. 2001-01-12 15:46:56 +00:00
ru
63b94f96bb Fixed typo not fixed in previous revision. 2000-12-29 14:36:05 +00:00
ru
fb54000812 Prepare for mdoc(7)NG. 2000-12-29 14:08:20 +00:00
ru
fe2efd38b3 mdoc(7) police: removed history info from the .Os FreeBSD call. 2000-12-14 11:52:05 +00:00
obrien
46d04a9db4 Add `_PATH_DEVZERO'.
Use _PATH_* where where possible.
2000-12-09 09:35:55 +00:00
mph
8ead00cc80 The parameter that contains valid options is "optstring", not "optarg". 2000-11-28 22:06:17 +00:00
phk
8c1799b51f Make it possible to override the function which writes messages to
stderr in case of warnings and errors.

Rename malloc_options to have a leading underscore, I belive I have been
told that is more correct namespace wise.
2000-11-26 10:30:18 +00:00
ru
69062dd641 mdoc(7) police: Er macro usage cleanup. 2000-11-22 16:02:00 +00:00
ru
77559ae015 mdoc(7) police: use certified section headers wherever possible. 2000-11-17 11:44:16 +00:00
ru
b42832df66 Use Fx macro wherever possible. 2000-11-14 11:20:58 +00:00
ru
998050a02b Fixed typos. 2000-11-06 15:46:57 +00:00
eivind
736563d71f Back out previous commit (MLINK malloc.conf.5 -> malloc.3).
This did not work correctly with whatis(1).

Issue brought up by:	mpp
2000-10-29 13:20:24 +00:00
eivind
0c267d61b2 Add link malloc.conf.5 -> malloc.3 2000-10-29 09:59:35 +00:00
brian
ffb015dd2a Oops, un-spam this file - the last commit was an accident.
Pointed out by: phk
2000-09-20 06:16:23 +00:00
brian
e73d6e01c6 Only realloc() environ if we're sure that we know where it came from.
The recent problems with sshd were due to sshd reassigning
`environ' when setenv() thinks it owns it.  setenv() subsequently
realloc()s the new version of environ and *boom*
2000-09-20 03:05:37 +00:00
imp
ed0b7bc95f Don't print an error message if the bad option is '?'. This has been
in my tree for a long time.  bde reviewed this once upon a time and
said it was OK, iirc.  This also obviates the need to put ? in the
optstring argument to preclude the extra warning message which some
people think confuses users.  When I made my getopt cleanups of a long
time ago, this was the compromise reached.  I just neglected to commit
it until now.
2000-09-04 03:49:22 +00:00
phk
0a8464e8dd Turn malloc options "AJ" on by default.
These will be turned off again as we approach 5.0-RELEASE.

If you benchmark things, make sure to
	ln -sf j /etc/malloc.conf
to see "true" performance.
2000-07-09 13:10:18 +00:00
alfred
c022ca749a bring in binary search tree code.
Obtained from: NetBSD
2000-07-01 06:55:11 +00:00
sheldonh
5e0dc361bb Fix miscellaneous mdoc macro argument limit infringements.
PR:		18465
Reported by:	Kazu TAKAMUNE <takamune@avrl.mei.co.jp>
2000-05-09 14:02:06 +00:00
phantom
b26051ccb9 Use `Er' variable to define first column width in ERRORS section. 2000-05-06 12:00:11 +00:00
mpp
b23853ea23 Minor mdoc cleanup.
PR:		docs/13218
2000-05-05 02:21:45 +00:00
phantom
7c1d534e81 Introduce ".Lb" macro to libc manpages.
More libraries manpages updates following.
2000-04-21 09:42:15 +00:00
phk
c7c74c0bb9 Add a missing THREAD_UNLOCK() found missing by Valentin Nechayev
<netch@segfault.kiev.ua>

Remove allocation failure check from 'A' option, the 'X' option does
this as a standalone check now.
2000-04-10 09:24:44 +00:00
charnier
91e4447fc7 Spelling, fprintf -> err, remove unneeded variable declaration 2000-03-26 15:18:12 +00:00
jasone
576c454894 Take care to avoid having "strong" and "weak" symbols of the same name in
libc_r.
2000-03-16 02:14:41 +00:00
chris
c8a69c0b16 Merge from RELENG_3 (oops):
resolved_name	-> resolved_path
    resolvedname	-> resolved_path
2000-01-29 19:43:25 +00:00
jasone
495ec2dee2 Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),
just use _foo() <-- foo().  In the case of a libpthread that doesn't do
call conversion (such as linuxthreads and our upcoming libpthread), this
is adequate.  In the case of libc_r, we still need three names, which are
now _thread_sys_foo() <-- _foo() <-- foo().

Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(),
nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo().

Remove all internal libc usage of: creat(), pause(), sleep(), system(),
tcdrain(), wait(), and waitpid().

Make thread cancellation fully POSIX-compliant.

Suggested by:	deischen
2000-01-27 23:07:25 +00:00
ru
23ff23b5e2 o Back out rev 1.4 - reallocf() failure clobbers existing `environ'.
o Do not override `environ' if realloc() fails, leave it intact.
o Set `alloced' only when memory is actually allocated.

PR:		bin/5604 (2nd part)
Reviewed by:	bde
2000-01-27 16:12:03 +00:00
archie
56efeca19a Document the memory leak that is inherent in FreeBSD's semantics
for getenv()/putenv().

PR:	10341 5604
2000-01-26 22:10:56 +00:00
jasone
e200b118e2 Add three-tier symbol naming in support of POSIX thread cancellation
points.  For library functions, the pattern is __sleep() <--
_libc_sleep() <-- sleep().  The arrows represent weak aliases.  For
system calls, the pattern is _read() <-- _libc_read() <-- read().
2000-01-12 09:23:48 +00:00
hoek
e2b63ad76b Make example for handling "-##" work and comply with style(9). Still
doesn't handle nastier corner cases such as "-j3 -33" correctly.  <shrug>

PR:		docs/12994 (James Howard <howardjp@wam.umd.edu>)
2000-01-06 01:25:15 +00:00
hoek
def85f1770 Add history: The reallocf() function first appeared in FreeBSD-3.0.
See imp's 199808201619.KAA20970@harmony.village.org in freebsd-hackers (the
reallocf.c cvs history mistakenly refers to freebsd-current).
1999-12-28 15:14:59 +00:00
bde
a76f5a0d99 Fixed missing installation of a link to rand_r.3. 1999-12-23 16:00:50 +00:00
sheldonh
8f468e73c2 Document the current behaviour with respect to the handling of errno.
Approved by:	phk
1999-12-22 17:04:46 +00:00
jkh
45823be519 Fix handling of trailing :'s to match what other OSes do (spit out
a diagnostis).

Submitted by:	Guy Harris <gharris@flashcom.net>
1999-12-17 01:52:15 +00:00
chris
3e8f8491d2 Add a cross-reference to fabs(3) man page.
PR:		docs/15337
Submitted by:	Bruce A. Mah <bmah@ca.sandia.gov>
1999-12-07 23:09:58 +00:00
kris
0bd1e877d6 Typo
Obtained from:	OpenBSD
1999-11-15 03:13:23 +00:00
peter
2df6207632 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
268478d4a7 Change .Fn to .Xr on a couple of lines where abort(3) is referenced. 1999-09-25 22:42:12 +00:00
peter
342c138a4f Tidy up $Log$ debris. 1999-09-05 17:42:45 +00:00
peter
51ddb038ec $Header$ -> $FreeBSD$ 1999-08-28 05:11:36 +00:00
peter
e226894fa0 $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
mpp
eed3878b2e 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
238ce9709f Fix .Xr line for `getpagesize' 1999-08-14 07:33:15 +00:00
hoek
acf30dccd9 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
44f9c90d19 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
c2e504968a Back out previous commit after discussing it with Dmitrij Tejblum. 1999-07-07 21:01:20 +00:00
des
71e220af31 Always set errno to ENOMEM when returning 0 from malloc() or realloc().
Approved by:	phk
1999-07-07 19:54:08 +00:00
wes
837de9e025 Added Posix rand_r function. 1999-05-24 23:30:14 +00:00
phk
ca88a08fdd 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
b339ed3bfc Correct synopsys: getsubopt is declared in unistd.h, not stdlib.h.
PR:		docs/9376
1999-03-02 02:35:57 +00:00
ache
56272f3c94 fix tabs lost apparently in copy&paste 1999-02-12 19:45:53 +00:00
jkoshy
581d7ac946 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
e6d154fdbc Include mergesort() in description of errors. 1998-11-04 09:27:03 +00:00
rnordier
e3e40ae1ab Drop unused labels. 1998-11-04 09:22:07 +00:00
rnordier
dbae20e609 Handle a zero elements argument.
PR:		8566
Submitted by:	Archie Cobbs <archie@whistle.com>
1998-11-04 08:55:34 +00:00
jb
cacbe3ac3d 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
d00ce50aec Use 8k pagesize on alpha, not 4k. 1998-09-23 21:26:04 +00:00
alex
52d0489e21 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
a7abc2a8a8 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
c6419dc030 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
60d2bd9011 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
13204dc603 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
96fb246758 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
266cbb586a 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
1e3270b62a Add support for thread lock debug. No impact of the malloc code. 1998-06-09 08:30:32 +00:00
jb
0963eb5597 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
8eaf407618 Fix a few nits in quoted code fragments and elsewhere. 1998-05-04 23:16:50 +00:00
jb
bed8d98d58 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
68be02f38b 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
57aa8c90ed Use signal() in both the threaded and non-threaded cases. 1998-04-29 09:06:13 +00:00
dima
08ce66f63e indent 1998-04-20 22:13:50 +00:00
phk
87b9646c33 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
7aebd7bc3e 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
43712df52a Change in name of the static initializer define. 1998-04-04 11:03:07 +00:00
charnier
46f7bb5b5b .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq 1998-03-19 07:34:22 +00:00
jb
dbfd1020d8 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
e8ea46b408 Change MACHINE references to MACHINE_ARCH. 1998-02-20 08:41:46 +00:00
alex
3e32f625d1 Drop the use of caddr_t in conjunction with mmap(2). 1997-12-31 03:15:06 +00:00
jb
ffe51a5e26 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
5368c6cec2 Sorted lists. 1997-10-21 08:41:15 +00:00
bde
747da9047c 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
025ff5375f 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
23d24985c5 environmental -> environment. 1997-09-18 06:55:21 +00:00
phk
80f6292a1f Another 32bits of 64bits conformance.
Reviewed by:	phk
Submitted by:	jdp
1997-08-31 05:59:39 +00:00
phk
5a30ca0c56 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
541bb01b22 Malloc option H is now default. 1997-08-27 06:40:34 +00:00
steve
07ee29d4fd Get rid of integer overflow warning.
PR:		misc/3575
Submitted by:	Bruce Evans <bde@zeta.org.au>
1997-08-23 23:51:12 +00:00
jdp
fac6b2f333 Fix a minor typo. It only affects the sparc version. 1997-07-26 03:43:14 +00:00
phk
01f1a5c82d realpath() should break on looped symlinks.
PR:		3911
Reviewed by:	phk
Submitted by:	Shigio Yamaguchi <shigio@wafu.netgate.net>
1997-07-16 11:25:48 +00:00
peter
1a608ac729 kill the undead 1997-07-13 14:26:00 +00:00
bde
a9581f1d11 This commit was generated by cvs2svn to compensate for changes in r27180,
which included commits to RCS files with non-trunk default branches.
1997-07-03 03:28:27 +00:00
bde
e4673e648e Import Lite2's src/lib, except for non-i386 machine-dependent directories,
libc/db, libc/gen/crypt.* and libtelnet.  All affected files except 3
unimportant ones have already left the vendor branch.
1997-07-03 03:28:27 +00:00
phk
cb9d464cf1 Have another go at the malloc-sysv initialization.
PR:		4002
Pointed out by:	bde
1997-07-02 19:33:23 +00:00
phk
2938560c9b malloc_sysv used before initialized, reported in PR4002 by
Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>

Various cleanup from Keith Bostic

Reinstate calloc() as a separate funtion, in its own source/object file.
leave the manpage integrated with malloc.3 and friends.  Too many things
were broken in this respect.

PR:		4002
Reviewed by:	phk
Submitted by:	Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
Submitted by:	Keith Bostic <bostic@bostic.com>
1997-07-01 18:39:38 +00:00
steve
9c6b7d527a Show the real revision date and not the date that this
manpage is being viewed.
1997-06-23 04:03:49 +00:00
phk
84236fe590 Integrate calloc with the rest of the gang.
Various portability and stylistic cleanups.
Kill MALLOC_STATS & the 'D' option.
Fix the 'V' option.
Major overhaul of the man-page.
You milage should not vary.

Reviewed by:	Keith Bostic <bostic@bostic.com>
Submitted by:	Keith Bostic <bostic@bostic.com>
1997-06-22 17:54:27 +00:00
ache
32e1a165fb srandomdev: use stack junk value in the fallback code too 1997-06-15 18:23:19 +00:00
ache
4a2f1e93f9 Instead of copying fallback code over and over in each program,
implement (better) falback code inside srandomdev() itself.
Change return type from int to void (binary compatibility surprisely
achieved). Userland code will be changed soon.
1997-06-14 00:14:29 +00:00
phk
91e1ada469 Add yet an option, this time on how to deal with malloc(0) and realloc(ptr.0)
Prompted by:	X11 & XFree86
1997-06-12 12:45:45 +00:00
jb
202cf3f938 Fix mutex initialization.
Malloc cannot use pthread_mutex_init() to initialize a mutex because
the mutex initialization process does a malloc!

libc_r internals skip the malloc and assign an initializer to a static
structure and point the opaque type (pthread_mutex_t in this case) to
that structure. This is done on the assumption that the mutex will never
be destroyed. This style of initialization is only valid inside libc_r
because the structure that is assigned is opaque to the user.

This fix allows a simple program to get to main() again. 8-)
1997-06-04 12:55:49 +00:00
phk
0ee5210549 Malloc flag X makes malloc behave like the canonical xmalloc() wrapper.
Untested support for Solaris from John-Mark Gurney

Reviewed by:	phk
Submitted by:	(partially) John-Mark Gurney <gurney_j@resnet.uoregon.edu>
1997-05-30 20:39:32 +00:00
jb
2be1de3772 Changed all paths to be relative to src/lib instead of src/lib/libc
so that all these makefiles can be used to build libc_r too.

Added .if ${LIB} == "c" tests to restrict man page builds to libc
to avoid needlessly building them with libc_r too.

Split libc Makefile into Makefile and Makefile.inc to allow the
libc_r Makefile to include Makefile.inc too.
1997-05-03 03:50:06 +00:00
max
7d2b695962 Typo.
PR:		#3178
Submitted by:	Josh Gilliam <soil@quick.net>
1997-04-25 20:36:10 +00:00
bde
b5dfde431c Fixed #include and/or prototype bugs in synopsis. 1997-04-19 15:57:20 +00:00
bde
cccb9a6fd9 Fixed missing consts in synopsis. 1997-04-13 13:37:56 +00:00
ache
a539edccf5 Remove orand* code as promised for the next release 1997-03-29 19:55:03 +00:00
ache
90f4011ee1 Add srandomdev.3 link 1997-03-23 23:12:59 +00:00
ache
2914a51519 Fix urandom reference in the comment 1997-03-23 23:09:31 +00:00
ache
3e0da61b48 Add srandomdev() description 1997-03-23 23:08:31 +00:00
ache
f5290e5fd5 Add srandomdev() function (use "/dev/urandom" now)
Submitted by: wollman & me (add type casts and remove unneded loop)
1997-03-23 22:40:20 +00:00
mpp
13ff4e5c40 Remove an extra comma. 1997-03-22 23:48:12 +00:00
mpp
0812b7f545 Use the .Tn macro for generic FreeBSD references. Other minor cleanup. 1997-03-21 20:57:20 +00:00
phk
ff90a8f058 Check for overflow in size argument.
Tested by:	Joel Maslak <j@pobox.com>
Closes:		PR kern/2964
1997-03-18 07:54:24 +00:00
ache
061e90659d Fix arg types to match Lite2 1997-03-17 16:27:16 +00:00
peter
2bc8a73076 Part 2 of a failed commit (cvs broke). Original message:
Back out a dubious Lite2 change to "optimise" getcwd() to look at $PWD
because it's potentially dangerous (think: symlink races).  Move
realpath() back to it's original location, and remove getcwd_physical()
by renaming it back to getcwd() and zapping the original getcwd wrapper.

Noticed by: bde

The following commits already happened but the log message got lost:

Modified Files:
   gen/Makefile.inc gen/getcwd.c stdlib/Makefile.inc
Removed Files:
   gen/realpath.3
1997-03-13 06:58:46 +00:00
peter
7c14f89fc6 Back out a dubious Lite2 change to "optimise" getcwd() to look at $PWD
because it's potentially dangerous (think: symlink races).  Move
realpath() back to it's original location, and remove getcwd_physical()
by renaming it back to getcwd() and zapping the original getcwd wrapper.

Noticed by: bde
1997-03-13 06:45:38 +00:00
peter
d9331b15fa Merge Lite2 changes 1997-03-11 11:39:58 +00:00
peter
d22d0c6509 merge from Lite2 - realpath() now shares a lot of code with getcwd()
and is now in the same file.
1997-03-11 11:37:59 +00:00
peter
0b00523c59 Import CSRG 4.4BSD-Lite2 lib/libc onto vendor branch 1997-03-11 11:29:42 +00:00