core: Introduce a context serial number.

* src/context.h: Include stdint.h.
(struct gpgme_context): Add field 'serial'.
(CTXSERIAL): New.
* src/gpgme.c: (last_ctx_serial): New.
(gpgme_new): Set serial.

* src/gpgme.c: Change trace calls to use the serial.
* src/wait.c (_gpgme_add_io_cb): Ditto
(_gpgme_remove_io_cb): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2019-06-07 12:10:40 +02:00
parent 52d8ed8dfb
commit 92883efe71
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
3 changed files with 135 additions and 97 deletions

View File

@ -21,6 +21,8 @@
#ifndef CONTEXT_H
#define CONTEXT_H
#include <stdint.h>
#include "gpgme.h"
#include "engine.h"
#include "wait.h"
@ -78,6 +80,12 @@ struct gpgme_context
{
DECLARE_LOCK (lock);
/* The unique serial number of this context object. This is used
* for a weak reference of the context. Using the address of the
* context is not always possible becuase it might have already been
* freed and reused. */
uint64_t serial;
/* True if the context was canceled asynchronously. */
int canceled;
@ -186,4 +194,9 @@ struct gpgme_context
struct gpgme_io_cbs io_cbs;
};
/* Macro to retrieve the serial number. Returns 0 if CTX is NULL. */
#define CTXSERIAL(ctx) (ctx? (unsigned long)ctx->serial : 0)
#endif /* CONTEXT_H */

View File

