File: error.h

package info (click to toggle)
dmalloc 5.5.2-6
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,912 kB
  • ctags: 2,276
  • sloc: ansic: 13,011; makefile: 427; perl: 175; sh: 173; cpp: 36
file content (241 lines) | stat: -rw-r--r-- 4,868 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/*
 * Defines for the error and message code.
 *
 * Copyright 2000 by Gray Watson
 *
 * This file is part of the dmalloc package.
 *
 * Permission to use, copy, modify, and distribute this software for
 * any purpose and without fee is hereby granted, provided that the
 * above copyright notice and this permission notice appear in all
 * copies, and that the name of Gray Watson not be used in advertising
 * or publicity pertaining to distribution of the document or software
 * without specific, written prior permission.
 *
 * Gray Watson makes no representations about the suitability of the
 * software described herein for any purpose.  It is provided "as is"
 * without express or implied warranty.
 *
 * The author may be contacted via http://dmalloc.com/
 *
 * $Id: error.h,v 1.53 2003/06/18 21:57:52 gray Exp $
 */

#ifndef __ERROR_H__
#define __ERROR_H__

#include <stdarg.h>				/* for ... */

#include "conf.h"				/* up here for _INCLUDE */

/* for time type -- see settings.h */
#if STORE_TIME
#ifdef TIME_INCLUDE
#include TIME_INCLUDE
#endif
#endif

/* for timeval type -- see settings.h */
#if STORE_TIMEVAL
#ifdef TIMEVAL_INCLUDE
#include TIMEVAL_INCLUDE
#endif
#endif

/*<<<<<<<<<<  The below prototypes are auto-generated by fillproto */

/* address to look for.  when discovered call dmalloc_error() */
extern
DMALLOC_PNT	_dmalloc_address;

/* when to stop at an address */
extern
unsigned long	_dmalloc_address_seen_n;

/* global debug flags that are set my DMALLOC_DEBUG environ variable */
extern
unsigned int	_dmalloc_flags;

/* global iteration counter for activities */
extern
unsigned long	_dmalloc_iter_c;

/* how often to check the heap */
extern
unsigned long	_dmalloc_check_interval;

#if LOG_PNT_TIMEVAL
/* overhead information storing when the library started up for elapsed time */
extern
TIMEVAL_TYPE	_dmalloc_start;
#endif /* if LOG_PNT_TIMEVAL */

#if LOG_PNT_TIMEVAL == 0
#if HAVE_TIME
/* NOTE: we do the ifdef this way for fillproto */
extern
TIME_TYPE	_dmalloc_start;
#endif /* if HAVE_TIME */
#endif /* if LOG_PNT_TIMEVAL == 0 */

/* when we are going to startup our locking subsystem */
extern
int		_dmalloc_lock_on;

/* global flag which indicates when we are aborting */
extern
int		_dmalloc_aborting_b;

/*
 * void _dmalloc_open_log
 *
 * DESCRIPTION:
 *
 * Open up our log file and write some version of settings
 * information.
 *
 * RETURNS:
 *
 * None.
 *
 * ARGUMENTS:
 *
 * None.
 */
extern
void	_dmalloc_open_log(void);

/*
 * void _dmalloc_reopen_log
 *
 * DESCRIPTION:
 *
 * Re-open our log file which basically calls close() on the
 * logfile-fd.  If we change the name of the log-file then we will
 * re-open the file.
 *
 * RETURNS:
 *
 * None.
 *
 * ARGUMENTS:
 *
 * None.
 */
extern
void	_dmalloc_reopen_log(void);

#if LOG_PNT_TIMEVAL
/*
 * char *_dmalloc_ptimeval
 *
 * DESCRIPTION:
 *
 * Print the time into local buffer.
 *
 * RETURNS:
 *
 * Poiner to the buf argument.
 *
 * ARGUMENTS:
 *
 * timeval_p -> Pointer to a time value.
 *
 * buf -> Internal buffer into which we are writing the time.
 *
 * buf_size -> Size of the buffer.
 *
 * elapsed_b -> Set to 1 to dump the elapsed instead of global time.
 */
extern
char	*_dmalloc_ptimeval(const TIMEVAL_TYPE *timeval_p, char *buf,
			   const int buf_size, const int elapsed_b);
#endif /* if LOG_PNT_TIMEVAL */

#if LOG_PNT_TIMEVAL == 0 && HAVE_TIME
/*
 * char *_dmalloc_ptime
 *
 * DESCRIPTION:
 *
 * Print the time into local buffer.
 *
 * RETURNS:
 *
 * Poiner to the buf argument.
 *
 * ARGUMENTS:
 *
 * time_p -> Pointer to a time value.
 *
 * buf -> Internal buffer into which we are writing the time.
 *
 * buf_size -> Size of the buffer.
 *
 * elapsed_b -> Set to 1 to dump the elapsed instead of global time.
 */
extern
char	*_dmalloc_ptime(const TIME_TYPE *time_p, char *buf, const int buf_size,
			const int elapsed_b);
#endif /* if LOG_PNT_TIMEVAL == 0 && HAVE_TIME */

/*
 * void _dmalloc_vmessage
 *
 * DESCRIPTION:
 *
 * Message writer with vprintf like arguments which adds a line to the
 * dmalloc logfile.
 *
 * RETURNS:
 *
 * None.
 *
 * ARGUMENTS:
 *
 * format -> Printf-style format statement.
 *
 * args -> Already converted pointer to a stdarg list.
 */
extern
void	_dmalloc_vmessage(const char *format, va_list args);

/*
 * void _dmalloc_die
 *
 * DESCRIPTION:
 *
 * Kill the program because of an internal malloc error.
 *
 * RETURNS:
 *
 * None.
 *
 * ARGUMENTS:
 *
 * silent_b -> Set to 1 to not drop log entries.
 */
extern
void	_dmalloc_die(const int silent_b);

/*
 * void dmalloc_error
 *
 * DESCRIPTION:
 *
 * Handler of error codes.  The caller should have set the errno already
 *
 * RETURNS:
 *
 * None.
 *
 * ARGUMENTS:
 *
 * func -> Function name for the logs.
 */
extern
void	dmalloc_error(const char *func);

/*<<<<<<<<<<   This is end of the auto-generated output from fillproto. */

#endif /* ! __ERROR_H__ */