hjl / source-git / glibc

Forked from source-git/glibc 3 years ago
Clone

Blame malloc/mcheck.h

Packit 6c4009
/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _MCHECK_H
Packit 6c4009
#define _MCHECK_H       1
Packit 6c4009
Packit 6c4009
#include <features.h>
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
Packit 6c4009
/* Return values for `mprobe': these are the kinds of inconsistencies that
Packit 6c4009
   `mcheck' enables detection of.  */
Packit 6c4009
enum mcheck_status
Packit 6c4009
{
Packit 6c4009
  MCHECK_DISABLED = -1,         /* Consistency checking is not turned on.  */
Packit 6c4009
  MCHECK_OK,                    /* Block is fine.  */
Packit 6c4009
  MCHECK_FREE,                  /* Block freed twice.  */
Packit 6c4009
  MCHECK_HEAD,                  /* Memory before the block was clobbered.  */
Packit 6c4009
  MCHECK_TAIL                   /* Memory after the block was clobbered.  */
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Activate a standard collection of debugging hooks.  This must be called
Packit 6c4009
   before `malloc' is ever called.  ABORTFUNC is called with an error code
Packit 6c4009
   (see enum above) when an inconsistency is detected.  If ABORTFUNC is
Packit 6c4009
   null, the standard function prints on stderr and then calls `abort'.  */
Packit 6c4009
extern int mcheck (void (*__abortfunc)(enum mcheck_status)) __THROW;
Packit 6c4009
Packit 6c4009
/* Similar to `mcheck' but performs checks for all block whenever one of
Packit 6c4009
   the memory handling functions is called.  This can be very slow.  */
Packit 6c4009
extern int mcheck_pedantic (void (*__abortfunc)(enum mcheck_status)) __THROW;
Packit 6c4009
Packit 6c4009
/* Force check of all blocks now.  */
Packit 6c4009
extern void mcheck_check_all (void);
Packit 6c4009
Packit 6c4009
/* Check for aberrations in a particular malloc'd block.  You must have
Packit 6c4009
   called `mcheck' already.  These are the same checks that `mcheck' does
Packit 6c4009
   when you free or reallocate a block.  */
Packit 6c4009
extern enum mcheck_status mprobe (void *__ptr) __THROW;
Packit 6c4009
Packit 6c4009
/* Activate a standard collection of tracing hooks.  */
Packit 6c4009
extern void mtrace (void) __THROW;
Packit 6c4009
extern void muntrace (void) __THROW;
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
#endif /* mcheck.h */