@ -42,11 +42,19 @@
#include "mbox-util.h"
/* The default locale. */
/* The default locale and its lock. This lock is also used for the
* context serial number. */
DEFINE_STATIC_LOCK (def_lc_lock);
static char *def_lc_ctype;
static char *def_lc_messages;
/* A serial number to identify a context. To make debugging easier by
* distinguishing this from the data object s/n we initialize it with
* an arbitrary offset. Debug output of this should be done using
* decimal notation. Updates are protected by the DEF_LC_LOCK. */
static uint64_t last_ctx_serial = 200000;
gpgme_error_t _gpgme_selftest = GPG_ERR_NOT_OPERATIONAL;
@ -94,7 +102,7 @@ gpgme_new (gpgme_ctx_t *r_ctx)
{
gpgme_error_t err;
gpgme_ctx_t ctx;
TRACE_BEG (DEBUG_CTX, "gpgme_new", r_ctx, "");
TRACE_BEG (DEBUG_CTX, "gpgme_new", NULL, "");
if (_gpgme_selftest)
return TRACE_ERR (_gpgme_selftest);
@ -155,11 +163,14 @@ gpgme_new (gpgme_ctx_t *r_ctx)
}
else
def_lc_messages = NULL;
ctx->serial = ++last_ctx_serial;
UNLOCK (def_lc_lock);
*r_ctx = ctx;
TRACE_SUC ("ctx=%p", ctx);
TRACE_SUC ("ctx=%lu (%p)", CTXSERIAL(ctx), ctx);
return 0;
}
@ -171,8 +182,9 @@ _gpgme_cancel_with_err (gpgme_ctx_t ctx, gpg_error_t ctx_err,
gpgme_error_t err;
struct gpgme_io_event_done_data data;
TRACE_BEG (DEBUG_CTX, "_gpgme_cancel_with_err", ctx, "ctx_err=%i, op_err=%i",
ctx_err, op_err);
TRACE_BEG (DEBUG_CTX, "_gpgme_cancel_with_err", NULL,
"ctx=%lu ctx_err=%i op_err=%i",
CTXSERIAL (ctx), ctx_err, op_err);
if (ctx_err)
{
@ -202,7 +214,7 @@ gpgme_cancel (gpgme_ctx_t ctx)
{
gpg_error_t err;
TRACE_BEG (DEBUG_CTX, "gpgme_cancel", ctx, "");
TRACE_BEG (DEBUG_CTX, "gpgme_cancel", NULL, "ctx=%lu", CTXSERIAL (ctx));
if (!ctx)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
@ -217,7 +229,8 @@ gpgme_cancel (gpgme_ctx_t ctx)
gpgme_error_t
gpgme_cancel_async (gpgme_ctx_t ctx)
{
TRACE_BEG (DEBUG_CTX, "gpgme_cancel_async", ctx, "");
TRACE_BEG (DEBUG_CTX, "gpgme_cancel_async", NULL,
"ctx=%lu", CTXSERIAL (ctx));
if (!ctx)
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
@ -234,7 +247,7 @@ gpgme_cancel_async (gpgme_ctx_t ctx)
void
gpgme_release (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_release", ctx, "");
TRACE (DEBUG_CTX, "gpgme_release", NULL, "ctx=%lu", CTXSERIAL (ctx));
if (!ctx)
return;
@ -325,8 +338,8 @@ _gpgme_release_result (gpgme_ctx_t ctx)
gpgme_error_t
gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol)
{
TRACE_BEG (DEBUG_CTX, "gpgme_set_protocol", ctx, "protocol=%i (%s)",
protocol, gpgme_get_protocol_name (protocol)
TRACE_BEG (DEBUG_CTX, "gpgme_set_protocol", NULL, "ctx=%lu protocol=%i (%s)",
CTXSERIAL (ctx), protocol, gpgme_get_protocol_name (protocol)
? gpgme_get_protocol_name (protocol) : "invalid");
if (protocol != GPGME_PROTOCOL_OpenPGP
@ -360,8 +373,8 @@ gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol)
gpgme_protocol_t
gpgme_get_protocol (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_get_protocol", ctx,
"ctx->protocol=%i (%s)", ctx->protocol,
TRACE (DEBUG_CTX, "gpgme_get_protocol", NULL,
"ctx=%lu protocol=%i (%s)", CTXSERIAL (ctx), ctx->protocol,
gpgme_get_protocol_name (ctx->protocol)
? gpgme_get_protocol_name (ctx->protocol) : "invalid");
@ -372,8 +385,8 @@ gpgme_get_protocol (gpgme_ctx_t ctx)
gpgme_error_t
gpgme_set_sub_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol)
{
TRACE (DEBUG_CTX, "gpgme_set_sub_protocol", ctx, "protocol=%i (%s)",
protocol, gpgme_get_protocol_name (protocol)
TRACE (DEBUG_CTX, "gpgme_set_sub_protocol", NULL, "ctx=%lu protocol=%i (%s)",
CTXSERIAL (ctx), protocol, gpgme_get_protocol_name (protocol)
? gpgme_get_protocol_name (protocol) : "invalid");
if (!ctx)
@ -387,8 +400,9 @@ gpgme_set_sub_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol)
gpgme_protocol_t
gpgme_get_sub_protocol (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_get_sub_protocol", ctx,
"ctx->sub_protocol=%i (%s)", ctx->sub_protocol,
TRACE (DEBUG_CTX, "gpgme_get_sub_protocol", NULL,
"ctx=%lu sub_protocol=%i (%s)",
CTXSERIAL (ctx), ctx->sub_protocol,
gpgme_get_protocol_name (ctx->sub_protocol)
? gpgme_get_protocol_name (ctx->sub_protocol) : "invalid");
@ -444,8 +458,8 @@ gpgme_set_sender (gpgme_ctx_t ctx, const char *address)
{
char *p = NULL;
TRACE_BEG (DEBUG_CTX, "gpgme_set_sender", ctx, "sender='%s'",
address?address:"(null)");
TRACE_BEG (DEBUG_CTX, "gpgme_set_sender", NULL, "ctx=%lu sender='%s'",
CTXSERIAL (ctx), address?address:"(null)");
if (!ctx || (address && !(p = _gpgme_mailbox_from_userid (address))))
return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
@ -462,8 +476,8 @@ gpgme_set_sender (gpgme_ctx_t ctx, const char *address)
const char *
gpgme_get_sender (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_get_sender", ctx, "sender='%s'",
ctx?ctx->sender:"");
TRACE (DEBUG_CTX, "gpgme_get_sender", NULL, "ctx=%lu sender='%s'",
CTXSERIAL (ctx), ctx?ctx->sender:"");
return ctx->sender;
}
@ -473,8 +487,8 @@ gpgme_get_sender (gpgme_ctx_t ctx)
void
gpgme_set_armor (gpgme_ctx_t ctx, int use_armor)
{
TRACE (DEBUG_CTX, "gpgme_set_armor", ctx, "use_armor=%i (%s)",
use_armor, use_armor ? "yes" : "no");
TRACE (DEBUG_CTX, "gpgme_set_armor", NULL, "ctx=%lu use_armor=%i (%s)",
CTXSERIAL (ctx), use_armor, use_armor ? "yes" : "no");
if (!ctx)
return;
@ -487,8 +501,8 @@ gpgme_set_armor (gpgme_ctx_t ctx, int use_armor)
int
gpgme_get_armor (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_get_armor", ctx, "ctx->use_armor=%i (%s)",
ctx->use_armor, ctx->use_armor ? "yes" : "no");
TRACE (DEBUG_CTX, "gpgme_get_armor", NULL, "ctx=%lu use_armor=%i (%s)",
CTXSERIAL (ctx), ctx->use_armor, ctx->use_armor ? "yes" : "no");
return ctx->use_armor;
}
@ -502,9 +516,9 @@ gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value)
gpgme_error_t err = 0;
int abool;
TRACE (DEBUG_CTX, "gpgme_set_ctx_flag", ctx,
"name='%s' value='%s'",
name? name:"(null)", value?value:"(null)");
TRACE (DEBUG_CTX, "gpgme_set_ctx_flag", NULL,
"ctx=%lu name='%s' value='%s'",
CTXSERIAL (ctx), name? name:"(null)", value?value:"(null)");
abool = (value && *value)? !!atoi (value) : 0;
@ -635,8 +649,8 @@ gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name)
void
gpgme_set_textmode (gpgme_ctx_t ctx, int use_textmode)
{
TRACE (DEBUG_CTX, "gpgme_set_textmode", ctx, "use_textmode=%i (%s)",
use_textmode, use_textmode ? "yes" : "no");
TRACE (DEBUG_CTX, "gpgme_set_textmode", NULL, "ctx=%lu use_textmode=%i (%s)",
CTXSERIAL (ctx), use_textmode, use_textmode ? "yes" : "no");
if (!ctx)
return;
@ -648,8 +662,8 @@ gpgme_set_textmode (gpgme_ctx_t ctx, int use_textmode)
int
gpgme_get_textmode (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_get_textmode", ctx, "ctx->use_textmode=%i (%s)",
ctx->use_textmode, ctx->use_textmode ? "yes" : "no");
TRACE (DEBUG_CTX, "gpgme_get_textmode", NULL, "ctx=%lu use_textmode=%i (%s)",
CTXSERIAL (ctx), ctx->use_textmode, ctx->use_textmode ? "yes" : "no");
return ctx->use_textmode;
}
@ -659,8 +673,8 @@ gpgme_get_textmode (gpgme_ctx_t ctx)
void
gpgme_set_offline (gpgme_ctx_t ctx, int offline)
{
TRACE (DEBUG_CTX, "gpgme_set_offline", ctx, "offline=%i (%s)",
offline, offline ? "yes" : "no");
TRACE (DEBUG_CTX, "gpgme_set_offline", NULL, "ctx=%lu offline=%i (%s)",
CTXSERIAL (ctx), offline, offline ? "yes" : "no");
if (!ctx)
return;
@ -672,8 +686,8 @@ gpgme_set_offline (gpgme_ctx_t ctx, int offline)
int
gpgme_get_offline (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_get_offline", ctx, "ctx->offline=%i (%s)",
ctx->offline, ctx->offline ? "yes" : "no");
TRACE (DEBUG_CTX, "gpgme_get_offline", NULL, "ctx=%lu offline=%i (%s)",
CTXSERIAL (ctx), ctx->offline, ctx->offline ? "yes" : "no");
return ctx->offline;
}
@ -694,7 +708,8 @@ gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs)
else
ctx->include_certs = nr_of_certs;
TRACE (DEBUG_CTX, "gpgme_set_include_certs", ctx, "nr_of_certs=%i%s",
TRACE (DEBUG_CTX, "gpgme_set_include_certs", NULL, "ctx=%lu nr_of_certs=%i%s",
CTXSERIAL (ctx),
nr_of_certs, nr_of_certs == ctx->include_certs ? "" : " (-2)");
}
@ -704,8 +719,8 @@ gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs)
int
gpgme_get_include_certs (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_get_include_certs", ctx, "ctx->include_certs=%i",
ctx->include_certs);
TRACE (DEBUG_CTX, "gpgme_get_include_certs", NULL, "ctx=%lu include_certs=%i",
CTXSERIAL (ctx), ctx->include_certs);
return ctx->include_certs;
}
@ -716,8 +731,8 @@ gpgme_get_include_certs (gpgme_ctx_t ctx)
gpgme_error_t
gpgme_set_keylist_mode (gpgme_ctx_t ctx, gpgme_keylist_mode_t mode)
{
TRACE (DEBUG_CTX, "gpgme_set_keylist_mode", ctx, "keylist_mode=0x%x",
mode);
TRACE (DEBUG_CTX, "gpgme_set_keylist_mode", NULL, "ctx=%lu keylist_mode=0x%x",
CTXSERIAL (ctx), mode);
if (!ctx)
return gpg_error (GPG_ERR_INV_VALUE);
@ -731,8 +746,8 @@ gpgme_set_keylist_mode (gpgme_ctx_t ctx, gpgme_keylist_mode_t mode)
gpgme_keylist_mode_t
gpgme_get_keylist_mode (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_get_keylist_mode", ctx,
"ctx->keylist_mode=0x%x", ctx->keylist_mode);
TRACE (DEBUG_CTX, "gpgme_get_keylist_mode", NULL,
"ctx=%lu keylist_mode=0x%x", CTXSERIAL (ctx), ctx->keylist_mode);
return ctx->keylist_mode;
}
@ -741,8 +756,8 @@ gpgme_get_keylist_mode (gpgme_ctx_t ctx)
gpgme_error_t
gpgme_set_pinentry_mode (gpgme_ctx_t ctx, gpgme_pinentry_mode_t mode)
{
TRACE (DEBUG_CTX, "gpgme_set_pinentry_mode", ctx, "pinentry_mode=%u",
(unsigned int)mode);
TRACE (DEBUG_CTX, "gpgme_set_pinentry_mode", NULL, "ctx=%lu pinentry_mode=%u",
CTXSERIAL (ctx), (unsigned int)mode);
if (!ctx)
return gpg_error (GPG_ERR_INV_VALUE);
@ -768,8 +783,8 @@ gpgme_set_pinentry_mode (gpgme_ctx_t ctx, gpgme_pinentry_mode_t mode)
gpgme_pinentry_mode_t
gpgme_get_pinentry_mode (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_get_pinentry_mode", ctx,
"ctx->pinentry_mode=%u", (unsigned int)ctx->pinentry_mode);
TRACE (DEBUG_CTX, "gpgme_get_pinentry_mode", NULL, "ctx=%lu pinentry_mode=%u",
CTXSERIAL (ctx), (unsigned int)ctx->pinentry_mode);
return ctx->pinentry_mode;
}
@ -780,8 +795,8 @@ void
gpgme_set_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t cb,
void *cb_value)
{
TRACE (DEBUG_CTX, "gpgme_set_passphrase_cb", ctx,
"passphrase_cb=%p/%p", cb, cb_value);
TRACE (DEBUG_CTX, "gpgme_set_passphrase_cb", NULL,
"ctx=%lu passphrase_cb=%p/%p", CTXSERIAL (ctx), cb, cb_value);
if (!ctx)
return;
@ -797,9 +812,9 @@ void
gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *r_cb,
void **r_cb_value)
{
TRACE (DEBUG_CTX, "gpgme_get_passphrase_cb", ctx,
"ctx->passphrase_cb=%p/%p",
ctx->passphrase_cb, ctx->passphrase_cb_value);
TRACE (DEBUG_CTX, "gpgme_get_passphrase_cb", NULL,
"ctx=%lu passphrase_cb=%p/%p",
CTXSERIAL (ctx), ctx->passphrase_cb, ctx->passphrase_cb_value);
if (r_cb)
*r_cb = ctx->passphrase_cb;
if (r_cb_value)
@ -812,8 +827,8 @@ gpgme_get_passphrase_cb (gpgme_ctx_t ctx, gpgme_passphrase_cb_t *r_cb,
void
gpgme_set_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t cb, void *cb_value)
{
TRACE (DEBUG_CTX, "gpgme_set_progress_cb", ctx, "progress_cb=%p/%p",
cb, cb_value);
TRACE (DEBUG_CTX, "gpgme_set_progress_cb", NULL, "ctx=%lu progress_cb=%p/%p",
CTXSERIAL (ctx), cb, cb_value);
if (!ctx)
return;
@ -829,8 +844,8 @@ void
gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *r_cb,
void **r_cb_value)
{
TRACE (DEBUG_CTX, "gpgme_get_progress_cb", ctx, "ctx->progress_cb=%p/%p",
ctx->progress_cb, ctx->progress_cb_value);
TRACE (DEBUG_CTX, "gpgme_get_progress_cb", NULL, "ctx=%lu progress_cb=%p/%p",
CTXSERIAL (ctx), ctx->progress_cb, ctx->progress_cb_value);
if (r_cb)
*r_cb = ctx->progress_cb;
if (r_cb_value)
@ -843,8 +858,8 @@ gpgme_get_progress_cb (gpgme_ctx_t ctx, gpgme_progress_cb_t *r_cb,
void
gpgme_set_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t cb, void *cb_value)
{
TRACE (DEBUG_CTX, "gpgme_set_status_cb", ctx, "status_cb=%p/%p",
cb, cb_value);
TRACE (DEBUG_CTX, "gpgme_set_status_cb", NULL, "ctx=%lu status_cb=%p/%p",
CTXSERIAL (ctx), cb, cb_value);
if (!ctx)
return;
@ -860,7 +875,8 @@ void
gpgme_get_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t *r_cb,
void **r_cb_value)
{
TRACE (DEBUG_CTX, "gpgme_get_status_cb", ctx, "ctx->status_cb=%p/%p",
TRACE (DEBUG_CTX, "gpgme_get_status_cb", NULL, "ctx=%lu status_cb=%p/%p",
CTXSERIAL (ctx),
ctx ? ctx->status_cb : NULL, ctx ? ctx->status_cb_value : NULL);
if (r_cb)
@ -888,16 +904,17 @@ gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)
if (io_cbs)
{
TRACE (DEBUG_CTX, "gpgme_set_io_cbs", ctx,
"io_cbs=%p (add=%p/%p, remove=%p, event=%p/%p",
TRACE (DEBUG_CTX, "gpgme_set_io_cbs", NULL,
"ctx=%lu io_cbs=%p (add=%p/%p, remove=%p, event=%p/%p",
CTXSERIAL (ctx),
io_cbs, io_cbs->add, io_cbs->add_priv, io_cbs->remove,
io_cbs->event, io_cbs->event_priv);
ctx->io_cbs = *io_cbs;
}
else
{
TRACE (DEBUG_CTX, "gpgme_set_io_cbs", ctx,
"io_cbs=%p (default)", io_cbs);
TRACE (DEBUG_CTX, "gpgme_set_io_cbs", NULL,
"ctx=%lu io_cbs=%p (default)", CTXSERIAL (ctx), io_cbs);
ctx->io_cbs.add = NULL;
ctx->io_cbs.add_priv = NULL;
ctx->io_cbs.remove = NULL;
@ -913,8 +930,8 @@ gpgme_ssize_t
gpgme_io_read (int fd, void *buffer, size_t count)
{
int ret;
TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_read", fd,
"buffer=%p, count=%zu", buffer, count);
TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_read", NULL,
"fd=%d buffer=%p count=%zu", fd, buffer, count);
ret = _gpgme_io_read (fd, buffer, count);
@ -929,8 +946,8 @@ gpgme_ssize_t
gpgme_io_write (int fd, const void *buffer, size_t count)
{
int ret;
TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_write", fd,
"buffer=%p, count=%zu", buffer, count);
TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_write", NULL,
"fd=%d buffer=%p count=%zu", fd, buffer, count);
ret = _gpgme_io_write (fd, buffer, count);
@ -948,8 +965,9 @@ gpgme_io_writen (int fd, const void *buffer_arg, size_t count)
{
const char *buffer = buffer_arg;
int ret = 0;
TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_writen", fd,
"buffer=%p, count=%zu", buffer, count);
TRACE_BEG (DEBUG_GLOBAL, "gpgme_io_writen", NULL,
"fd=%d buffer=%p count=%zu", fd, buffer, count);
while (count)
{
ret = _gpgme_io_write (fd, buffer, count);
@ -967,8 +985,9 @@ gpgme_io_writen (int fd, const void *buffer_arg, size_t count)
void
gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)
{
TRACE (DEBUG_CTX, "gpgme_get_io_cbs", ctx,
"io_cbs=%p, ctx->io_cbs.add=%p/%p, .remove=%p, .event=%p/%p",
TRACE (DEBUG_CTX, "gpgme_get_io_cbs", NULL,
"ctx=%lu io_cbs=%p ctx->io_cbs.add=%p/%p .remove=%p, .event=%p/%p",
CTXSERIAL (ctx),
io_cbs, io_cbs->add, io_cbs->add_priv, io_cbs->remove,
io_cbs->event, io_cbs->event_priv);
@ -985,8 +1004,9 @@ gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value)
char *new_lc_ctype = NULL;
char *new_lc_messages = NULL;
TRACE_BEG (DEBUG_CTX, "gpgme_set_locale", ctx,
"category=%i, value=%s", category, value ? value : "(null)");
TRACE_BEG (DEBUG_CTX, "gpgme_set_locale", NULL,
"ctx=%lu category=%i value=%s",
CTXSERIAL (ctx), category, value ? value : "(null)");
#define PREPARE_ONE_LOCALE(lcat, ucat) \
if (!failed && value \
@ -1054,8 +1074,8 @@ gpgme_set_locale (gpgme_ctx_t ctx, int category, const char *value)
gpgme_engine_info_t
gpgme_ctx_get_engine_info (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_ctx_get_engine_info", ctx,
"ctx->engine_info=%p", ctx->engine_info);
TRACE (DEBUG_CTX, "gpgme_ctx_get_engine_info", NULL,
"ctx=%lu engine_info=%p", CTXSERIAL (ctx), ctx->engine_info);
return ctx->engine_info;
}
@ -1067,9 +1087,9 @@ gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, gpgme_protocol_t proto,
const char *file_name, const char *home_dir)
{
gpgme_error_t err;
TRACE_BEG (DEBUG_CTX, "gpgme_ctx_set_engine_info", ctx,
"protocol=%i (%s), file_name=%s, home_dir=%s",
proto, gpgme_get_protocol_name (proto)
TRACE_BEG (DEBUG_CTX, "gpgme_ctx_set_engine_info", NULL,
"ctx=%lu protocol=%i (%s), file_name=%s, home_dir=%s",
CTXSERIAL (ctx), proto, gpgme_get_protocol_name (proto)
? gpgme_get_protocol_name (proto) : "unknown",
file_name ? file_name : "(default)",
home_dir ? home_dir : "(default)");
@ -1112,7 +1132,8 @@ _gpgme_sig_notation_clear (gpgme_ctx_t ctx)
void
gpgme_sig_notation_clear (gpgme_ctx_t ctx)
{
TRACE (DEBUG_CTX, "gpgme_sig_notation_clear", ctx, "");
TRACE (DEBUG_CTX, "gpgme_sig_notation_clear", NULL, "ctx=%lu",
CTXSERIAL (ctx));
if (!ctx)
return;
@ -1134,8 +1155,9 @@ gpgme_sig_notation_add (gpgme_ctx_t ctx, const char *name,
gpgme_sig_notation_t notation;
gpgme_sig_notation_t *lastp;
TRACE_BEG (DEBUG_CTX, "gpgme_sig_notation_add", ctx,
"name=%s, value=%s, flags=0x%x",
TRACE_BEG (DEBUG_CTX, "gpgme_sig_notation_add", NULL,
"ctx=%lu name=%s value=%s flags=0x%x",
CTXSERIAL (ctx),
name ? name : "(null)", value ? value : "(null)",
flags);
@ -1167,11 +1189,12 @@ gpgme_sig_notation_get (gpgme_ctx_t ctx)
{
if (!ctx)
{
TRACE (DEBUG_CTX, "gpgme_sig_notation_get", ctx, "");
TRACE (DEBUG_CTX, "gpgme_sig_notation_get", NULL, "ctx=%lu",
CTXSERIAL (ctx));
return NULL;
}
TRACE (DEBUG_CTX, "gpgme_sig_notation_get", ctx,
"ctx->sig_notations=%p", ctx->sig_notations);
TRACE (DEBUG_CTX, "gpgme_sig_notation_get", NULL,
"ctx=%lu sig_notations=%p", CTXSERIAL (ctx), ctx->sig_notations);
return ctx->sig_notations;
}

View File

@ -136,8 +136,8 @@ _gpgme_add_io_cb (void *data, int fd, int dir, gpgme_io_cb_t fnc,
return err;
}
TRACE (DEBUG_CTX, "_gpgme_add_io_cb", ctx,
"fd=%d, dir=%d -> tag=%p", fd, dir, tag);
TRACE (DEBUG_CTX, "_gpgme_add_io_cb", NULL,
"ctx=%lu fd=%d dir=%d -> tag=%p", CTXSERIAL (ctx), fd, dir, tag);
*r_tag = tag;
return 0;
@ -159,9 +159,11 @@ _gpgme_remove_io_cb (void *data)
assert (fdt);
idx = tag->idx;
TRACE (DEBUG_CTX, "_gpgme_remove_io_cb", data,
"setting fd 0x%x (item=%p) done", fdt->fds[idx].fd,
fdt->fds[idx].opaque);
TRACE (DEBUG_CTX, "_gpgme_remove_io_cb", NULL,
"ctx=%lu setting fd=%d (item=%p data=%p) done",
CTXSERIAL (ctx),
fdt->fds[idx].fd,
fdt->fds[idx].opaque, data);
free (fdt->fds[idx].opaque);
free (tag);