2009-11-04 Marcus Brinkmann <marcus@g10code.de>

* ath.h (ath_self): New prototype.  Include <stdint.h>
	* ath.c, ath-pth.c, ath-pthread.c (ath_self): New function.
	* debug.h: Rewrite most macros to beautify debug output.
	(_gpgme_debug_buffer): Remove tagname and tag argument.
	(_gpgme_debug_frame_begin, _gpgme_debug_frame_end): New prototypes.
	* debug.c: Include <time.h>.  Don't include assuan.h.
	(frame_nr, FRAME_NR): New thread-specific variable and macro.
	(debug_init): Do not initialize assuan.  Call _gpgme_debug after
	initialization instead using printf directly.
	(_gpgme_debug): Do not call debug_init (we now ensure proper
	initialization by user).  Add timestamp and thread/process ID.
	(_gpgme_debug_buffer): Do not take tagname and tag argument.
	(_gpgme_debug_frame_begin, _gpgme_debug_frame_end): New functions.
	* version.c (gpgme_check_version_internal, gpgme_check_version):
	Fix debug string.  Do not initialize assuan.
	* posix-io.c (get_max_fds): Use 0 not NULL (nicer debug output).
This commit is contained in:
Marcus Brinkmann 2009-11-04 18:13:44 +00:00
parent 574086bf19
commit 49693e8e45
9 changed files with 224 additions and 120 deletions

View File

@ -1,3 +1,22 @@
2009-11-04 Marcus Brinkmann <marcus@g10code.de>
* ath.h (ath_self): New prototype. Include <stdint.h>
* ath.c, ath-pth.c, ath-pthread.c (ath_self): New function.
* debug.h: Rewrite most macros to beautify debug output.
(_gpgme_debug_buffer): Remove tagname and tag argument.
(_gpgme_debug_frame_begin, _gpgme_debug_frame_end): New prototypes.
* debug.c: Include <time.h>. Don't include assuan.h.
(frame_nr, FRAME_NR): New thread-specific variable and macro.
(debug_init): Do not initialize assuan. Call _gpgme_debug after
initialization instead using printf directly.
(_gpgme_debug): Do not call debug_init (we now ensure proper
initialization by user). Add timestamp and thread/process ID.
(_gpgme_debug_buffer): Do not take tagname and tag argument.
(_gpgme_debug_frame_begin, _gpgme_debug_frame_end): New functions.
* version.c (gpgme_check_version_internal, gpgme_check_version):
Fix debug string. Do not initialize assuan.
* posix-io.c (get_max_fds): Use 0 not NULL (nicer debug output).
2009-11-04 Werner Koch <wk@g10code.com>
* gpgme-tool.c (register_commands): Add HELP feature.

View File

@ -34,6 +34,14 @@
/* The lock we take while checking for lazy lock initialization. */
static pth_mutex_t check_init_lock = PTH_MUTEX_INIT;
uintptr_t
ath_self (void)
{
return (uintptr_t) pth_self ();
}
/* Initialize the mutex *PRIV. If JUST_CHECK is true, only do this if
it is not already initialized. */
static int

View File

