aboutsummaryrefslogtreecommitdiffstats
path: root/src/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug.h')
-rw-r--r--src/debug.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/debug.h b/src/debug.h
index fa0bfc6c..7b823ee1 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -141,7 +141,7 @@ _trace_err (gpg_error_t err, int lvl, const char *func, int line)
return err;
}
-/* Trace a system call result and return it. */
+/* Trace a system call result of type int and return it. */
#define TRACE_SYSRES(res) \
_trace_sysres ((res), _gpgme_trace_level, _gpgme_trace_func, __LINE__)
static inline int
@@ -157,6 +157,38 @@ _trace_sysres (int res, int lvl, const char *func, int line)
return res;
}
+/* Trace a system call result of type gpgme_off_t and return it. */
+#define TRACE_SYSRES_OFF_T(res) \
+ _trace_sysres_off_t ((res), _gpgme_trace_level, _gpgme_trace_func, __LINE__)
+static inline gpgme_off_t
+_trace_sysres_off_t (gpgme_off_t res, int lvl, const char *func, int line)
+{
+ if (res >= 0)
+ _gpgme_debug (NULL, lvl, 3, func, NULL, NULL, "result=%ld", res);
+ else
+ _gpgme_debug (NULL, lvl, -1, NULL, NULL, NULL,
+ "%s:%d: error: %s (%d)\n",
+ func, line, strerror (errno), errno);
+ _gpgme_debug_frame_end ();
+ return res;
+}
+
+/* Trace a system call result of type gpgme_ssize_t and return it. */
+#define TRACE_SYSRES_SSIZE_T(res) \
+ _trace_sysres_ssize_t ((res), _gpgme_trace_level, _gpgme_trace_func, __LINE__)
+static inline gpgme_ssize_t
+_trace_sysres_ssize_t (gpgme_ssize_t res, int lvl, const char *func, int line)
+{
+ if (res >= 0)
+ _gpgme_debug (NULL, lvl, 3, func, NULL, NULL, "result=%zd", res);
+ else
+ _gpgme_debug (NULL, lvl, -1, NULL, NULL, NULL,
+ "%s:%d: error: %s (%d)\n",
+ func, line, strerror (errno), errno);
+ _gpgme_debug_frame_end ();
+ return res;
+}
+
/* Trace a system call error and return it. */
#define TRACE_SYSERR(rc) \
_trace_syserr ((rc), _gpgme_trace_level, _gpgme_trace_func, __LINE__)