source: trunk/src/emx/include/InnoTekLIBC/logstrict.h@ 1461

Last change on this file since 1461 was 1457, checked in by bird, 21 years ago

Fixes and bzero.

  • Property cvs2svn:cvs-rev set to 1.6
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 20.6 KB
Line 
1/* $Id: logstrict.h 1457 2004-09-05 10:56:05Z bird $ */
2/** @file
3 *
4 * InnoTek LIBC - Debug Logging and Strict Checking Features.
5 *
6 * InnoTek Systemberatung GmbH
7 *
8 * Copyright (c) 2004 InnoTek Systemberatung GmbH
9 * Author: knut st. osmundsen <[email protected]>
10 *
11 * All Rights Reserved
12 *
13 */
14
15#ifndef __InnoTekLIBC_LOG_H__
16#define __InnoTekLIBC_LOG_H__
17
18/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#include <sys/cdefs.h>
22#include <sys/types.h> /* size_t */
23#include <sys/param.h> /* NULL */
24
25/** @defgroup __libc_log Debug Logging and Strict Checking Features
26 *
27 * The logging feature is not accessible unless DEBUG_LOGGING is #defined.
28 *
29 * The strict checking feature is not accessible unless __LIBC_STRICT is #defined.
30 *
31 * The user of this feature must #define __LIBC_LOG_GROUP to a valid group
32 * number before including this file.
33 *
34 * The user may also #define __LIBC_LOG_INSTANCE if it doesn't want to use
35 * the default logging device.
36 *
37 * Note that all everything but the main logger & strict macros are using the
38 * default prefix to avoid too much namespace pollution. The main logger and
39 * strict macros are not prefixed with the double underscore because that
40 * would make the code less readable (and mean more typing which is painful).
41 *
42 * @{
43 */
44
45
46/*******************************************************************************
47* Defined Constants And Macros *
48*******************************************************************************/
49/**
50 * The user may also #define __LIBC_LOG_INSTANCE if it doesn't want to use
51 * the default logging device.
52 */
53#ifndef __LIBC_LOG_INSTANCE
54#define __LIBC_LOG_INSTANCE NULL
55#endif
56
57
58/**
59 * The user of this feature must #define __LIBC_LOG_GROUP to a valid group
60 * number before including this file.
61 */
62#ifndef __LIBC_LOG_GROUP
63#define __LIBC_LOG_GROUP 0
64#error "__LIBC_LOG_GROUP must be defined before including InnoTekLIBC/log.h"
65#endif
66
67
68/** Macro to, in release mode too, log a generic message within a function. */
69#define LIBCLOG_REL(...) \
70 __libc_LogMsg(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
71
72
73/** Macro to log a function entry. */
74#ifdef DEBUG_LOGGING
75#define LIBCLOG_ENTER(...) \
76 unsigned __libclog_uEnterTS__ = __libc_LogEnter(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
77#else
78#define LIBCLOG_ENTER(...) //hmm
79#endif
80
81/** Macro to log a generic message within a function entered by LIBCLOG_ENTER(). */
82#ifdef DEBUG_LOGGING
83#define LIBCLOG_MSG(...) \
84 __libc_LogMsg(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
85#else
86#define LIBCLOG_MSG(...) do {} while (0)
87#endif
88
89/** Macro to log a generic message within a functionw. */
90#ifdef DEBUG_LOGGING
91#define LIBCLOG_MSG2(...) \
92 __libc_LogMsg(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
93#else
94#define LIBCLOG_MSG2(...) do {} while (0)
95#endif
96
97/** Macro to log a raw message. */
98#ifdef DEBUG_LOGGING
99#define LIBCLOG_RAW(string, maxlen) \
100 __libc_LogRaw(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, string, maxlen)
101#else
102#define LIBCLOG_RAW(...) do {} while (0)
103#endif
104
105/** Macro to log a function exit. */
106#ifdef DEBUG_LOGGING
107#define LIBCLOG_LEAVE(...) \
108 __libc_LogLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
109#else
110#define LIBCLOG_LEAVE(...) do {} while (0)
111#endif
112
113/** Macro to log a custom message and return. */
114#define LIBCLOG_RETURN_MSG(rc,...) do { LIBCLOG_LEAVE(__VA_ARGS__); return (rc); } while (0)
115/** Macro to log a custom message and return. */
116#define LIBCLOG_RETURN_MSG_VOID(...) do { LIBCLOG_LEAVE(__VA_ARGS__); return; } while (0)
117
118/** Macro to log a void return and do the return. */
119#define LIBCLOG_RETURN_VOID() LIBCLOG_RETURN_MSG_VOID( "ret void\n")
120/** Macro to log an int return and do the return. */
121#define LIBCLOG_RETURN_INT(rc) LIBCLOG_RETURN_MSG((rc), "ret %d (%#x)\n", (rc), (rc))
122/** Macro to log an unsigned int return and do the return. */
123#define LIBCLOG_RETURN_UINT(rc) LIBCLOG_RETURN_MSG((rc), "ret %u (%#x)\n", (rc), (rc));
124/** Macro to log an long int return and do the return. */
125#define LIBCLOG_RETURN_LONG(rc) LIBCLOG_RETURN_MSG((rc), "ret %ld (%#lx)\n", (rc), (rc));
126/** Macro to log an unsigned long int return and do the return. */
127#define LIBCLOG_RETURN_ULONG(rc) LIBCLOG_RETURN_MSG((rc), "ret %lu (%#lx)\n", (rc), (rc));
128/** Macro to log a pointer return and do the return. */
129#define LIBCLOG_RETURN_P(rc) LIBCLOG_RETURN_MSG((rc), "ret %p\n", (void*)(rc));
130
131/** @defgroup __libc_log_flags Message Flags (to be combined with group)
132 *
133 * In source files which uses the logger you can or these flags together
134 * with a group specification in the __LIBC_LOG_GROUP #define.
135 * @{
136 */
137/** Forces a flush of the output file after the message have been written. */
138#define __LIBC_LOG_MSGF_FLUSH 0x00010000
139/** @} */
140
141
142/** @defgroup __libc_log_groups Default Logging Groups
143*
144 * In source files which uses the default logger you must #define
145 * __LIBC_LOG_GROUP to one of these defines.
146 *
147 * @{
148 */
149/** whatever. */
150#define __LIBC_LOG_GRP_NOGROUP 0
151
152/*-- LIBC --*/
153/** Process APIs. */
154#define __LIBC_LOG_GRP_PROCESS 1
155/** Heap APIs. */
156#define __LIBC_LOG_GRP_HEAP 2
157/** File stream APIs. */
158#define __LIBC_LOG_GRP_STREAM 3
159/** Other I/O APIs. */
160#define __LIBC_LOG_GRP_IO 4
161/** String APIs. */
162#define __LIBC_LOG_GRP_STRING 5
163/** Locale APIs. */
164#define __LIBC_LOG_GRP_LOCALE 6
165/** Regular expression APIs. */
166#define __LIBC_LOG_GRP_REGEX 7
167/** Math APIs. */
168#define __LIBC_LOG_GRP_MATH 8
169/** Time APIs. */
170#define __LIBC_LOG_GRP_TIME 9
171/** BSD DB APIs. */
172#define __LIBC_LOG_GRP_BSD_DB 10
173/** GLIBC POSIX APIs. */
174#define __LIBC_LOG_GRP_GLIBC_POSIX 11
175/** Thread APIs. */
176#define __LIBC_LOG_GRP_THREAD 12
177/** Mutex Semaphores. */
178#define __LIBC_LOG_GRP_MUTEX 13
179/** Signal APIs and events. */
180#define __LIBC_LOG_GRP_SIGNAL 14
181/** Environment APIs. */
182#define __LIBC_LOG_GRP_ENV 15
183
184/** Shared Process Database and LIBC Shared Memory APIs. */
185#define __LIBC_LOG_GRP_SPM 24
186/** Fork APIs. */
187#define __LIBC_LOG_GRP_FORK 25
188/** Backend IO APIs. */
189#define __LIBC_LOG_GRP_BACK_IO 26
190/** Init/Term APIs and Events. */
191#define __LIBC_LOG_GRP_INITTERM 27
192/** Backend APIs. */
193#define __LIBC_LOG_GRP_BACKEND 28
194/** Misc APIs. */
195#define __LIBC_LOG_GRP_MISC 29
196/** BSD Gen APIs. */
197#define __LIBC_LOG_GRP_BSD_GEN 30
198/** GLIBC Misc APIs. */
199#define __LIBC_LOG_GRP_GLIBC_MISC 31
200
201/*-- other libraries/APIs --*/
202/** Socket APIs. */
203#define __LIBC_LOG_GRP_SOCKET 32
204/** Other TCP/IP APIs. */
205#define __LIBC_LOG_GRP_TCPIP 33
206/** iconv APIs. */
207#define __LIBC_LOG_GRP_ICONV 34
208/** Dynamic Library (libdl) APIs. */
209#define __LIBC_LOG_GRP_DLFCN 35
210/** Posix thread APIs. */
211#define __LIBC_LOG_GRP_PTHREAD 36
212/** Posix thread APIs. */
213#define __LIBC_LOG_GRP_DOSEX 37
214
215/** @todo complete this */
216#define __LIBC_LOG_GRP_MAX 37
217/** @} */
218
219
220/** @defgroup __libc_log_strict Strict Assertions
221 * @{ */
222
223/** Generic assertion.
224 * @param expr Boolean expression,
225 */
226#ifdef __LIBC_STRICT
227#define LIBC_ASSERT(expr) ((expr) ? (void)0 \
228 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #expr, NULL))
229#else
230#define LIBC_ASSERT(expr) ((void)0)
231#endif
232
233/** Generic assertion failed.
234 * (Yeah, this always fails.)
235 */
236#ifdef __LIBC_STRICT
237#define LIBC_ASSERT_FAILED() __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, "0", NULL)
238#else
239#define LIBC_ASSERT_FAILED() ((void)0)
240#endif
241
242/** Assert that a memory buffer is readable.
243 * @param pv Pointer to buffer.
244 * @param cb Size of buffer.
245 */
246#ifdef __LIBC_STRICT
247#define LIBC_ASSERT_MEM_R(pv, cb) (__libc_StrictMemoryR((pv), (cb)) ? (void)0 \
248 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
249 "Memory buffer at %p of %d bytes isn't readable!\n", (pv), (cb)))
250#else
251#define LIBC_ASSERT_MEM_R(pv, cb) ((void)0)
252#endif
253
254/** Assert that a memory buffer is readable and writable.
255 * @param pv Pointer to buffer.
256 * @param cb Size of buffer.
257 */
258#ifdef __LIBC_STRICT
259#define LIBC_ASSERT_MEM_RW(pv, cb) (__libc_StrictMemoryRW((pv), (cb)) ? (void)0 \
260 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
261 "Memory buffer at %p of %d bytes isn't readable and writable!\n", (pv), (cb)))
262#else
263#define LIBC_ASSERT_MEM_RW(pv, cb) ((void)0)
264#endif
265
266/** Assert that a zero terminated string is readable.
267 * @param psz Pointer to buffer.
268 */
269#ifdef __LIBC_STRICT
270#define LIBC_ASSERT_STR(psz) (__libc_StrictStringR((psz), ~0) ? (void)0 \
271 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz, \
272 "String at %p isn't readable!\n", (psz)))
273#else
274#define LIBC_ASSERT_STR(psz) ((void)0)
275#endif
276
277/** Assert that a zero terminated string with a maximum lenght is readable.
278 * @param psz Pointer to buffer.
279 * @param cchMax Max string length.
280 */
281#ifdef __LIBC_STRICT
282#define LIBC_ASSERT_NSTR(psz, cchMax) (__libc_StrictStringR((psz), cchMax) ? (void)0 \
283 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz " " #cchMax, \
284 "String at %p of maximum %d bytes isn't readable!\n", (psz), (cchMax)))
285#else
286#define LIBC_ASSERT_NSTR(psz, cchMax) ((void)0)
287#endif
288
289
290/** Generic assertion, custom message.
291 * @param expr Boolean expression,
292 * @param ... Custom error message.
293 */
294#ifdef __LIBC_STRICT
295#define LIBC_ASSERTM(expr, ...) ((expr) ? (void)0 \
296 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #expr, \
297 __VA_ARGS__))
298#else
299#define LIBC_ASSERTM(expr, ...) ((void)0)
300#endif
301
302/** Generic assertion failed, custom message.
303 * (Yeah, this always fails.)
304 * @param ... Custom error message.
305 */
306#ifdef __LIBC_STRICT
307#define LIBC_ASSERTM_FAILED(...) __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, "0", __VA_ARGS__)
308#else
309#define LIBC_ASSERTM_FAILED(...) ((void)0)
310#endif
311
312/** Assert that a memory buffer is readable, custom message
313 * @param pv Pointer to buffer.
314 * @param cb Size of buffer.
315 */
316#ifdef __LIBC_STRICT
317#define LIBC_ASSERTM_MEM_R(pv, cb, ...) (__libc_StrictMemoryR((pv), (cb)) ? (void)0 \
318 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
319 __VA_ARGS__))
320#else
321#define LIBC_ASSERTM_MEM_R(pv, cb, ...) ((void)0)
322#endif
323
324/** Assert that a memory buffer is readable and writable, custom message
325 * @param pv Pointer to buffer.
326 * @param cb Size of buffer.
327 */
328#ifdef __LIBC_STRICT
329#define LIBC_ASSERTM_MEM_RW(pv, cb, ...) (__libc_StrictMemoryRW((pv), (cb)) ? (void)0 \
330 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
331 __VA_ARGS__))
332#else
333#define LIBC_ASSERTM_MEM_RW(pv, cb, ...) ((void)0)
334#endif
335
336/** Assert that a zero terminated string is readable, custom message
337 * @param psz Pointer to buffer.
338 */
339#ifdef __LIBC_STRICT
340#define LIBC_ASSERTM_STR(psz, ...) (__libc_StrictStringR((psz), ~0) ? (void)0 \
341 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz, \
342 __VA_ARGS__))
343#else
344#define LIBC_ASSERTM_STR(psz, ...) ((void)0)
345#endif
346
347/** Assert that a zero terminated string with a maximum lenght is readable, custom message
348 * @param psz Pointer to buffer.
349 * @param cchMax Max string length.
350 */
351#ifdef __LIBC_STRICT
352#define LIBC_ASSERTM_NSTR(psz, cchMax, ...) (__libc_StrictStringR((psz), cchMax) ? (void)0 \
353 : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz " " #cchMax, \
354 __VA_ARGS__))
355#else
356#define LIBC_ASSERTM_NSTR(psz, cchMax, ...) ((void)0)
357#endif
358
359/** Extracts the group from the fGroupAndFlags argument. */
360#define __LIBC_LOG_GETGROUP(fGroupAndFlags) ((fGroupAndFlags) & 0xffff)
361
362/** @} */
363
364
365/*******************************************************************************
366* Structures and Typedefs *
367*******************************************************************************/
368/** Logging group. */
369typedef struct __libc_log_group
370{
371 /** Set if logging for the group is enabled, clear if it's disabled. */
372 int fEnabled;
373 /** Group name */
374 const char * pszGroupName;
375} __LIBC_LOGGROUP, *__LIBC_PLOGGROUP;
376
377/** Ordered collection of logging groups. */
378typedef struct __libc_log_groups
379{
380 /** Group index base. This value is subtracted from the group part of the
381 * fFlagsAndGroups arguments to make an index into paGroups. */
382 unsigned uBase;
383 /** Number of groups in the array. */
384 unsigned cGroups;
385 /** Array of log groups. */
386 __LIBC_PLOGGROUP paGroups;
387} __LIBC_LOGGROUPS, *__LIBC_PLOGGROUPS;
388
389
390/*******************************************************************************
391* External Functions *
392*******************************************************************************/
393__BEGIN_DECLS
394/**
395 * Create a logger.
396 *
397 * @returns Pointer to a logger instance on success.
398 * @returns NULL on failure. errno is set.
399 * @param fFlags Flags reserved for future use. Set to zero.
400 * @param pGroups Pointer to a table of logging groups used for this
401 * logger instance.
402 * @param pszFilenameFormat Format string for making up the log filename.
403 * @param ... Arguments to the format string.
404 */
405extern void *__libc_LogInit(unsigned fFlags, __LIBC_PLOGGROUPS pGroups, const char *pszFilenameFormat, ...) __printflike(3, 4);
406
407/**
408 * Parses the given environment variable and sets the group
409 * flags accordingly.
410 *
411 * The environment variable is a sequence of group idendifiers with
412 * a prefix which determins whether or not that group is enabled.
413 * A special group 'all' can be used to address all groups.
414 *
415 * If the environment variable is not present no changes will be
416 * performed.
417 *
418 * @param pGroups Pointer to groups to init.
419 * @param pszEnvVar Name of the environment variable.
420 * This is taken from the initial environment of the process
421 * and not from the current!!
422 */
423extern void __libc_LogGroupInit(__LIBC_PLOGGROUPS pGroups, const char *pszEnvVar);
424
425/**
426 * Terminate (or close if you like) a logger instance.
427 * This means flushing any buffered messages and writing a termination
428 * message before closing the log file.
429 *
430 * @returns 0 on succes.
431 * @returns -1 on failure, error is set.
432 * @param pvInstance Logger instance.
433 */
434extern int __libc_LogTerm(void *pvInstance);
435
436/**
437 * Output an enter function log message.
438 * An enter message is considered to be one line and is appended a newline if
439 * none was given.
440 *
441 * @returns Current timestamp.
442 * @param pvInstance Logger instance. If NULL the message goes to the
443 * default log instance.
444 * @param fGroupAndFlags Logging group and logging flags.
445 * @param pszFunction Name of the function which was entered.
446 * @param pszFormat Format string to display arguments.
447 * @param ... Arguments to the format string.
448 */
449extern unsigned __libc_LogEnter(void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...) __printflike(4, 5);
450
451/**
452 * Output a leave function log message.
453 * A leave message is considered to be one line and is appended a newline if
454 * none was given.
455 *
456 * @param uEnterTS The timestamp returned by LogEnter.
457 * @param pvInstance Logger instance. If NULL the message goes to the
458 * default log instance.
459 * @param fGroupAndFlags Logging group and logging flags.
460 * @param pszFunction Name of the function which was entered.
461 * @param pszFormat Format string to display the result.
462 * @param ... Arguments to the format string.
463 */
464extern void __libc_LogLeave(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...) __printflike(5, 6);
465
466/**
467 * Output a log message.
468 * A log message is considered to be one line and is appended a newline if
469 * none was given.
470 *
471 * @param uEnterTS The timestamp returned by LogEnter.
472 * @param pvInstance Logger instance. If NULL the message goes to the
473 * default log instance.
474 * @param fGroupAndFlags Logging group and logging flags.
475 * @param pszFunction Name of the function which was entered.
476 * @param pszFormat Format string for the message to log.
477 * @param ... Arguments to the format string.
478 */
479extern void __libc_LogMsg(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, const char *pszFormat, ...) __printflike(5, 6);
480
481/**
482 * Output a raw log message.
483 * Nothing is prepended. No newline is appended.
484 *
485 * @param uEnterTS The timestamp returned by LogEnter.
486 * @param pvInstance Logger instance. If NULL the message goes to the
487 * default log instance.
488 * @param fGroupAndFlags Logging group and logging flags.
489 * @param pszFunction Name of the function which was entered.
490 * @param pszString Pointer to raw log message.
491 * @param cchMax Maximum number of bytes to write.
492 */
493extern void __libc_LogRaw(void *pvInstance, unsigned fGroupAndFlags, const char *pszString, unsigned cchMax);
494
495/**
496 * Dumps a byte block.
497 *
498 * @param uEnterTS The timestamp returned by LogEnter.
499 * @param pvInstance Logger instance. If NULL the message goes to the
500 * default log instance.
501 * @param fGroupAndFlags Logging group and logging flags.
502 * @param pszFunction Name of the function which was entered.
503 * @param pvData Pointer to the bytes to dump.
504 * @param cbData Number of bytes to dump.
505 * @param pszFormat Format string for the message to log.
506 * @param ... Arguments to the format string.
507 */
508extern void __libc_LogDumpHex(unsigned uEnterTS, void *pvInstance, unsigned fGroupAndFlags, const char *pszFunction, void *pvData, unsigned cbData, const char *pszFormat, ...);
509
510/**
511 * Assertion helper.
512 * Logs and displays (stderr) an assertion failed message.
513 *
514 * @param pvInstance Logger instance. If NULL the message goes to the
515 * default log instance.
516 * @param pszFunction Name of the function which was entered.
517 * @param pszFile Source filename.
518 * @param uLine Line number.
519 * @param pszExpression Expression.
520 * @param pszFormat Format string for the message to log.
521 * @param ... Arguments to the format string.
522 */
523extern void __libc_LogAssert(void *pvInstance, unsigned fGroupAndFlags,
524 const char *pszFunction, const char *pszFile, unsigned uLine, const char *pszExpression,
525 const char *pszFormat, ...) __printflike(7, 8);
526
527/**
528 * Validate a memory area for read access.
529 * @returns 1 if readable.
530 * @returns 0 if not entirely readable.
531 * @param pv Pointer to memory area.
532 * @param cb Size of memory area.
533 */
534extern int __libc_StrictMemoryR(const void *pv, size_t cb);
535
536/**
537 * Validate a memory area for read & write access.
538 * @returns 1 if readable and writable.
539 * @returns 0 if not entirely readable and writable.
540 * @param pv Pointer to memory area.
541 * @param cb Size of memory area.
542 */
543extern int __libc_StrictMemoryRW(void *pv, size_t cb);
544
545/**
546 * Validate a zero terminated string for read access.
547 * @returns 1 if readable.
548 * @returns 0 if not entirely readable.
549 * @param psz Pointer to string.
550 * @param cchMax Max string length. Use ~0 if to very all the
551 * way to the terminator.
552 */
553extern int __libc_StrictStringR(const char *psz, size_t cchMax);
554
555__END_DECLS
556
557/** @} */
558
559#endif
Note: See TracBrowser for help on using the repository browser.