Browse Source

Make it possible to not output warnings (errors causing aborts are always

output).
OPENBSD_2_2
tholo 27 years ago
parent
commit
85cb5df3cc
2 changed files with 13 additions and 2 deletions
  1. +5
    -1
      src/lib/libc/stdlib/malloc.3
  2. +8
    -1
      src/lib/libc/stdlib/malloc.c

+ 5
- 1
src/lib/libc/stdlib/malloc.3 View File

@ -33,7 +33,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" $OpenBSD: malloc.3,v 1.5 1997/05/31 08:47:55 tholo Exp $
.\" $OpenBSD: malloc.3,v 1.6 1997/05/31 08:55:05 tholo Exp $
.\" .\"
.Dd August 27, 1996 .Dd August 27, 1996
.Dt MALLOC 3 .Dt MALLOC 3
@ -150,6 +150,10 @@ Currently junk is bytes of 0xd0, this is pronounced ``Duh'' :-)
``hint'' pass a hint to the kernel about pages we don't use. If the ``hint'' pass a hint to the kernel about pages we don't use. If the
machine is paging a lot this may help a bit. machine is paging a lot this may help a bit.
.It N
Do not output warning messages when encountering possible corruption
or bad pointers.
.It R .It R
``realloc'' always reallocate when ``realloc'' always reallocate when
.Fn realloc .Fn realloc


+ 8
- 1
src/lib/libc/stdlib/malloc.c View File

@ -8,7 +8,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$OpenBSD: malloc.c,v 1.25 1997/05/31 08:47:56 tholo Exp $";
static char rcsid[] = "$OpenBSD: malloc.c,v 1.26 1997/05/31 08:55:06 tholo Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
/* /*
@ -219,6 +219,9 @@ static int suicide;
static int malloc_stats; static int malloc_stats;
#endif #endif
/* avoid outputting warnings? */
static int malloc_silent;
/* always realloc ? */ /* always realloc ? */
static int malloc_realloc; static int malloc_realloc;
@ -361,6 +364,8 @@ wrtwarning(p)
char *q = " warning: "; char *q = " warning: ";
if (malloc_abort) if (malloc_abort)
wrterror(p); wrterror(p);
else if (malloc_silent)
return;
write(2, __progname, strlen(__progname)); write(2, __progname, strlen(__progname));
write(2, malloc_func, strlen(malloc_func)); write(2, malloc_func, strlen(malloc_func));
write(2, q, strlen(q)); write(2, q, strlen(q));
@ -514,6 +519,8 @@ malloc_init ()
case 'R': malloc_realloc = 1; break; case 'R': malloc_realloc = 1; break;
case 'j': malloc_junk = 0; break; case 'j': malloc_junk = 0; break;
case 'J': malloc_junk = 1; break; case 'J': malloc_junk = 1; break;
case 'n': malloc_silent = 0; break;
case 'N': malloc_silent = 1; break;
#ifdef __FreeBSD__ #ifdef __FreeBSD__
case 'u': malloc_utrace = 0; break; case 'u': malloc_utrace = 0; break;
case 'U': malloc_utrace = 1; break; case 'U': malloc_utrace = 1; break;


Loading…
Cancel
Save