otto
f8fb73633b
Make all combinations of G, P, J and zero-fill work with as little
effort as possible in most cases; ok djm@
16 years ago
djm
f4d35a1a7f
unbreak MALLOC_OPTIONS=G that I broke in my last commit;
slightly kludgey solution for until otto fixes it properly; ok otto@
16 years ago
djm
e2b5c86e43
fix calloc() for MALLOC_OPTIONS=J case: SOME_JUNK was being filled into
the freshly mmaped pages disrupting their pure zeroness;
ok otto@ deraadt@
16 years ago
djm
11ee72166d
unbreak wcschr(string, L'\0') which was incorrectly returning NULL
rather than a pointer to the terminating nul; ok deraadt@
16 years ago
otto
1e4c360dbd
make sure we always map and unmap multiples of MALLOC_PAGESIZE;
case spotted by beck, one by me; ok deraadt@ beck@
16 years ago
otto
74022f5554
Smarter implementation of calloc(3), which uses the fact that mmap(2)
returns zero filled pages; remember to replace this function as well if you
provide your own malloc implementation; ok djm@ deraadt@
16 years ago
otto
3b4110eeac
small cleanup of error/warning strings
16 years ago
miod
af2d1d10b8
Split SHA1Transform() back into smaller pieces when compiling on landisk,
to defeat gcc optimization bugs. Similar to what had been done on sparc64
in the past.
ok millert@ deraadt@
16 years ago
otto
1eac738a69
man page bits for new malloc; ok jmc@
16 years ago
otto
c2d85e2043
Almost complete rewrite of malloc, to have a more efficient data
structure of tracking pages returned by mmap(). Lots of testing by
lots of people, thanks to you all.
ok djm@ (for a slighly earlier version) deraadt@
16 years ago
ray
8e0491f90a
First pass at removing clauses 3 and 4 from NetBSD licenses.
Not sure what's more surprising: how long it took for NetBSD to
catch up to the rest of the BSDs (including UCB), or the amount of
code that NetBSD has claimed for itself without attributing to the
actual authors.
OK deraadt@
16 years ago
jmc
392400ba76
grammar fixes;
16 years ago
otto
5292ed61a9
remove _MALLOC_LOCK_INIT; major bump; ok deraadt@
16 years ago
landry
592f3fe88a
Add strtof() to libc, some ports seem to like it. Currently it's a simple
call to strtod() with bounding check.
Discussed with pyr@ and otto@
ok otto@ deraadt@
16 years ago
jmc
ef3228a332
fix an Xr, and use a more appropriate macro;
16 years ago
deraadt
badc137d26
arc4random_stir() does not use /dev/arandom anymore, but sysctl kern.arandom
16 years ago
djm
5a2233d09c
fix math screwup that reintroduced a bias for upper_bounds in range
(2^30,2^31). Nothing in the tree yet requests random numbers bounded
by this range.
report jakob!deraadt; ok deraadt@
16 years ago
jmc
c52fe5a85f
kill an Xr to a non-existent man page, ulimit(1);
16 years ago
otto
a8ec3b0eb8
remove recalloc(3); it is buggy and impossible to repair without big
costs; ok jmc@ for the man page bits; ok millert@ deraadt@
16 years ago
djm
d34ab18f72
Use arc4random_buf() when requesting more than a single word of output
Use arc4random_uniform() when the desired random number upper bound
is not a power of two
ok deraadt@ millert@
16 years ago
kurt
2815da0a3f
- do not call pthread_atfork(3) handlers when a multithreaded program
calls vfork(2). "untested, but looks OK" marc@
- document vfork(2), popen(3) and system(3) don't call atfork handlers
in multithreaded programs. okay jmc@
16 years ago
millert
ae51485cf0
Zero state buffers on return. OK deraadt@
16 years ago
ray
df36c8d862
bcmp(3) tries to return length, which is a size_t, as an int.
Instead, just return 1 if there is a difference.
Found by lint.
OK millert.
16 years ago
jmc
8c8d34acf3
- add NAME entries for arc4random_buf and arc4random_uniform
- simplify a macro call (Do/Dc -> Dq)
16 years ago
deraadt
d065788062
Add missing MLINKS
16 years ago
otto
ffe451fa53
diff from djm@ committed at his request:
introduce two new APIs for requesting strong random numbers:
arc4random_buf() - fill an arbitrary memory range with random numbers
arc4random_uniform() - return a uniformly distributed random number
below
a specified upper bound, avoiding the bias that comes from a naive
"arc4random() % upper_bound" construction.
these mirror similarly-named functions in the kernel;
lots of discussion deraadt@ mcbride@
16 years ago
ray
c94408a321
- len is size_t, but n uses len and is an int. Matching those types
should be good, plus it prevents weird things from happening if
len > INT_MAX.
- Since n is now size_t, compare it against 0 instead of >= 0.
- temp is used to store individual bytes, so use char instead
(matches fp and tp).
- millert noted that the comma operator may not guarantee order of
execution, so replace with semicolons.
Found by lint, OK millert.
16 years ago
ray
7e316934cd
Convert c to unsigned char, like it says in the manual. Also add
cast to make it explicit.
Found by lint, OK millert.
16 years ago
otto
412c84799c
use pgfree pool like other code does to reserve free list slots.
prevents a few "cannot free mem because i need mem to free mem"
scenarios (one found by weingart@). ok weingart@ millert@ miod@
17 years ago
art
444fc7d450
The digest in the example seems to have been generated
by code that does not do zero padding. The example code does. Fix.
millert@ ok
17 years ago
kurt
f4c406b83b
- make arc4random*() functions thread safe. Use a custom spinlock function
instead of the generic pthread macros since free(3) uses __arc4_getbyte()
when freeing small sized allocations and the generic pthread macros call
malloc(3).
- eliminate passing pointers to a static variable with global scope (rs)
for additional code clarity and reduction.
- shlib minor bumps for libc and libpthread due to new functions.
From andreas@ with some bits from me. okay tedu@ marc@ w/some spot
checking from millert@
17 years ago
martynas
924f910592
typos; ok jmc@
sys/dev/pci/pciide.c from naddy@
17 years ago
tobias
a1236056e5
Put limits.h in front of stdlib.h as style(9) recommends.
OK millert@
17 years ago
tobias
c9440635f0
strtod may return HUGE_VAL on overflow, which is defined in math.h.
Therefore added math.h to SYNPOSIS.
OK millert@
17 years ago
chl
10f5e46272
Add parentheses to avoid warning:
"suggest parentheses around && within ||"
ok millert@
17 years ago
miod
d178cbce71
Make sure to use unique target names so that make -j does not break;
feedback and ok espie@
17 years ago
pyr
31ac1d57bb
add a RETURN VALUES section.
ok jmc@
17 years ago
jmc
dbae57ca40
add HISTORY; shortened version of diff from Ilya A. Kovalenko
ok millert
17 years ago
chl
cf0e72fea8
Add missing header to avoid warning
ok millert@ ray@
17 years ago
deraadt
58f16dd9e2
no need to talk about bits; ok millert jmc
17 years ago
millert
6441b2ef99
Update free(3) section--we use mmap()/munmap(), not brk().
Based on a diff from Mike Belopuhov. OK jmc@
17 years ago
jmc
018d78d2bc
remove trailing whitespace;
17 years ago
millert
7726c7baf2
Add __cxa_atexit() support for gcc3. This provides support for shared object destructors called at dlclose() time. Inspired by similar changes in FreeBSD and NetBSD.
17 years ago
millert
63cad49094
add recaloc(3)
17 years ago
millert
f5ac8d80cf
add memrchr(3)
17 years ago
deraadt
93a9caecd5
use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsg
17 years ago
millert
ad911583f0
Clarify the example about avoiding overflow. OK ray@ deraadt@
17 years ago
ray
e35f6842e2
Show how to use strcspn(3) to trim newlines.
OK jmc and millert.
17 years ago
millert
85fcb3d91b
Reference limits.h, not sys/param.h since we document using PATH_MAX
OK otto@
17 years ago
jmc
abd50361c7
from ginsbach@netbsd, -r1.18:
Document that getopt_long(3) can and will accept unique abbreviated long
option names. This feature has been present since getopt_long(3) was first
released in NetBSD 1.5. This is also standard GNU getopt_long(3) behavior.
ok millert
17 years ago