diff options
author | tholo <> | 1997-05-31 08:55:06 +0000 |
---|---|---|
committer | tholo <> | 1997-05-31 08:55:06 +0000 |
commit | fbd38c71c69185d816d2849b213e1e94c875019d (patch) | |
tree | f21429e702c92eb15b92e7c2e97d285c06af0acd /src | |
parent | 72172bdd5d18886dc9c756ea3a9d915bdd0bda17 (diff) | |
download | openbsd-fbd38c71c69185d816d2849b213e1e94c875019d.tar.gz openbsd-fbd38c71c69185d816d2849b213e1e94c875019d.tar.bz2 openbsd-fbd38c71c69185d816d2849b213e1e94c875019d.zip |
Make it possible to not output warnings (errors causing aborts are always
output).
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/stdlib/malloc.3 | 6 | ||||
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3 index f5ab9d70d9..eb09eeedbc 100644 --- a/src/lib/libc/stdlib/malloc.3 +++ b/src/lib/libc/stdlib/malloc.3 | |||
@@ -33,7 +33,7 @@ | |||
33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 | .\" SUCH DAMAGE. | 34 | .\" SUCH DAMAGE. |
35 | .\" | 35 | .\" |
36 | .\" $OpenBSD: malloc.3,v 1.5 1997/05/31 08:47:55 tholo Exp $ | 36 | .\" $OpenBSD: malloc.3,v 1.6 1997/05/31 08:55:05 tholo Exp $ |
37 | .\" | 37 | .\" |
38 | .Dd August 27, 1996 | 38 | .Dd August 27, 1996 |
39 | .Dt MALLOC 3 | 39 | .Dt MALLOC 3 |
@@ -150,6 +150,10 @@ Currently junk is bytes of 0xd0, this is pronounced ``Duh'' :-) | |||
150 | ``hint'' pass a hint to the kernel about pages we don't use. If the | 150 | ``hint'' pass a hint to the kernel about pages we don't use. If the |
151 | machine is paging a lot this may help a bit. | 151 | machine is paging a lot this may help a bit. |
152 | 152 | ||
153 | .It N | ||
154 | Do not output warning messages when encountering possible corruption | ||
155 | or bad pointers. | ||
156 | |||
153 | .It R | 157 | .It R |
154 | ``realloc'' always reallocate when | 158 | ``realloc'' always reallocate when |
155 | .Fn realloc | 159 | .Fn realloc |
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 94525adfa5..e8c352ca43 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #if defined(LIBC_SCCS) && !defined(lint) | 10 | #if defined(LIBC_SCCS) && !defined(lint) |
11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.25 1997/05/31 08:47:56 tholo Exp $"; | 11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.26 1997/05/31 08:55:06 tholo Exp $"; |
12 | #endif /* LIBC_SCCS and not lint */ | 12 | #endif /* LIBC_SCCS and not lint */ |
13 | 13 | ||
14 | /* | 14 | /* |
@@ -219,6 +219,9 @@ static int suicide; | |||
219 | static int malloc_stats; | 219 | static int malloc_stats; |
220 | #endif | 220 | #endif |
221 | 221 | ||
222 | /* avoid outputting warnings? */ | ||
223 | static int malloc_silent; | ||
224 | |||
222 | /* always realloc ? */ | 225 | /* always realloc ? */ |
223 | static int malloc_realloc; | 226 | static int malloc_realloc; |
224 | 227 | ||
@@ -361,6 +364,8 @@ wrtwarning(p) | |||
361 | char *q = " warning: "; | 364 | char *q = " warning: "; |
362 | if (malloc_abort) | 365 | if (malloc_abort) |
363 | wrterror(p); | 366 | wrterror(p); |
367 | else if (malloc_silent) | ||
368 | return; | ||
364 | write(2, __progname, strlen(__progname)); | 369 | write(2, __progname, strlen(__progname)); |
365 | write(2, malloc_func, strlen(malloc_func)); | 370 | write(2, malloc_func, strlen(malloc_func)); |
366 | write(2, q, strlen(q)); | 371 | write(2, q, strlen(q)); |
@@ -514,6 +519,8 @@ malloc_init () | |||
514 | case 'R': malloc_realloc = 1; break; | 519 | case 'R': malloc_realloc = 1; break; |
515 | case 'j': malloc_junk = 0; break; | 520 | case 'j': malloc_junk = 0; break; |
516 | case 'J': malloc_junk = 1; break; | 521 | case 'J': malloc_junk = 1; break; |
522 | case 'n': malloc_silent = 0; break; | ||
523 | case 'N': malloc_silent = 1; break; | ||
517 | #ifdef __FreeBSD__ | 524 | #ifdef __FreeBSD__ |
518 | case 'u': malloc_utrace = 0; break; | 525 | case 'u': malloc_utrace = 0; break; |
519 | case 'U': malloc_utrace = 1; break; | 526 | case 'U': malloc_utrace = 1; break; |