@ -77,6 +77,13 @@ ath_init (void)
}
uintptr_t
ath_self (void)
{
return (uintptr_t) pthread_self ();
}
int
ath_mutex_init (ath_mutex_t *lock)
{

View File

@ -42,6 +42,33 @@
#define MUTEX_DESTROYED ((ath_mutex_t) 2)
#ifdef HAVE_W32_SYSTEM
#include <windows.h>
uintptr_t
ath_self (void)
{
return (uintptr_t) GetCurrentThreadID ();
}
#else
# ifdef __linux
#include <sys/types.h>
#include <sys/syscall.h>
uintptr_t
ath_self (void)
{
/* Just to catch users who don't use gpgme-pthread. */
return (uintptr_t) syscall (SYS_gettid);
}
# else
uintptr_t
ath_self (void)
{
return (uintptr_t) getpid ();
}
# endif
#endif
int
ath_mutex_init (ath_mutex_t *lock)
{

View File

@ -21,6 +21,9 @@
#ifndef ATH_H
#define ATH_H
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_W32_SYSTEM
/* fixme: Check how we did it in libgcrypt. */
struct msghdr { int dummy; };
@ -68,6 +71,8 @@
typedef void *ath_mutex_t;
#define ATH_MUTEX_INITIALIZER 0;
uintptr_t ath_self (void);
/* Functions for mutual exclusion. */
int ath_mutex_init (ath_mutex_t *mutex);
int ath_mutex_destroy (ath_mutex_t *mutex);

View File

@ -29,6 +29,7 @@
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <time.h>
#ifndef HAVE_DOSISH_SYSTEM
# include <sys/types.h>
# include <sys/stat.h>
@ -36,11 +37,8 @@
#endif
#include <assert.h>
#ifdef HAVE_ASSUAN_H
#include "assuan.h"
#endif
#include "util.h"
#include "ath.h"
#include "sema.h"
#include "debug.h"
@ -56,6 +54,28 @@ static int debug_level;
/* The output stream for the debug messages. */
static FILE *errfp;
#ifdef __GNUC__
#define FRAME_NR
static __thread int frame_nr = 0;
#endif
void
_gpgme_debug_frame_begin (void)
{
#ifdef FRAME_NR
frame_nr++;
#endif
}
void _gpgme_debug_frame_end (void)
{
#ifdef FRAME_NR
frame_nr--;
#endif
}
/* Remove leading and trailing white spaces. */
static char *
@ -140,15 +160,11 @@ debug_init (void)
}
free (e);
}
if (debug_level > 0)
fprintf (errfp, "gpgme_debug: level=%d\n", debug_level);
#ifdef HAVE_ASSUAN_H
assuan_set_assuan_log_prefix ("gpgme-assuan");
assuan_set_assuan_log_stream (debug_level > 0 ? errfp : NULL);
#endif /* HAVE_ASSUAN_H*/
}
UNLOCK (debug_lock);
if (debug_level > 0)
_gpgme_debug (DEBUG_INIT, "gpgme_debug: level=%d\n", debug_level);
}
@ -173,13 +189,37 @@ _gpgme_debug (int level, const char *format, ...)
int saved_errno;
saved_errno = errno;
debug_init ();
if (debug_level < level)
return;
va_start (arg_ptr, format);
LOCK (debug_lock);
{
struct tm *tp;
time_t atime = time (NULL);
tp = localtime (&atime);
fprintf (errfp, "GPGME %04d-%02d-%02d %02d:%02d:%02d <0x%04llx> ",
1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
tp->tm_hour, tp->tm_min, tp->tm_sec,
(unsigned long long) ath_self ());
}
#ifdef FRAME_NR
{
char spaces[] = " ";
int nr_spaces = sizeof (spaces) - 1;
int nr_columns;
nr_columns = 2 * (frame_nr - 1);
if (nr_columns > nr_spaces)
nr_columns = nr_spaces;
if (nr_columns < 0)
nr_columns = 0;
spaces[nr_columns] = '\0';
fprintf (errfp, "%s", spaces);
}
#endif
vfprintf (errfp, format, arg_ptr);
va_end (arg_ptr);
if(format && *format && format[strlen (format) - 1] != '\n')
@ -199,7 +239,6 @@ _gpgme_debug_begin (void **line, int level, const char *format, ...)
va_list arg_ptr;
int res;
debug_init ();
if (debug_level < level)
{
/* Disable logging of this line. */
@ -265,8 +304,7 @@ _gpgme_debug_end (void **line)
void
_gpgme_debug_buffer (int lvl, const char *const fmt,
const char *const func, const char *const tagname,
const void *const tag, const char *const buffer,
const char *const func, const char *const buffer,
size_t len)
{
int idx = 0;
@ -302,6 +340,6 @@ _gpgme_debug_buffer (int lvl, const char *const fmt,
*(strp++) = ' ';
*(strp2) = '\0';
_gpgme_debug (lvl, fmt, func, tagname, tag, str);
_gpgme_debug (lvl, fmt, func, str);
}
}

View File

@ -72,10 +72,13 @@ void _gpgme_debug_add (void **helper, const char *format, ...);
void _gpgme_debug_end (void **helper);
void _gpgme_debug_buffer (int lvl, const char *const fmt,
const char *const func, const char *const tagname,
const void *const tag, const char *const buffer,
const char *const func, const char *const buffer,
size_t len);
void _gpgme_debug_frame_begin (void);
void _gpgme_debug_frame_end (void);
/* Trace support. */
@ -86,159 +89,159 @@ void _gpgme_debug_buffer (int lvl, const char *const fmt,
int _gpgme_trace_level = lvl; \
const char *const _gpgme_trace_func = name; \
const char *const _gpgme_trace_tagname = STRINGIFY (tag); \
void *_gpgme_trace_tag = (void *) (uintptr_t) tag
void *_gpgme_trace_tag = (void *) (uintptr_t) tag; \
_gpgme_debug_frame_begin ()
#define TRACE_BEG(lvl, name, tag) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func), 0
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag), 0
#define TRACE_BEG0(lvl, name, tag, fmt) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func), 0
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag), 0
#define TRACE_BEG1(lvl, name, tag, fmt, arg1) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1), 0
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1), 0
#define TRACE_BEG2(lvl, name, tag, fmt, arg1, arg2) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1, arg2), 0
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2), 0
#define TRACE_BEG3(lvl, name, tag, fmt, arg1, arg2, arg3) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1, arg2, arg3), 0
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3), 0
#define TRACE_BEG4(lvl, name, tag, fmt, arg1, arg2, arg3, arg4) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1, arg2, arg3, arg4), 0
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4), 0
#define TRACE_BEG5(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), 0
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4, arg5), 0
#define TRACE_BEG7(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \
arg5, arg6, arg7) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1, arg2, arg3, arg4, arg5, \
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4, arg5, \
arg6, arg7), 0
#define TRACE_BEG8(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, \
arg5, arg6, arg7, arg8) \
_TRACE (lvl, name, tag); \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: enter: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1, arg2, arg3, arg4, arg5, \
_gpgme_debug (_gpgme_trace_level, "%s: enter: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4, arg5, \
arg6, arg7, arg8), 0
#define TRACE(lvl, name, tag) \
_gpgme_debug (lvl, "[%s=%p] %s: call\n", \
STRINGIFY (tag), (void *) (uintptr_t) tag, name), 0
_gpgme_debug_frame_begin (), \
_gpgme_debug (lvl, "%s: call: %s=%p\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag), \
_gpgme_debug_frame_end (), 0
#define TRACE0(lvl, name, tag, fmt) \
_gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
STRINGIFY (tag), (void *) (uintptr_t) tag, name), 0
_gpgme_debug_frame_begin (), \
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag), \
_gpgme_debug_frame_end (), 0
#define TRACE1(lvl, name, tag, fmt, arg1) \
_gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
STRINGIFY (tag), (void *) (uintptr_t) tag, name, arg1), 0
_gpgme_debug_frame_begin (), \
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1), \
_gpgme_debug_frame_end (), 0
#define TRACE2(lvl, name, tag, fmt, arg1, arg2) \
_gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
STRINGIFY (tag), (void *) (uintptr_t) tag, name, arg1, \
arg2), 0
_gpgme_debug_frame_begin (), \
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
arg2), _gpgme_debug_frame_end (), 0
#define TRACE3(lvl, name, tag, fmt, arg1, arg2, arg3) \
_gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
STRINGIFY (tag), (void *) (uintptr_t) tag, name, arg1, \
arg2, arg3), 0
_gpgme_debug_frame_begin (), \
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
arg2, arg3), _gpgme_debug_frame_end (), 0
#define TRACE6(lvl, name, tag, fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
_gpgme_debug (lvl, "[%s=%p] %s: call: " fmt "\n", \
STRINGIFY (tag), (void *) (uintptr_t) tag, name, arg1, \
arg2, arg3, arg4, arg5, arg6), 0
_gpgme_debug_frame_begin (), \
_gpgme_debug (lvl, "%s: call: %s=%p, " fmt "\n", \
name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
arg2, arg3, arg4, arg5, arg6), \
_gpgme_debug_frame_end (), 0
#define TRACE_ERR(err) \
err == 0 ? (TRACE_SUC ()) : \
(_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: error: %s <%s>\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
(_gpgme_debug (_gpgme_trace_level, "%s: error: %s <%s>\n", \
_gpgme_trace_func, gpgme_strerror (err), \
gpgme_strsource (err)), (err))
gpgme_strsource (err)), _gpgme_debug_frame_end (), (err))
/* The cast to void suppresses GCC warnings. */
#define TRACE_SYSRES(res) \
res >= 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \
(_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: error: %s\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, strerror (errno)), (res))
(_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \
_gpgme_trace_func, strerror (errno)), _gpgme_debug_frame_end (), (res))
#define TRACE_SYSERR(res) \
res == 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) : \
(_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: error: %s\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, strerror (res)), (res))
(_gpgme_debug (_gpgme_trace_level, "%s: error: %s\n", \
_gpgme_trace_func, strerror (res)), \
_gpgme_debug_frame_end (), (res))
#define TRACE_SUC() \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func), 0
_gpgme_debug (_gpgme_trace_level, "%s: leave\n", \
_gpgme_trace_func), _gpgme_debug_frame_end (), 0
#define TRACE_SUC0(fmt) \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func), 0
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
_gpgme_trace_func), _gpgme_debug_frame_end (), 0
#define TRACE_SUC1(fmt, arg1) \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1), 0
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
_gpgme_trace_func, arg1), _gpgme_debug_frame_end (), 0
#define TRACE_SUC2(fmt, arg1, arg2) \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1, arg2), 0
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
_gpgme_trace_func, arg1, arg2), _gpgme_debug_frame_end (), 0
#define TRACE_SUC5(fmt, arg1, arg2, arg3, arg4, arg5) \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: leave: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), 0
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
_gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), \
_gpgme_debug_frame_end (), 0
#define TRACE_LOG(fmt) \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func), 0
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag), 0
#define TRACE_LOG1(fmt, arg1) \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1), 0
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1), 0
#define TRACE_LOG2(fmt, arg1, arg2) \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1, arg2), 0
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2), 0
#define TRACE_LOG3(fmt, arg1, arg2, arg3) \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1, arg2, arg3), 0
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3), 0
#define TRACE_LOG4(fmt, arg1, arg2, arg3, arg4) \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1, arg2, arg3, arg4), 0
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4), 0
#define TRACE_LOG5(fmt, arg1, arg2, arg3, arg4, arg5) \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), 0
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4, arg5), 0
#define TRACE_LOG6(fmt, arg1, arg2, arg3, arg4, arg5, arg6) \
_gpgme_debug (_gpgme_trace_level, "[%s=%p] %s: check: " fmt "\n", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func, arg1, arg2, arg3, arg4, arg5, \
_gpgme_debug (_gpgme_trace_level, "%s: check: %s=%p, " fmt "\n", \
_gpgme_trace_func, _gpgme_trace_tagname, _gpgme_trace_tag, \
arg1, arg2, arg3, arg4, arg5, \
arg6), 0
#define TRACE_LOGBUF(buf, len) \
_gpgme_debug_buffer (_gpgme_trace_level, "[%s=%p] %s: check: %s", \
_gpgme_trace_tagname, _gpgme_trace_tag, \
#define TRACE_LOGBUF(buf, len) \
_gpgme_debug_buffer (_gpgme_trace_level, "%s: check: %s", \
_gpgme_trace_func, buf, len)
#define TRACE_SEQ(hlp,fmt) \
_gpgme_debug_begin (&(hlp), _gpgme_trace_level, \
"[%s=%p] %s: check: " fmt, \
_gpgme_trace_tagname, _gpgme_trace_tag, \
_gpgme_trace_func)
"%s: check: %s=%p, " fmt, _gpgme_trace_func, \
_gpgme_trace_tagname, _gpgme_trace_tag)
#define TRACE_ADD0(hlp,fmt) \
_gpgme_debug_add (&(hlp), fmt)
#define TRACE_ADD1(hlp,fmt,a) \

View File

@ -273,7 +273,7 @@ get_max_fds (void)
fds = 1024;
}
TRACE2 (DEBUG_SYSIO, "gpgme:max_fds", NULL, "max fds=%i (%s)", fds, source);
TRACE2 (DEBUG_SYSIO, "gpgme:max_fds", 0, "max fds=%i (%s)", fds, source);
return fds;
}

