mirror of
https://github.com/jrbrtsn/ban2fail
synced 2024-06-16 11:58:01 +00:00
Changed address report format
This commit is contained in:
parent
f99812a97b
commit
71b6b1f97b
@ -92,7 +92,7 @@ struct Global G= {
|
|||||||
.version= {
|
.version= {
|
||||||
.major= 0,
|
.major= 0,
|
||||||
.minor= 13,
|
.minor= 13,
|
||||||
.patch= 9
|
.patch= 10
|
||||||
},
|
},
|
||||||
|
|
||||||
.bitTuples.flags= GlobalFlagBitTuples
|
.bitTuples.flags= GlobalFlagBitTuples
|
||||||
|
14
ez_es.c
14
ez_es.c
@ -5,9 +5,11 @@
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_ES_registerFd (
|
int _ez_ES_registerFd (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int fd,
|
int fd,
|
||||||
short events,
|
short events,
|
||||||
int (*callback_f)(void *ctxt, int fd, short events),
|
int (*callback_f)(void *ctxt, int fd, short events),
|
||||||
@ -29,9 +31,11 @@ int _ez_ES_registerFd (
|
|||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
int _ez_ES_registerSignal (
|
int _ez_ES_registerSignal (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int signum,
|
int signum,
|
||||||
int (*callback_f)(void *ctxt, int signo),
|
int (*callback_f)(void *ctxt, int signo),
|
||||||
void *ctxt
|
void *ctxt
|
||||||
@ -52,9 +56,11 @@ int _ez_ES_registerSignal (
|
|||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
|
||||||
int _ez_ES_registerVSignal (
|
int _ez_ES_registerVSignal (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int signum,
|
int signum,
|
||||||
int (*callback_f)(void *ctxt, int signo),
|
int (*callback_f)(void *ctxt, int signo),
|
||||||
void *ctxt
|
void *ctxt
|
||||||
@ -74,9 +80,11 @@ int _ez_ES_registerVSignal (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_ES_VSignal (
|
int _ez_ES_VSignal (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_t tid,
|
pthread_t tid,
|
||||||
int signum
|
int signum
|
||||||
)
|
)
|
||||||
@ -95,9 +103,11 @@ int _ez_ES_VSignal (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_ES_registerTimer (
|
int _ez_ES_registerTimer (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int64_t pause_ms,
|
int64_t pause_ms,
|
||||||
int64_t interval_ms,
|
int64_t interval_ms,
|
||||||
int (*callback_f)(void *ctxt),
|
int (*callback_f)(void *ctxt),
|
||||||
@ -118,9 +128,11 @@ int _ez_ES_registerTimer (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_ES_unregister (
|
int _ez_ES_unregister (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int key
|
int key
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -138,9 +150,11 @@ int _ez_ES_unregister (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_ES_run (
|
int _ez_ES_run (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName
|
const char *funcName
|
||||||
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int rtn= ES_run();
|
int rtn= ES_run();
|
||||||
|
49
ez_es.h
49
ez_es.h
@ -12,12 +12,19 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_ES_registerFd(fd, events, callback_f, ctxt) \
|
# define ez_ES_registerFd(fd, events, callback_f, ctxt) \
|
||||||
_ez_ES_registerFd(__FILE__, __LINE__, __FUNCTION__, fd, events, callback_f, ctxt)
|
_ez_ES_registerFd(__FILE__, __LINE__, __FUNCTION__, fd, events, callback_f, ctxt)
|
||||||
|
#else
|
||||||
|
# define ez_ES_registerFd(fd, events, callback_f, ctxt) \
|
||||||
|
_ez_ES_registerFd(fd, events, callback_f, ctxt)
|
||||||
|
#endif
|
||||||
int _ez_ES_registerFd (
|
int _ez_ES_registerFd (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int fd,
|
int fd,
|
||||||
short events,
|
short events,
|
||||||
int (*callback_f)(void *ctxt, int fd, short events),
|
int (*callback_f)(void *ctxt, int fd, short events),
|
||||||
@ -26,44 +33,72 @@ int _ez_ES_registerFd (
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_ES_registerSignal(signum, callback_f, ctxt) \
|
# define ez_ES_registerSignal(signum, callback_f, ctxt) \
|
||||||
_ez_ES_registerSignal(__FILE__, __LINE__, __FUNCTION__, signum, callback_f, ctxt)
|
_ez_ES_registerSignal(__FILE__, __LINE__, __FUNCTION__, signum, callback_f, ctxt)
|
||||||
|
#else
|
||||||
|
# define ez_ES_registerSignal(signum, callback_f, ctxt) \
|
||||||
|
_ez_ES_registerSignal(signum, callback_f, ctxt)
|
||||||
|
#endif
|
||||||
int _ez_ES_registerSignal (
|
int _ez_ES_registerSignal (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int signum,
|
int signum,
|
||||||
int (*callback_f)(void *ctxt, int signo),
|
int (*callback_f)(void *ctxt, int signo),
|
||||||
void *ctxt
|
void *ctxt
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_ES_registerVSignal(signum, callback_f, ctxt) \
|
# define ez_ES_registerVSignal(signum, callback_f, ctxt) \
|
||||||
_ez_ES_registerVSignal(__FILE__, __LINE__, __FUNCTION__, signum, callback_f, ctxt)
|
_ez_ES_registerVSignal(__FILE__, __LINE__, __FUNCTION__, signum, callback_f, ctxt)
|
||||||
|
#else
|
||||||
|
# define ez_ES_registerVSignal(signum, callback_f, ctxt) \
|
||||||
|
_ez_ES_registerVSignal(signum, callback_f, ctxt)
|
||||||
|
#endif
|
||||||
int _ez_ES_registerVSignal (
|
int _ez_ES_registerVSignal (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int signum,
|
int signum,
|
||||||
int (*callback_f)(void *ctxt, int signo),
|
int (*callback_f)(void *ctxt, int signo),
|
||||||
void *ctxt
|
void *ctxt
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_ES_VSignal(tid, signum) \
|
# define ez_ES_VSignal(tid, signum) \
|
||||||
_ez_ES_VSignal(__FILE__, __LINE__, __FUNCTION__, tid, signum)
|
_ez_ES_VSignal(__FILE__, __LINE__, __FUNCTION__, tid, signum)
|
||||||
|
#else
|
||||||
|
# define ez_ES_VSignal(tid, signum) \
|
||||||
|
_ez_ES_VSignal(tid, signum)
|
||||||
|
#endif
|
||||||
int _ez_ES_VSignal (
|
int _ez_ES_VSignal (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_t tid,
|
pthread_t tid,
|
||||||
int signum
|
int signum
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_ES_registerTimer(pause_ms, interval_ms, callback_f, ctxt) \
|
# define ez_ES_registerTimer(pause_ms, interval_ms, callback_f, ctxt) \
|
||||||
_ez_ES_registerTimer(__FILE__, __LINE__, __FUNCTION__, pause_ms, interval_ms, callback_f, ctxt)
|
_ez_ES_registerTimer(__FILE__, __LINE__, __FUNCTION__, pause_ms, interval_ms, callback_f, ctxt)
|
||||||
|
#else
|
||||||
|
# define ez_ES_registerTimer(pause_ms, interval_ms, callback_f, ctxt) \
|
||||||
|
_ez_ES_registerTimer(pause_ms, interval_ms, callback_f, ctxt)
|
||||||
|
#endif
|
||||||
int _ez_ES_registerTimer (
|
int _ez_ES_registerTimer (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int64_t pause_ms,
|
int64_t pause_ms,
|
||||||
int64_t interval_ms,
|
int64_t interval_ms,
|
||||||
int (*callback_f)(void *ctxt),
|
int (*callback_f)(void *ctxt),
|
||||||
@ -71,21 +106,35 @@ int _ez_ES_registerTimer (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_ES_unregister(key) \
|
# define ez_ES_unregister(key) \
|
||||||
{_ez_ES_unregister(__FILE__, __LINE__, __FUNCTION__, key); (key)= 0;}
|
{_ez_ES_unregister(__FILE__, __LINE__, __FUNCTION__, key); (key)= 0;}
|
||||||
|
#else
|
||||||
|
# define ez_ES_unregister(key) \
|
||||||
|
{_ez_ES_unregister(key); (key)= 0;}
|
||||||
|
#endif
|
||||||
int _ez_ES_unregister (
|
int _ez_ES_unregister (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int key
|
int key
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_ES_run() \
|
# define ez_ES_run() \
|
||||||
_ez_ES_run(__FILE__, __LINE__, __FUNCTION__)
|
_ez_ES_run(__FILE__, __LINE__, __FUNCTION__)
|
||||||
|
#else
|
||||||
|
# define ez_ES_run() \
|
||||||
|
_ez_ES_run()
|
||||||
|
#endif
|
||||||
int _ez_ES_run (
|
int _ez_ES_run (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName
|
const char *funcName
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -24,9 +24,11 @@
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_getaddrinfo_a(
|
int _ez_getaddrinfo_a(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int mode,
|
int mode,
|
||||||
struct gaicb *list[],
|
struct gaicb *list[],
|
||||||
int nitems,
|
int nitems,
|
||||||
@ -53,9 +55,11 @@ int _ez_getaddrinfo_a(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_gai_suspend(
|
int _ez_gai_suspend(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const struct gaicb * const list[],
|
const struct gaicb * const list[],
|
||||||
int nitems,
|
int nitems,
|
||||||
const struct timespec *timeout
|
const struct timespec *timeout
|
||||||
|
14
ez_libanl.h
14
ez_libanl.h
@ -27,24 +27,38 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_getaddrinfo_a(mode, list, nItems, sevp) \
|
# define ez_getaddrinfo_a(mode, list, nItems, sevp) \
|
||||||
_ez_getaddrinfo_a(__FILE__, __LINE__, __FUNCTION__, mode, list, nItems, sevp)
|
_ez_getaddrinfo_a(__FILE__, __LINE__, __FUNCTION__, mode, list, nItems, sevp)
|
||||||
|
#else
|
||||||
|
# define ez_getaddrinfo_a(mode, list, nItems, sevp) \
|
||||||
|
_ez_getaddrinfo_a(mode, list, nItems, sevp)
|
||||||
|
#endif
|
||||||
int _ez_getaddrinfo_a(
|
int _ez_getaddrinfo_a(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int mode,
|
int mode,
|
||||||
struct gaicb *list[],
|
struct gaicb *list[],
|
||||||
int nitems,
|
int nitems,
|
||||||
struct sigevent *sevp
|
struct sigevent *sevp
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_gai_suspend(list, nItems, timeout) \
|
# define ez_gai_suspend(list, nItems, timeout) \
|
||||||
_ez_gai_suspend(__FILE__, __LINE__, __FUNCTION__, list, nItems, timeout)
|
_ez_gai_suspend(__FILE__, __LINE__, __FUNCTION__, list, nItems, timeout)
|
||||||
|
#else
|
||||||
|
# define ez_gai_suspend(list, nItems, timeout) \
|
||||||
|
_ez_gai_suspend(list, nItems, timeout)
|
||||||
|
#endif
|
||||||
int _ez_gai_suspend(
|
int _ez_gai_suspend(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const struct gaicb * const list[],
|
const struct gaicb * const list[],
|
||||||
int nitems,
|
int nitems,
|
||||||
const struct timespec *timeout
|
const struct timespec *timeout
|
||||||
|
72
ez_libc.c
72
ez_libc.c
@ -26,9 +26,11 @@
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_fputs (
|
int _ez_fputs (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *s,
|
const char *s,
|
||||||
FILE *stream
|
FILE *stream
|
||||||
)
|
)
|
||||||
@ -47,9 +49,11 @@ int _ez_fputs (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_fputc (
|
int _ez_fputc (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int c,
|
int c,
|
||||||
FILE *stream
|
FILE *stream
|
||||||
)
|
)
|
||||||
@ -68,9 +72,11 @@ int _ez_fputc (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_fprintf (
|
int _ez_fprintf (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
FILE *stream,
|
FILE *stream,
|
||||||
const char *fmt,
|
const char *fmt,
|
||||||
...
|
...
|
||||||
@ -97,9 +103,11 @@ int _ez_fprintf (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
FILE* _ez_popen (
|
FILE* _ez_popen (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *command,
|
const char *command,
|
||||||
const char *type
|
const char *type
|
||||||
)
|
)
|
||||||
@ -119,9 +127,11 @@ FILE* _ez_popen (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
FILE* _ez_fopen (
|
FILE* _ez_fopen (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
const char *mode
|
const char *mode
|
||||||
)
|
)
|
||||||
@ -140,9 +150,11 @@ FILE* _ez_fopen (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_fclose (
|
int _ez_fclose (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
FILE *stream
|
FILE *stream
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -160,9 +172,11 @@ int _ez_fclose (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_fflush (
|
int _ez_fflush (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
FILE *stream
|
FILE *stream
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -180,9 +194,11 @@ int _ez_fflush (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
size_t _ez_fread (
|
size_t _ez_fread (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
void *ptr,
|
void *ptr,
|
||||||
size_t size,
|
size_t size,
|
||||||
size_t nmemb,
|
size_t nmemb,
|
||||||
@ -203,9 +219,11 @@ size_t _ez_fread (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
size_t _ez_fwrite (
|
size_t _ez_fwrite (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const void *ptr,
|
const void *ptr,
|
||||||
size_t size,
|
size_t size,
|
||||||
size_t nmemb,
|
size_t nmemb,
|
||||||
@ -226,9 +244,11 @@ size_t _ez_fwrite (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_pclose (
|
int _ez_pclose (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
FILE *stream
|
FILE *stream
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -246,9 +266,11 @@ int _ez_pclose (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
char* _ez_fgets (
|
char* _ez_fgets (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
char *s,
|
char *s,
|
||||||
int size,
|
int size,
|
||||||
FILE *stream
|
FILE *stream
|
||||||
@ -268,9 +290,11 @@ char* _ez_fgets (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_remove (
|
int _ez_remove (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname
|
const char *pathname
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -288,9 +312,11 @@ int _ez_remove (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_rename (
|
int _ez_rename (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *oldpath,
|
const char *oldpath,
|
||||||
const char *newpath
|
const char *newpath
|
||||||
)
|
)
|
||||||
@ -309,9 +335,11 @@ int _ez_rename (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
DIR* _ez_opendir (
|
DIR* _ez_opendir (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *name
|
const char *name
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -329,9 +357,11 @@ DIR* _ez_opendir (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_closedir (
|
int _ez_closedir (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DIR *dirp
|
DIR *dirp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -349,9 +379,11 @@ int _ez_closedir (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
struct dirent* _ez_readdir (
|
struct dirent* _ez_readdir (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DIR *dirp
|
DIR *dirp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -374,9 +406,11 @@ struct dirent* _ez_readdir (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_close (
|
int _ez_close (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int fd
|
int fd
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -394,9 +428,11 @@ int _ez_close (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
ssize_t _ez_write (
|
ssize_t _ez_write (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int fd,
|
int fd,
|
||||||
const void *buf,
|
const void *buf,
|
||||||
size_t count
|
size_t count
|
||||||
@ -416,9 +452,11 @@ ssize_t _ez_write (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_stat (
|
int _ez_stat (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
struct stat *statbuf
|
struct stat *statbuf
|
||||||
)
|
)
|
||||||
@ -437,9 +475,11 @@ int _ez_stat (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_mkdir (
|
int _ez_mkdir (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
mode_t mode
|
mode_t mode
|
||||||
)
|
)
|
||||||
@ -458,9 +498,11 @@ int _ez_mkdir (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_rmdir (
|
int _ez_rmdir (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname
|
const char *pathname
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -478,9 +520,11 @@ int _ez_rmdir (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_unlink (
|
int _ez_unlink (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname
|
const char *pathname
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -498,9 +542,11 @@ int _ez_unlink (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_getaddrinfo(
|
int _ez_getaddrinfo(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *node,
|
const char *node,
|
||||||
const char *service,
|
const char *service,
|
||||||
const struct addrinfo *hints,
|
const struct addrinfo *hints,
|
||||||
@ -538,9 +584,11 @@ int _ez_getaddrinfo(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_getnameinfo(
|
int _ez_getnameinfo(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const struct sockaddr *addr,
|
const struct sockaddr *addr,
|
||||||
socklen_t addrlen,
|
socklen_t addrlen,
|
||||||
char *host,
|
char *host,
|
||||||
@ -580,9 +628,11 @@ int _ez_getnameinfo(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_flock (
|
int _ez_flock (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int fd,
|
int fd,
|
||||||
int operation
|
int operation
|
||||||
)
|
)
|
||||||
@ -609,9 +659,11 @@ int _ez_flock (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_open(
|
int _ez_open(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
int flags,
|
int flags,
|
||||||
mode_t mode
|
mode_t mode
|
||||||
@ -639,9 +691,11 @@ int _ez_open(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_access(
|
int _ez_access(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
int mode
|
int mode
|
||||||
)
|
)
|
||||||
@ -667,9 +721,11 @@ int _ez_access(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
char *_ez_strptime(
|
char *_ez_strptime(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *s,
|
const char *s,
|
||||||
const char *format,
|
const char *format,
|
||||||
struct tm *tm
|
struct tm *tm
|
||||||
@ -689,9 +745,11 @@ char *_ez_strptime(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_seteuid(
|
int _ez_seteuid(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
uid_t euid
|
uid_t euid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -708,9 +766,11 @@ int _ez_seteuid(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_setegid(
|
int _ez_setegid(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gid_t egid
|
gid_t egid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -727,9 +787,11 @@ int _ez_setegid(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
struct group* _ez_getgrnam(
|
struct group* _ez_getgrnam(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *name
|
const char *name
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -760,9 +822,11 @@ struct group* _ez_getgrnam(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_chown(
|
int _ez_chown(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
uid_t owner,
|
uid_t owner,
|
||||||
gid_t group
|
gid_t group
|
||||||
@ -781,9 +845,11 @@ int _ez_chown(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_fchown(
|
int _ez_fchown(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int fd,
|
int fd,
|
||||||
uid_t owner,
|
uid_t owner,
|
||||||
gid_t group
|
gid_t group
|
||||||
@ -802,9 +868,11 @@ int _ez_fchown(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_fchmod(
|
int _ez_fchmod(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int fd,
|
int fd,
|
||||||
mode_t mode
|
mode_t mode
|
||||||
)
|
)
|
||||||
@ -822,9 +890,11 @@ int _ez_fchmod(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_setuid(
|
int _ez_setuid(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
uid_t uid
|
uid_t uid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -841,9 +911,11 @@ int _ez_setuid(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_setgid(
|
int _ez_setgid(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gid_t gid
|
gid_t gid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
259
ez_libc.h
259
ez_libc.h
@ -43,126 +43,210 @@ glibc calls with boilerplate error handling.
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_strptime(s, format, tm) \
|
# define ez_strptime(s, format, tm) \
|
||||||
_ez_strptime(__FILE__, __LINE__, __FUNCTION__, s, format, tm)
|
_ez_strptime(__FILE__, __LINE__, __FUNCTION__, s, format, tm)
|
||||||
|
#else
|
||||||
|
# define ez_strptime(s, format, tm) \
|
||||||
|
_ez_strptime(s, format, tm)
|
||||||
|
#endif
|
||||||
char *_ez_strptime(
|
char *_ez_strptime(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *s,
|
const char *s,
|
||||||
const char *format,
|
const char *format,
|
||||||
struct tm *tm
|
struct tm *tm
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_access(pathname, mode) \
|
# define ez_access(pathname, mode) \
|
||||||
_ez_access(__FILE__, __LINE__, __FUNCTION__, pathname, mode)
|
_ez_access(__FILE__, __LINE__, __FUNCTION__, pathname, mode)
|
||||||
|
#else
|
||||||
|
# define ez_access(pathname, mode) \
|
||||||
|
_ez_access(pathname, mode)
|
||||||
|
#endif
|
||||||
int _ez_access(
|
int _ez_access(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
int mode
|
int mode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_open(pathname, flags, mode) \
|
# define ez_open(pathname, flags, mode) \
|
||||||
_ez_open(__FILE__, __LINE__, __FUNCTION__, pathname, flags, mode)
|
_ez_open(__FILE__, __LINE__, __FUNCTION__, pathname, flags, mode)
|
||||||
|
#else
|
||||||
|
# define ez_open(pathname, flags, mode) \
|
||||||
|
_ez_open(pathname, flags, mode)
|
||||||
|
#endif
|
||||||
int _ez_open(
|
int _ez_open(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
int flags,
|
int flags,
|
||||||
mode_t mode
|
mode_t mode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_fputs(s, stream) \
|
# define ez_fputs(s, stream) \
|
||||||
_ez_fputs(__FILE__, __LINE__, __FUNCTION__, s, stream)
|
_ez_fputs(__FILE__, __LINE__, __FUNCTION__, s, stream)
|
||||||
|
#else
|
||||||
|
# define ez_fputs(s, stream) \
|
||||||
|
_ez_fputs(s, stream)
|
||||||
|
#endif
|
||||||
int _ez_fputs (
|
int _ez_fputs (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *s,
|
const char *s,
|
||||||
FILE *stream
|
FILE *stream
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_fputc(c, stream) \
|
# define ez_fputc(c, stream) \
|
||||||
_ez_fputc(__FILE__, __LINE__, __FUNCTION__, c, stream)
|
_ez_fputc(__FILE__, __LINE__, __FUNCTION__, c, stream)
|
||||||
|
#else
|
||||||
|
# define ez_fputc(c, stream) \
|
||||||
|
_ez_fputc(c, stream)
|
||||||
|
#endif
|
||||||
int _ez_fputc (
|
int _ez_fputc (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int c,
|
int c,
|
||||||
FILE *stream
|
FILE *stream
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_fprintf(stream, fmt, ...) \
|
# define ez_fprintf(stream, fmt, ...) \
|
||||||
_ez_fprintf(__FILE__, __LINE__, __FUNCTION__, stream, fmt, ##__VA_ARGS__)
|
_ez_fprintf(__FILE__, __LINE__, __FUNCTION__, stream, fmt, ##__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
# define ez_fprintf(stream, fmt, ...) \
|
||||||
|
_ez_fprintf(stream, fmt, ##__VA_ARGS__)
|
||||||
|
#endif
|
||||||
int _ez_fprintf (
|
int _ez_fprintf (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
FILE *stream,
|
FILE *stream,
|
||||||
const char *fmt,
|
const char *fmt,
|
||||||
...
|
...
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_popen(command, type) \
|
# define ez_popen(command, type) \
|
||||||
_ez_popen(__FILE__, __LINE__, __FUNCTION__, command, type)
|
_ez_popen(__FILE__, __LINE__, __FUNCTION__, command, type)
|
||||||
|
#else
|
||||||
|
# define ez_popen(command, type) \
|
||||||
|
_ez_popen(command, type)
|
||||||
|
#endif
|
||||||
FILE* _ez_popen (
|
FILE* _ez_popen (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *command,
|
const char *command,
|
||||||
const char *type
|
const char *type
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_fopen(pathname, mode) \
|
# define ez_fopen(pathname, mode) \
|
||||||
_ez_fopen(__FILE__, __LINE__, __FUNCTION__, pathname, mode)
|
_ez_fopen(__FILE__, __LINE__, __FUNCTION__, pathname, mode)
|
||||||
|
#else
|
||||||
|
# define ez_fopen(pathname, mode) \
|
||||||
|
_ez_fopen(pathname, mode)
|
||||||
|
#endif
|
||||||
FILE* _ez_fopen (
|
FILE* _ez_fopen (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
const char *mode
|
const char *mode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_fclose(stream) \
|
# define ez_fclose(stream) \
|
||||||
_ez_fclose(__FILE__, __LINE__, __FUNCTION__, stream)
|
_ez_fclose(__FILE__, __LINE__, __FUNCTION__, stream)
|
||||||
|
#else
|
||||||
|
# define ez_fclose(stream) \
|
||||||
|
_ez_fclose(stream)
|
||||||
|
#endif
|
||||||
int _ez_fclose (
|
int _ez_fclose (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
FILE *stream
|
FILE *stream
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_fflush(stream) \
|
# define ez_fflush(stream) \
|
||||||
_ez_fflush(__FILE__, __LINE__, __FUNCTION__, stream)
|
_ez_fflush(__FILE__, __LINE__, __FUNCTION__, stream)
|
||||||
|
#else
|
||||||
|
# define ez_fflush(stream) \
|
||||||
|
_ez_fflush(stream)
|
||||||
|
#endif
|
||||||
int _ez_fflush (
|
int _ez_fflush (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
FILE *stream
|
FILE *stream
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_fread(ptr, size, nmemb, stream) \
|
# define ez_fread(ptr, size, nmemb, stream) \
|
||||||
_ez_fread(__FILE__, __LINE__, __FUNCTION__, ptr, size, nmemb, stream)
|
_ez_fread(__FILE__, __LINE__, __FUNCTION__, ptr, size, nmemb, stream)
|
||||||
|
#else
|
||||||
|
# define ez_fread(ptr, size, nmemb, stream) \
|
||||||
|
_ez_fread(ptr, size, nmemb, stream)
|
||||||
|
#endif
|
||||||
size_t _ez_fread(
|
size_t _ez_fread(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
void *ptr,
|
void *ptr,
|
||||||
size_t size,
|
size_t size,
|
||||||
size_t nmemb,
|
size_t nmemb,
|
||||||
FILE *stream
|
FILE *stream
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_fwrite(ptr, size, nmemb, stream) \
|
# define ez_fwrite(ptr, size, nmemb, stream) \
|
||||||
_ez_fwrite(__FILE__, __LINE__, __FUNCTION__, ptr, size, nmemb, stream)
|
_ez_fwrite(__FILE__, __LINE__, __FUNCTION__, ptr, size, nmemb, stream)
|
||||||
|
#else
|
||||||
|
# define ez_fwrite(ptr, size, nmemb, stream) \
|
||||||
|
_ez_fwrite(ptr, size, nmemb, stream)
|
||||||
|
#endif
|
||||||
size_t _ez_fwrite(
|
size_t _ez_fwrite(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const void *ptr,
|
const void *ptr,
|
||||||
size_t size,
|
size_t size,
|
||||||
size_t nmemb,
|
size_t nmemb,
|
||||||
@ -170,78 +254,134 @@ size_t _ez_fwrite(
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_pclose(stream) \
|
# define ez_pclose(stream) \
|
||||||
_ez_pclose(__FILE__, __LINE__, __FUNCTION__, stream)
|
_ez_pclose(__FILE__, __LINE__, __FUNCTION__, stream)
|
||||||
|
#else
|
||||||
|
# define ez_pclose(stream) \
|
||||||
|
_ez_pclose(stream)
|
||||||
|
#endif
|
||||||
int _ez_pclose (
|
int _ez_pclose (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
FILE *stream
|
FILE *stream
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_fgets(s, size, stream) \
|
# define ez_fgets(s, size, stream) \
|
||||||
_ez_fgets(__FILE__, __LINE__, __FUNCTION__, s, size, stream)
|
_ez_fgets(__FILE__, __LINE__, __FUNCTION__, s, size, stream)
|
||||||
|
#else
|
||||||
|
# define ez_fgets(s, size, stream) \
|
||||||
|
_ez_fgets(s, size, stream)
|
||||||
|
#endif
|
||||||
char* _ez_fgets (
|
char* _ez_fgets (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
char *s,
|
char *s,
|
||||||
int size,
|
int size,
|
||||||
FILE *stream
|
FILE *stream
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_remove(pathname) \
|
# define ez_remove(pathname) \
|
||||||
_ez_remove(__FILE__, __LINE__, __FUNCTION__, pathname)
|
_ez_remove(__FILE__, __LINE__, __FUNCTION__, pathname)
|
||||||
|
#else
|
||||||
|
# define ez_remove(pathname) \
|
||||||
|
_ez_remove(pathname)
|
||||||
|
#endif
|
||||||
int _ez_remove (
|
int _ez_remove (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname
|
const char *pathname
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_rename(oldpath, newpath) \
|
# define ez_rename(oldpath, newpath) \
|
||||||
_ez_rename(__FILE__, __LINE__, __FUNCTION__, oldpath, newpath)
|
_ez_rename(__FILE__, __LINE__, __FUNCTION__, oldpath, newpath)
|
||||||
|
#else
|
||||||
|
# define ez_rename(oldpath, newpath) \
|
||||||
|
_ez_rename(oldpath, newpath)
|
||||||
|
#endif
|
||||||
int _ez_rename (
|
int _ez_rename (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *oldpath,
|
const char *oldpath,
|
||||||
const char *newpath
|
const char *newpath
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_opendir(name) \
|
# define ez_opendir(name) \
|
||||||
_ez_opendir(__FILE__, __LINE__, __FUNCTION__, name)
|
_ez_opendir(__FILE__, __LINE__, __FUNCTION__, name)
|
||||||
|
#else
|
||||||
|
# define ez_opendir(name) \
|
||||||
|
_ez_opendir(name)
|
||||||
|
#endif
|
||||||
DIR* _ez_opendir (
|
DIR* _ez_opendir (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *name
|
const char *name
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_closedir(dirp) \
|
# define ez_closedir(dirp) \
|
||||||
_ez_closedir(__FILE__, __LINE__, __FUNCTION__, dirp)
|
_ez_closedir(__FILE__, __LINE__, __FUNCTION__, dirp)
|
||||||
|
#else
|
||||||
|
# define ez_closedir(dirp) \
|
||||||
|
_ez_closedir(dirp)
|
||||||
|
#endif
|
||||||
int _ez_closedir (
|
int _ez_closedir (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DIR *dirp
|
DIR *dirp
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_readdir(dirp) \
|
# define ez_readdir(dirp) \
|
||||||
_ez_readdir(__FILE__, __LINE__, __FUNCTION__, dirp)
|
_ez_readdir(__FILE__, __LINE__, __FUNCTION__, dirp)
|
||||||
|
#else
|
||||||
|
# define ez_readdir(dirp) \
|
||||||
|
_ez_readdir(dirp)
|
||||||
|
#endif
|
||||||
struct dirent* _ez_readdir (
|
struct dirent* _ez_readdir (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DIR *dirp
|
DIR *dirp
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_close(fd) \
|
# define ez_close(fd) \
|
||||||
_ez_close(__FILE__, __LINE__, __FUNCTION__, fd)
|
_ez_close(__FILE__, __LINE__, __FUNCTION__, fd)
|
||||||
|
#else
|
||||||
|
# define ez_close(fd) \
|
||||||
|
_ez_close(fd)
|
||||||
|
#endif
|
||||||
int _ez_close (
|
int _ez_close (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int fd
|
int fd
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -259,82 +399,138 @@ ssize_t _ez_read (
|
|||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_write(fd, buf, count) \
|
# define ez_write(fd, buf, count) \
|
||||||
_ez_write(__FILE__, __LINE__, __FUNCTION__, fd, buf, count)
|
_ez_write(__FILE__, __LINE__, __FUNCTION__, fd, buf, count)
|
||||||
|
#else
|
||||||
|
# define ez_write(fd, buf, count) \
|
||||||
|
_ez_write(fd, buf, count)
|
||||||
|
#endif
|
||||||
ssize_t _ez_write (
|
ssize_t _ez_write (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int fd,
|
int fd,
|
||||||
const void *buf,
|
const void *buf,
|
||||||
size_t count
|
size_t count
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_stat(pathname, statbuf) \
|
# define ez_stat(pathname, statbuf) \
|
||||||
_ez_stat(__FILE__, __LINE__, __FUNCTION__, pathname, statbuf)
|
_ez_stat(__FILE__, __LINE__, __FUNCTION__, pathname, statbuf)
|
||||||
|
#else
|
||||||
|
# define ez_stat(pathname, statbuf) \
|
||||||
|
_ez_stat(pathname, statbuf)
|
||||||
|
#endif
|
||||||
int _ez_stat (
|
int _ez_stat (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
struct stat *statbuf
|
struct stat *statbuf
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_mkdir(pathname, mode) \
|
# define ez_mkdir(pathname, mode) \
|
||||||
_ez_mkdir(__FILE__, __LINE__, __FUNCTION__, pathname, mode)
|
_ez_mkdir(__FILE__, __LINE__, __FUNCTION__, pathname, mode)
|
||||||
|
#else
|
||||||
|
# define ez_mkdir(pathname, mode) \
|
||||||
|
_ez_mkdir(pathname, mode)
|
||||||
|
#endif
|
||||||
int _ez_mkdir (
|
int _ez_mkdir (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
mode_t mode
|
mode_t mode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_rmdir(pathname) \
|
# define ez_rmdir(pathname) \
|
||||||
_ez_rmdir(__FILE__, __LINE__, __FUNCTION__, pathname)
|
_ez_rmdir(__FILE__, __LINE__, __FUNCTION__, pathname)
|
||||||
|
#else
|
||||||
|
# define ez_rmdir(pathname) \
|
||||||
|
_ez_rmdir(pathname)
|
||||||
|
#endif
|
||||||
int _ez_rmdir (
|
int _ez_rmdir (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname
|
const char *pathname
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_unlink(pathname) \
|
# define ez_unlink(pathname) \
|
||||||
_ez_unlink(__FILE__, __LINE__, __FUNCTION__, pathname)
|
_ez_unlink(__FILE__, __LINE__, __FUNCTION__, pathname)
|
||||||
|
#else
|
||||||
|
# define ez_unlink(pathname) \
|
||||||
|
_ez_unlink(pathname)
|
||||||
|
#endif
|
||||||
int _ez_unlink (
|
int _ez_unlink (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname
|
const char *pathname
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_unlink(pathname) \
|
# define ez_unlink(pathname) \
|
||||||
_ez_unlink(__FILE__, __LINE__, __FUNCTION__, pathname)
|
_ez_unlink(__FILE__, __LINE__, __FUNCTION__, pathname)
|
||||||
|
#else
|
||||||
|
# define ez_unlink(pathname) \
|
||||||
|
_ez_unlink(pathname)
|
||||||
|
#endif
|
||||||
int _ez_unlink (
|
int _ez_unlink (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname
|
const char *pathname
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_getaddrinfo(node, service, hints, res) \
|
# define ez_getaddrinfo(node, service, hints, res) \
|
||||||
_ez_getaddrinfo(__FILE__, __LINE__, __FUNCTION__, node, service, hints, res)
|
_ez_getaddrinfo(__FILE__, __LINE__, __FUNCTION__, node, service, hints, res)
|
||||||
|
#else
|
||||||
|
# define ez_getaddrinfo(node, service, hints, res) \
|
||||||
|
_ez_getaddrinfo(node, service, hints, res)
|
||||||
|
#endif
|
||||||
int _ez_getaddrinfo(
|
int _ez_getaddrinfo(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *node,
|
const char *node,
|
||||||
const char *service,
|
const char *service,
|
||||||
const struct addrinfo *hints,
|
const struct addrinfo *hints,
|
||||||
struct addrinfo **res
|
struct addrinfo **res
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_getnameinfo(addr, addrlen, host, hostlen, serv, servlen, flags) \
|
# define ez_getnameinfo(addr, addrlen, host, hostlen, serv, servlen, flags) \
|
||||||
_ez_getnameinfo(__FILE__, __LINE__, __FUNCTION__, addr, addrlen, host, hostlen, serv, servlen, flags)
|
_ez_getnameinfo(__FILE__, __LINE__, __FUNCTION__, addr, addrlen, host, hostlen, serv, servlen, flags)
|
||||||
|
#else
|
||||||
|
# define ez_getnameinfo(addr, addrlen, host, hostlen, serv, servlen, flags) \
|
||||||
|
_ez_getnameinfo(addr, addrlen, host, hostlen, serv, servlen, flags)
|
||||||
|
#endif
|
||||||
int _ez_getnameinfo(
|
int _ez_getnameinfo(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const struct sockaddr *addr,
|
const struct sockaddr *addr,
|
||||||
socklen_t addrlen,
|
socklen_t addrlen,
|
||||||
char *host,
|
char *host,
|
||||||
@ -344,90 +540,153 @@ int _ez_getnameinfo(
|
|||||||
int flags
|
int flags
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_flock(fd, operation) \
|
# define ez_flock(fd, operation) \
|
||||||
_ez_flock(__FILE__, __LINE__, __FUNCTION__, fd, operation)
|
_ez_flock(__FILE__, __LINE__, __FUNCTION__, fd, operation)
|
||||||
|
#else
|
||||||
|
# define ez_flock(fd, operation) \
|
||||||
|
_ez_flock(fd, operation)
|
||||||
|
#endif
|
||||||
int _ez_flock (
|
int _ez_flock (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int fd,
|
int fd,
|
||||||
int operation
|
int operation
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_setuid(uid) \
|
# define ez_setuid(uid) \
|
||||||
_ez_setuid(__FILE__, __LINE__, __FUNCTION__, uid)
|
_ez_setuid(__FILE__, __LINE__, __FUNCTION__, uid)
|
||||||
|
#else
|
||||||
|
# define ez_setuid(uid) \
|
||||||
|
_ez_setuid(uid)
|
||||||
|
#endif
|
||||||
int _ez_setuid(
|
int _ez_setuid(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
uid_t uid
|
uid_t uid
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_setgid(gid) \
|
# define ez_setgid(gid) \
|
||||||
_ez_setgid(__FILE__, __LINE__, __FUNCTION__, gid)
|
_ez_setgid(__FILE__, __LINE__, __FUNCTION__, gid)
|
||||||
|
#else
|
||||||
|
# define ez_setgid(gid) \
|
||||||
|
_ez_setgid(gid)
|
||||||
|
#endif
|
||||||
int _ez_setgid(
|
int _ez_setgid(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gid_t gid
|
gid_t gid
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_seteuid(euid) \
|
# define ez_seteuid(euid) \
|
||||||
_ez_seteuid(__FILE__, __LINE__, __FUNCTION__, euid)
|
_ez_seteuid(__FILE__, __LINE__, __FUNCTION__, euid)
|
||||||
|
#else
|
||||||
|
# define ez_seteuid(euid) \
|
||||||
|
_ez_seteuid(euid)
|
||||||
|
#endif
|
||||||
int _ez_seteuid(
|
int _ez_seteuid(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
uid_t euid
|
uid_t euid
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_setegid(egid) \
|
# define ez_setegid(egid) \
|
||||||
_ez_setegid(__FILE__, __LINE__, __FUNCTION__, egid)
|
_ez_setegid(__FILE__, __LINE__, __FUNCTION__, egid)
|
||||||
|
#else
|
||||||
|
# define ez_setegid(egid) \
|
||||||
|
_ez_setegid(egid)
|
||||||
|
#endif
|
||||||
int _ez_setegid(
|
int _ez_setegid(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gid_t egid
|
gid_t egid
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_getgrnam(name) \
|
# define ez_getgrnam(name) \
|
||||||
_ez_getgrnam(__FILE__, __LINE__, __FUNCTION__, name)
|
_ez_getgrnam(__FILE__, __LINE__, __FUNCTION__, name)
|
||||||
|
#else
|
||||||
|
# define ez_getgrnam(name) \
|
||||||
|
_ez_getgrnam(name)
|
||||||
|
#endif
|
||||||
struct group* _ez_getgrnam(
|
struct group* _ez_getgrnam(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *name
|
const char *name
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_chown(pathname, owner, group) \
|
# define ez_chown(pathname, owner, group) \
|
||||||
_ez_chown(__FILE__, __LINE__, __FUNCTION__, pathname, owner, group)
|
_ez_chown(__FILE__, __LINE__, __FUNCTION__, pathname, owner, group)
|
||||||
|
#else
|
||||||
|
# define ez_chown(pathname, owner, group) \
|
||||||
|
_ez_chown(pathname, owner, group)
|
||||||
|
#endif
|
||||||
int _ez_chown(
|
int _ez_chown(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *pathname,
|
const char *pathname,
|
||||||
uid_t owner,
|
uid_t owner,
|
||||||
gid_t group
|
gid_t group
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_fchown(fd, owner, group) \
|
# define ez_fchown(fd, owner, group) \
|
||||||
_ez_fchown(__FILE__, __LINE__, __FUNCTION__, fd, owner, group)
|
_ez_fchown(__FILE__, __LINE__, __FUNCTION__, fd, owner, group)
|
||||||
|
#else
|
||||||
|
# define ez_fchown(fd, owner, group) \
|
||||||
|
_ez_fchown(fd, owner, group)
|
||||||
|
#endif
|
||||||
int _ez_fchown(
|
int _ez_fchown(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int fd,
|
int fd,
|
||||||
uid_t owner,
|
uid_t owner,
|
||||||
gid_t group
|
gid_t group
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_fchmod(fd, mode) \
|
# define ez_fchmod(fd, mode) \
|
||||||
_ez_fchmod(__FILE__, __LINE__, __FUNCTION__, fd, mode)
|
_ez_fchmod(__FILE__, __LINE__, __FUNCTION__, fd, mode)
|
||||||
|
#else
|
||||||
|
# define ez_fchmod(fd, mode) \
|
||||||
|
_ez_fchmod(fd, mode)
|
||||||
|
#endif
|
||||||
int _ez_fchmod(
|
int _ez_fchmod(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
int fd,
|
int fd,
|
||||||
mode_t mode
|
mode_t mode
|
||||||
);
|
);
|
||||||
|
14
ez_libdb.c
14
ez_libdb.c
@ -24,9 +24,11 @@
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_db_create(
|
int _ez_db_create(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB **dbp,
|
DB **dbp,
|
||||||
DB_ENV *dbenv,
|
DB_ENV *dbenv,
|
||||||
u_int32_t flags
|
u_int32_t flags
|
||||||
@ -48,9 +50,11 @@ int _ez_db_create(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_db_open(
|
int _ez_db_open(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB *db,
|
DB *db,
|
||||||
DB_TXN *txnid,
|
DB_TXN *txnid,
|
||||||
const char *file,
|
const char *file,
|
||||||
@ -76,9 +80,11 @@ int _ez_db_open(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_db_put(
|
int _ez_db_put(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB *db,
|
DB *db,
|
||||||
DB_TXN *txnid,
|
DB_TXN *txnid,
|
||||||
DBT *key,
|
DBT *key,
|
||||||
@ -102,9 +108,11 @@ int _ez_db_put(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_db_get(
|
int _ez_db_get(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB *db,
|
DB *db,
|
||||||
DB_TXN *txnid,
|
DB_TXN *txnid,
|
||||||
DBT *key,
|
DBT *key,
|
||||||
@ -132,9 +140,11 @@ int _ez_db_get(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_db_del(
|
int _ez_db_del(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB *db,
|
DB *db,
|
||||||
DB_TXN *txnid,
|
DB_TXN *txnid,
|
||||||
DBT *key,
|
DBT *key,
|
||||||
@ -157,9 +167,11 @@ int _ez_db_del(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_db_close(
|
int _ez_db_close(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB *db,
|
DB *db,
|
||||||
u_int32_t flags
|
u_int32_t flags
|
||||||
)
|
)
|
||||||
@ -180,9 +192,11 @@ int _ez_db_close(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_db_fd(
|
int _ez_db_fd(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB *db,
|
DB *db,
|
||||||
int *fdp
|
int *fdp
|
||||||
)
|
)
|
||||||
|
49
ez_libdb.h
49
ez_libdb.h
@ -27,23 +27,37 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_db_create(dbp, dbenv, flags) \
|
# define ez_db_create(dbp, dbenv, flags) \
|
||||||
_ez_db_create(__FILE__, __LINE__, __FUNCTION__, dbp, dbenv, flags)
|
_ez_db_create(__FILE__, __LINE__, __FUNCTION__, dbp, dbenv, flags)
|
||||||
|
#else
|
||||||
|
# define ez_db_create(dbp, dbenv, flags) \
|
||||||
|
_ez_db_create(dbp, dbenv, flags)
|
||||||
|
#endif
|
||||||
int _ez_db_create(
|
int _ez_db_create(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB **dbp,
|
DB **dbp,
|
||||||
DB_ENV *dbenv,
|
DB_ENV *dbenv,
|
||||||
u_int32_t flags
|
u_int32_t flags
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_db_open(db, txnid, file, database, type, flags, mode ) \
|
# define ez_db_open(db, txnid, file, database, type, flags, mode ) \
|
||||||
_ez_db_open(__FILE__, __LINE__, __FUNCTION__, db, txnid, file, database, type, flags, mode)
|
_ez_db_open(__FILE__, __LINE__, __FUNCTION__, db, txnid, file, database, type, flags, mode)
|
||||||
|
#else
|
||||||
|
# define ez_db_open(db, txnid, file, database, type, flags, mode ) \
|
||||||
|
_ez_db_open(db, txnid, file, database, type, flags, mode)
|
||||||
|
#endif
|
||||||
int _ez_db_open(
|
int _ez_db_open(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB *db,
|
DB *db,
|
||||||
DB_TXN *txnid,
|
DB_TXN *txnid,
|
||||||
const char *file,
|
const char *file,
|
||||||
@ -53,12 +67,19 @@ int _ez_db_open(
|
|||||||
int mode
|
int mode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_db_put(db, txnid, key, data, flags) \
|
# define ez_db_put(db, txnid, key, data, flags) \
|
||||||
_ez_db_put(__FILE__, __LINE__, __FUNCTION__, db, txnid, key, data, flags)
|
_ez_db_put(__FILE__, __LINE__, __FUNCTION__, db, txnid, key, data, flags)
|
||||||
|
#else
|
||||||
|
# define ez_db_put(db, txnid, key, data, flags) \
|
||||||
|
_ez_db_put(db, txnid, key, data, flags)
|
||||||
|
#endif
|
||||||
int _ez_db_put(
|
int _ez_db_put(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB *db,
|
DB *db,
|
||||||
DB_TXN *txnid,
|
DB_TXN *txnid,
|
||||||
DBT *key,
|
DBT *key,
|
||||||
@ -66,12 +87,19 @@ int _ez_db_put(
|
|||||||
u_int32_t flags
|
u_int32_t flags
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_db_get(db, txnid, key, data, flags) \
|
# define ez_db_get(db, txnid, key, data, flags) \
|
||||||
_ez_db_get(__FILE__, __LINE__, __FUNCTION__, db, txnid, key, data, flags)
|
_ez_db_get(__FILE__, __LINE__, __FUNCTION__, db, txnid, key, data, flags)
|
||||||
|
#else
|
||||||
|
# define ez_db_get(db, txnid, key, data, flags) \
|
||||||
|
_ez_db_get(db, txnid, key, data, flags)
|
||||||
|
#endif
|
||||||
int _ez_db_get(
|
int _ez_db_get(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB *db,
|
DB *db,
|
||||||
DB_TXN *txnid,
|
DB_TXN *txnid,
|
||||||
DBT *key,
|
DBT *key,
|
||||||
@ -79,34 +107,55 @@ int _ez_db_get(
|
|||||||
u_int32_t flags
|
u_int32_t flags
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_db_del(db, txnid, key, flags) \
|
# define ez_db_del(db, txnid, key, flags) \
|
||||||
_ez_db_del(__FILE__, __LINE__, __FUNCTION__, db, txnid, key, flags)
|
_ez_db_del(__FILE__, __LINE__, __FUNCTION__, db, txnid, key, flags)
|
||||||
|
#else
|
||||||
|
# define ez_db_del(db, txnid, key, flags) \
|
||||||
|
_ez_db_del(db, txnid, key, flags)
|
||||||
|
#endif
|
||||||
int _ez_db_del(
|
int _ez_db_del(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB *db,
|
DB *db,
|
||||||
DB_TXN *txnid,
|
DB_TXN *txnid,
|
||||||
DBT *key,
|
DBT *key,
|
||||||
u_int32_t flags
|
u_int32_t flags
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_db_close(db, flags) \
|
# define ez_db_close(db, flags) \
|
||||||
_ez_db_close(__FILE__, __LINE__, __FUNCTION__, db, flags)
|
_ez_db_close(__FILE__, __LINE__, __FUNCTION__, db, flags)
|
||||||
|
#else
|
||||||
|
# define ez_db_close(db, flags) \
|
||||||
|
_ez_db_close(db, flags)
|
||||||
|
#endif
|
||||||
int _ez_db_close(
|
int _ez_db_close(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB *db,
|
DB *db,
|
||||||
u_int32_t flags
|
u_int32_t flags
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_db_fd(db, fdp) \
|
# define ez_db_fd(db, fdp) \
|
||||||
_ez_db_fd(__FILE__, __LINE__, __FUNCTION__, db, fdp)
|
_ez_db_fd(__FILE__, __LINE__, __FUNCTION__, db, fdp)
|
||||||
|
#else
|
||||||
|
# define ez_db_fd(db, fdp) \
|
||||||
|
_ez_db_fd(db, fdp)
|
||||||
|
#endif
|
||||||
int _ez_db_fd(
|
int _ez_db_fd(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
DB *db,
|
DB *db,
|
||||||
int *fdp
|
int *fdp
|
||||||
);
|
);
|
||||||
|
@ -26,9 +26,11 @@
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_pthread_mutex_lock(
|
int _ez_pthread_mutex_lock(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_mutex_t *mutex
|
pthread_mutex_t *mutex
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -46,9 +48,11 @@ int _ez_pthread_mutex_lock(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_pthread_mutex_unlock(
|
int _ez_pthread_mutex_unlock(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_mutex_t *mutex
|
pthread_mutex_t *mutex
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -66,9 +70,11 @@ int _ez_pthread_mutex_unlock(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_pthread_create(
|
int _ez_pthread_create(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_t *thread,
|
pthread_t *thread,
|
||||||
const pthread_attr_t *attr,
|
const pthread_attr_t *attr,
|
||||||
void *(*start_routine) (void *),
|
void *(*start_routine) (void *),
|
||||||
@ -89,9 +95,11 @@ int _ez_pthread_create(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_pthread_cond_signal(
|
int _ez_pthread_cond_signal(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_cond_t *cond
|
pthread_cond_t *cond
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -109,9 +117,11 @@ int _ez_pthread_cond_signal(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_pthread_cond_wait(
|
int _ez_pthread_cond_wait(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_cond_t *cond,
|
pthread_cond_t *cond,
|
||||||
pthread_mutex_t *mutex
|
pthread_mutex_t *mutex
|
||||||
)
|
)
|
||||||
@ -130,9 +140,11 @@ int _ez_pthread_cond_wait(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_pthread_join(
|
int _ez_pthread_join(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_t thread,
|
pthread_t thread,
|
||||||
void **retval
|
void **retval
|
||||||
)
|
)
|
||||||
|
@ -27,61 +27,103 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_pthread_mutex_lock(mutex) \
|
# define ez_pthread_mutex_lock(mutex) \
|
||||||
_ez_pthread_mutex_lock(__FILE__, __LINE__, __FUNCTION__, mutex)
|
_ez_pthread_mutex_lock(__FILE__, __LINE__, __FUNCTION__, mutex)
|
||||||
|
#else
|
||||||
|
# define ez_pthread_mutex_lock(mutex) \
|
||||||
|
_ez_pthread_mutex_lock(mutex)
|
||||||
|
#endif
|
||||||
int _ez_pthread_mutex_lock(
|
int _ez_pthread_mutex_lock(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_mutex_t *mutex
|
pthread_mutex_t *mutex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_pthread_mutex_unlock(mutex) \
|
# define ez_pthread_mutex_unlock(mutex) \
|
||||||
_ez_pthread_mutex_unlock(__FILE__, __LINE__, __FUNCTION__, mutex)
|
_ez_pthread_mutex_unlock(__FILE__, __LINE__, __FUNCTION__, mutex)
|
||||||
|
#else
|
||||||
|
# define ez_pthread_mutex_unlock(mutex) \
|
||||||
|
_ez_pthread_mutex_unlock(mutex)
|
||||||
|
#endif
|
||||||
int _ez_pthread_mutex_unlock(
|
int _ez_pthread_mutex_unlock(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_mutex_t *mutex
|
pthread_mutex_t *mutex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_pthread_create(thread, addr, start_routine, arg) \
|
# define ez_pthread_create(thread, addr, start_routine, arg) \
|
||||||
_ez_pthread_create(__FILE__, __LINE__, __FUNCTION__, thread, addr, start_routine, arg)
|
_ez_pthread_create(__FILE__, __LINE__, __FUNCTION__, thread, addr, start_routine, arg)
|
||||||
|
#else
|
||||||
|
# define ez_pthread_create(thread, addr, start_routine, arg) \
|
||||||
|
_ez_pthread_create(thread, addr, start_routine, arg)
|
||||||
|
#endif
|
||||||
int _ez_pthread_create(
|
int _ez_pthread_create(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_t *thread,
|
pthread_t *thread,
|
||||||
const pthread_attr_t *attr,
|
const pthread_attr_t *attr,
|
||||||
void *(*start_routine) (void *),
|
void *(*start_routine) (void *),
|
||||||
void *arg
|
void *arg
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_pthread_cond_signal(cond) \
|
# define ez_pthread_cond_signal(cond) \
|
||||||
_ez_pthread_cond_signal(__FILE__, __LINE__, __FUNCTION__, cond)
|
_ez_pthread_cond_signal(__FILE__, __LINE__, __FUNCTION__, cond)
|
||||||
|
#else
|
||||||
|
# define ez_pthread_cond_signal(cond) \
|
||||||
|
_ez_pthread_cond_signal(cond)
|
||||||
|
#endif
|
||||||
int _ez_pthread_cond_signal(
|
int _ez_pthread_cond_signal(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_cond_t *cond
|
pthread_cond_t *cond
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_pthread_cond_wait(cond, mutex) \
|
# define ez_pthread_cond_wait(cond, mutex) \
|
||||||
_ez_pthread_cond_wait(__FILE__, __LINE__, __FUNCTION__, cond, mutex)
|
_ez_pthread_cond_wait(__FILE__, __LINE__, __FUNCTION__, cond, mutex)
|
||||||
|
#else
|
||||||
|
# define ez_pthread_cond_wait(cond, mutex) \
|
||||||
|
_ez_pthread_cond_wait(cond, mutex)
|
||||||
|
#endif
|
||||||
int _ez_pthread_cond_wait(
|
int _ez_pthread_cond_wait(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_cond_t *cond,
|
pthread_cond_t *cond,
|
||||||
pthread_mutex_t *mutex
|
pthread_mutex_t *mutex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_pthread_join(thread, retval) \
|
# define ez_pthread_join(thread, retval) \
|
||||||
_ez_pthread_join(__FILE__, __LINE__, __FUNCTION__, thread, retval)
|
_ez_pthread_join(__FILE__, __LINE__, __FUNCTION__, thread, retval)
|
||||||
|
#else
|
||||||
|
# define ez_pthread_join(thread, retval) \
|
||||||
|
_ez_pthread_join(thread, retval)
|
||||||
|
#endif
|
||||||
int _ez_pthread_join(
|
int _ez_pthread_join(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
pthread_t thread,
|
pthread_t thread,
|
||||||
void **retval
|
void **retval
|
||||||
);
|
);
|
||||||
|
16
ez_libz.c
16
ez_libz.c
@ -24,9 +24,11 @@
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
gzFile _ez_gzopen(
|
gzFile _ez_gzopen(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *path,
|
const char *path,
|
||||||
const char *mode
|
const char *mode
|
||||||
)
|
)
|
||||||
@ -44,9 +46,11 @@ gzFile _ez_gzopen(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_gzclose(
|
int _ez_gzclose(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file
|
gzFile file
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -88,9 +92,11 @@ int _ez_gzclose(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_gzwrite(
|
int _ez_gzwrite(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file,
|
gzFile file,
|
||||||
voidpc buf,
|
voidpc buf,
|
||||||
unsigned len
|
unsigned len
|
||||||
@ -119,9 +125,11 @@ int _ez_gzwrite(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_gzread(
|
int _ez_gzread(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file,
|
gzFile file,
|
||||||
voidp buf,
|
voidp buf,
|
||||||
unsigned len
|
unsigned len
|
||||||
@ -150,9 +158,11 @@ int _ez_gzread(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int _ez_gzflush(
|
int _ez_gzflush(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file,
|
gzFile file,
|
||||||
int flush
|
int flush
|
||||||
)
|
)
|
||||||
@ -179,9 +189,11 @@ int _ez_gzflush(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
z_off_t _ez_gzseek(
|
z_off_t _ez_gzseek(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file,
|
gzFile file,
|
||||||
z_off_t offset,
|
z_off_t offset,
|
||||||
int whence
|
int whence
|
||||||
@ -210,9 +222,11 @@ z_off_t _ez_gzseek(
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
char* _ez_gzgets (
|
char* _ez_gzgets (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file,
|
gzFile file,
|
||||||
char *buf,
|
char *buf,
|
||||||
int len
|
int len
|
||||||
@ -246,9 +260,11 @@ char* _ez_gzgets (
|
|||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
z_off_t _ez_gztell(
|
z_off_t _ez_gztell(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file
|
gzFile file
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
56
ez_libz.h
56
ez_libz.h
@ -27,83 +27,139 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_gzopen(path, mode) \
|
# define ez_gzopen(path, mode) \
|
||||||
_ez_gzopen(__FILE__, __LINE__, __FUNCTION__, path, mode)
|
_ez_gzopen(__FILE__, __LINE__, __FUNCTION__, path, mode)
|
||||||
|
#else
|
||||||
|
# define ez_gzopen(path, mode) \
|
||||||
|
_ez_gzopen(path, mode)
|
||||||
|
#endif
|
||||||
gzFile _ez_gzopen(
|
gzFile _ez_gzopen(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
const char *path,
|
const char *path,
|
||||||
const char *mode
|
const char *mode
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_gzclose(file) \
|
# define ez_gzclose(file) \
|
||||||
_ez_gzclose(__FILE__, __LINE__, __FUNCTION__, file)
|
_ez_gzclose(__FILE__, __LINE__, __FUNCTION__, file)
|
||||||
|
#else
|
||||||
|
# define ez_gzclose(file) \
|
||||||
|
_ez_gzclose(file)
|
||||||
|
#endif
|
||||||
int _ez_gzclose(
|
int _ez_gzclose(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file
|
gzFile file
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_gzwrite(file, buf, len) \
|
# define ez_gzwrite(file, buf, len) \
|
||||||
_ez_gzwrite(__FILE__, __LINE__, __FUNCTION__, file, buf, len)
|
_ez_gzwrite(__FILE__, __LINE__, __FUNCTION__, file, buf, len)
|
||||||
|
#else
|
||||||
|
# define ez_gzwrite(file, buf, len) \
|
||||||
|
_ez_gzwrite(file, buf, len)
|
||||||
|
#endif
|
||||||
int _ez_gzwrite(
|
int _ez_gzwrite(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file,
|
gzFile file,
|
||||||
voidpc buf,
|
voidpc buf,
|
||||||
unsigned len
|
unsigned len
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_gzread(file, buf, len) \
|
# define ez_gzread(file, buf, len) \
|
||||||
_ez_gzread(__FILE__, __LINE__, __FUNCTION__, file, buf, len)
|
_ez_gzread(__FILE__, __LINE__, __FUNCTION__, file, buf, len)
|
||||||
|
#else
|
||||||
|
# define ez_gzread(file, buf, len) \
|
||||||
|
_ez_gzread(file, buf, len)
|
||||||
|
#endif
|
||||||
int _ez_gzread(
|
int _ez_gzread(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file,
|
gzFile file,
|
||||||
voidp buf,
|
voidp buf,
|
||||||
unsigned len
|
unsigned len
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_gzflush(file, flush) \
|
# define ez_gzflush(file, flush) \
|
||||||
_ez_gzflush(__FILE__, __LINE__, __FUNCTION__, file, flush)
|
_ez_gzflush(__FILE__, __LINE__, __FUNCTION__, file, flush)
|
||||||
|
#else
|
||||||
|
# define ez_gzflush(file, flush) \
|
||||||
|
_ez_gzflush(file, flush)
|
||||||
|
#endif
|
||||||
int _ez_gzflush(
|
int _ez_gzflush(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file,
|
gzFile file,
|
||||||
int flush
|
int flush
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_gzseek(file, offset, whence) \
|
# define ez_gzseek(file, offset, whence) \
|
||||||
_ez_gzseek(__FILE__, __LINE__, __FUNCTION__, file, offset, whence)
|
_ez_gzseek(__FILE__, __LINE__, __FUNCTION__, file, offset, whence)
|
||||||
|
#else
|
||||||
|
# define ez_gzseek(file, offset, whence) \
|
||||||
|
_ez_gzseek(file, offset, whence)
|
||||||
|
#endif
|
||||||
z_off_t _ez_gzseek(
|
z_off_t _ez_gzseek(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file,
|
gzFile file,
|
||||||
z_off_t offset,
|
z_off_t offset,
|
||||||
int whence
|
int whence
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_gztell(file) \
|
# define ez_gztell(file) \
|
||||||
_ez_gztell(__FILE__, __LINE__, __FUNCTION__, file)
|
_ez_gztell(__FILE__, __LINE__, __FUNCTION__, file)
|
||||||
|
#else
|
||||||
|
# define ez_gztell(file) \
|
||||||
|
_ez_gztell(file)
|
||||||
|
#endif
|
||||||
z_off_t _ez_gztell(
|
z_off_t _ez_gztell(
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file
|
gzFile file
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
# define ez_gzgets(file, buf, len) \
|
# define ez_gzgets(file, buf, len) \
|
||||||
_ez_gzgets(__FILE__, __LINE__, __FUNCTION__, file, buf, len)
|
_ez_gzgets(__FILE__, __LINE__, __FUNCTION__, file, buf, len)
|
||||||
|
#else
|
||||||
|
# define ez_gzgets(file, buf, len) \
|
||||||
|
_ez_gzgets(file, buf, len)
|
||||||
|
#endif
|
||||||
char* _ez_gzgets (
|
char* _ez_gzgets (
|
||||||
|
#ifdef DEBUG
|
||||||
const char *fileName,
|
const char *fileName,
|
||||||
int lineNo,
|
int lineNo,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
|
#endif
|
||||||
gzFile file,
|
gzFile file,
|
||||||
char *buf,
|
char *buf,
|
||||||
int len
|
int len
|
||||||
|
17
offEntry.c
17
offEntry.c
@ -233,6 +233,7 @@ OFFENTRY_list(OFFENTRY *self, FILE *fh, int flags, unsigned nAllowed)
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef OLD
|
||||||
const static char *dns_fmt= "%u %-13s %-15s\t%5u/%-4d offenses %s [%s] %s %s\n",
|
const static char *dns_fmt= "%u %-13s %-15s\t%5u/%-4d offenses %s [%s] %s %s\n",
|
||||||
*fmt= "%u %-13s %-15s\t%5u/%-4d offenses %s [%s]\n";
|
*fmt= "%u %-13s %-15s\t%5u/%-4d offenses %s [%s]\n";
|
||||||
|
|
||||||
@ -247,6 +248,22 @@ OFFENTRY_list(OFFENTRY *self, FILE *fh, int flags, unsigned nAllowed)
|
|||||||
, self->dns.name ? self->dns.name : ""
|
, self->dns.name ? self->dns.name : ""
|
||||||
, bits2str(self->dns.flags, dns_flagsArr)
|
, bits2str(self->dns.flags, dns_flagsArr)
|
||||||
);
|
);
|
||||||
|
#else
|
||||||
|
const static char *dns_fmt= "%u %-13s %5u/%-4d offenses %s [%-3s] %s \t%s %s\n",
|
||||||
|
*fmt= "%u %-13s %5u/%-4d offenses %s [%-3s] %s\n";
|
||||||
|
|
||||||
|
ez_fprintf(fh, self->dns.flags ? dns_fmt : fmt
|
||||||
|
, self->severity
|
||||||
|
, self->latest ? local_strftime(&self->latest, "%b %d %H:%M") : ""
|
||||||
|
, self->count
|
||||||
|
, nAllowed
|
||||||
|
, self->cntry[0] ? self->cntry : "--"
|
||||||
|
, bits2str(flags, BlockBitTuples)
|
||||||
|
, self->addr
|
||||||
|
, self->dns.name ? self->dns.name : ""
|
||||||
|
, bits2str(self->dns.flags, dns_flagsArr)
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user