Merge from vendor branch OPENSSL:
[dragonfly.git] / contrib / libpam / libpam / include / security / pam_malloc.h
1 /* $Id: pam_malloc.h,v 1.1 1996/11/10 21:23:14 morgan Exp $
2  * $FreeBSD: src/contrib/libpam/libpam/include/security/pam_malloc.h,v 1.1.1.1.6.2 2001/06/11 15:28:14 markm Exp $
3  * $DragonFly: src/contrib/libpam/libpam/include/security/Attic/pam_malloc.h,v 1.2 2003/06/17 04:24:03 dillon Exp $
4  *
5  * $Log: pam_malloc.h,v $
6  * Revision 1.1  1996/11/10 21:23:14  morgan
7  * Initial revision
8  *
9  */
10
11 /*
12  * This file (via the use of macros) defines a wrapper for the malloc
13  * family of calls. It logs where the memory was requested and also
14  * where it was free()'d and keeps a list of currently requested memory.
15  *
16  * It is hoped that it will provide some help in locating memory leaks.
17  */
18
19 #ifndef PAM_MALLOC_H
20 #define PAM_MALLOC_H
21
22 /* these are the macro definitions for the stdlib.h memory functions */
23
24 #define malloc(s)      pam_malloc(s,__FILE__,__FUNCTION__,__LINE__)
25 #define calloc(n,s)    pam_calloc(n,s,__FILE__,__FUNCTION__,__LINE__)
26 #define free(x)        pam_free(x,__FILE__,__FUNCTION__,__LINE__)
27 /* #define memalign(a,s)  pam_memalign(a,s,__FILE__,__FUNCTION__,__LINE__) */
28 #define realloc(x,s)   pam_realloc(x,s,__FILE__,__FUNCTION__,__LINE__)
29 /* #define valloc(s)      pam_valloc(s,__FILE__,__FUNCTION__,__LINE__) */
30 /* #define alloca(s)      pam_alloca(s,__FILE__,__FUNCTION__,__LINE__) */
31 #define exit(i)        pam_exit(i,__FILE__,__FUNCTION__,__LINE__)
32
33 /* these are the prototypes for the wrapper functions */
34
35 #include <sys/types.h>
36
37 extern void *pam_malloc(size_t s,const char *,const char *,const int);
38 extern void *pam_calloc(size_t n,size_t s,const char *,const char *,const int);
39 extern void  pam_free(void *x,const char *,const char *,const int);
40 extern void *pam_memalign(size_t a,size_t s
41                          ,const char *,const char *,const int);
42 extern void *pam_realloc(void *x,size_t s,const char *,const char *,const int);
43 extern void *pam_valloc(size_t s,const char *,const char *,const int);
44 extern void *pam_alloca(size_t s,const char *,const char *,const int);
45 extern void  pam_exit(int i,const char *,const char *,const int);
46
47 /* these are the flags used to turn on and off diagnostics */
48
49 #define PAM_MALLOC_LEAKED             01
50 #define PAM_MALLOC_REQUEST            02
51 #define PAM_MALLOC_FREE               04
52 #define PAM_MALLOC_EXCH               (PAM_MALLOC_FREED|PAM_MALLOC_EXCH)
53 #define PAM_MALLOC_RESIZE            010
54 #define PAM_MALLOC_FAIL              020
55 #define PAM_MALLOC_NULL              040
56 #define PAM_MALLOC_VERIFY           0100
57 #define PAM_MALLOC_FUNC             0200
58 #define PAM_MALLOC_PAUSE            0400
59 #define PAM_MALLOC_STOP            01000
60
61 #define PAM_MALLOC_ALL              0777
62
63 #define PAM_MALLOC_DEFAULT     \
64   (PAM_MALLOC_LEAKED|PAM_MALLOC_PAUSE|PAM_MALLOC_FAIL)
65
66 #include <stdio.h>
67
68 extern FILE *pam_malloc_outfile;      /* defaults to stdout */
69
70 /* how much output do you want? */
71
72 extern int pam_malloc_flags;
73 extern int pam_malloc_delay_length;      /* how long to pause on errors */
74
75 #endif /* PAM_MALLOC_H */