View File

@ -73,9 +73,6 @@ do_subsystem_inits (void)
#endif
_gpgme_sema_subsystem_init ();
#ifdef HAVE_ASSUAN_H
assuan_set_assuan_err_source (GPG_ERR_SOURCE_GPGME);
#endif /*HAVE_ASSUAN_H*/
_gpgme_debug_subsystem_init ();
_gpgme_io_subsystem_init ();
#if defined(HAVE_W32_SYSTEM) && defined(HAVE_ASSUAN_H)
@ -196,7 +193,7 @@ gpgme_check_version (const char *req_version)
before using the trace facility. If we won't the trace would
automagically initialize the debug system with out the locks
being initialized and missing the assuan log level setting. */
TRACE2 (DEBUG_INIT, "gpgme_check_version: ", 0,
TRACE2 (DEBUG_INIT, "gpgme_check_version", 0,
"req_version=%s, VERSION=%s",
req_version? req_version:"(null)", VERSION);
@ -221,13 +218,13 @@ gpgme_check_version_internal (const char *req_version,
return result;
/* Catch-22, see above. */
TRACE2 (DEBUG_INIT, "gpgme_check_version_internal: ", 0,
TRACE2 (DEBUG_INIT, "gpgme_check_version_internal", 0,
"req_version=%s, offset_sig_validity=%i",
req_version ? req_version : "(null)", offset_sig_validity);
if (offset_sig_validity != offsetof (struct _gpgme_signature, validity))
{
TRACE1 (DEBUG_INIT, "gpgme_check_version_internal: ", 0,
TRACE1 (DEBUG_INIT, "gpgme_check_version_internal", 0,
"offset_sig_validity mismatch: expected %i",
offsetof (struct _gpgme_signature, validity));
_gpgme_selftest = GPG_ERR_SELFTEST_FAILED;