[Pkg-gnupg-commit] [libassuan] 286/437: 2010-01-05 Marcus Brinkmann <marcus at g10code.de>

Eric Dorland eric at moszumanska.debian.org
Fri May 22 05:33:54 UTC 2015


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository libassuan.

commit 28f8339ed1e0a21719dd972cec274732a2d35a91
Author: Marcus Brinkmann <mb at g10code.com>
Date:   Tue Jan 5 04:09:05 2010 +0000

    2010-01-05  Marcus Brinkmann  <marcus at g10code.de>
    
    	* debug.h (TRACE_LOG5): Add macro.
    	* debug.c (_assuan_debug_buffer): Add newline
    	* system.c: Add more debug output (conditioned on the compile-time
    	DEBUG_SYSIO macro).
---
 src/ChangeLog |  7 +++++++
 src/debug.c   |  3 ++-
 src/debug.h   |  5 +++++
 src/system.c  | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 78 insertions(+), 3 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index c5469c7..9e0d9b4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2010-01-05  Marcus Brinkmann  <marcus at g10code.de>
+
+	* debug.h (TRACE_LOG5): Add macro.
+	* debug.c (_assuan_debug_buffer): Add newline
+	* system.c: Add more debug output (conditioned on the compile-time
+	DEBUG_SYSIO macro).
+
 2009-12-14  Werner Koch  <wk at g10code.com>
 
 	* assuan.h (ASSUAN_RESPONSE_COMMENT): New.
diff --git a/src/debug.c b/src/debug.c
index 37d15cb..0bdbfb5 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -173,8 +173,9 @@ _assuan_debug_buffer (assuan_context_t ctx, unsigned int cat,
 	    *(strp++) = ' ';
 	}
       *(strp++) = ' ';
+      *(strp2++) = '\n';
       *(strp2) = '\0';
-
+      
       _assuan_debug (ctx, cat, fmt, func, tagname, tag, str);
     }
 }
diff --git a/src/debug.h b/src/debug.h
index 4b4a41d..8d2771e 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -236,6 +236,11 @@ void _assuan_debug_buffer (assuan_context_t ctx, unsigned int cat,
 		 "%s (%s=%p): check: " fmt "\n",		    \
 		_assuan_trace_func, _assuan_trace_tagname,	    \
 		_assuan_trace_tag, arg1, arg2, arg3, arg4), 0
+#define TRACE_LOG5(fmt, arg1, arg2, arg3, arg4, arg5)		    \
+  _assuan_debug (_assuan_trace_context, _assuan_trace_level,	    \
+		 "%s (%s=%p): check: " fmt "\n",		    \
+		_assuan_trace_func, _assuan_trace_tagname,	    \
+		 _assuan_trace_tag, arg1, arg2, arg3, arg4, arg5), 0
 #define TRACE_LOG6(fmt, arg1, arg2, arg3, arg4, arg5, arg6)	    \
   _assuan_debug (_assuan_trace_context, _assuan_trace_level,	    \
 		 "%s (%s=%p): check: " fmt "\n",			\
diff --git a/src/system.c b/src/system.c
index ad17854..22019fb 100644
--- a/src/system.c
+++ b/src/system.c
@@ -43,6 +43,8 @@
 #define MAX_OPEN_FDS 20
 #endif
 
+#define DEBUG_SYSIO 0
+
 

 assuan_fd_t
 assuan_fdopen (int fd)
@@ -349,7 +351,7 @@ __assuan_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size)
 ssize_t
 _assuan_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size)
 {
-#if 0
+#if DEBUG_SYSIO
   ssize_t res;
   TRACE_BEG3 (ctx, ASSUAN_LOG_SYSIO, "_assuan_read", ctx,
 	      "fd=0x%x, buffer=%p, size=%i", fd, buffer, size);
@@ -406,7 +408,7 @@ ssize_t
 _assuan_write (assuan_context_t ctx, assuan_fd_t fd, const void *buffer,
 	       size_t size)
 {
-#if 0
+#if DEBUG_SYSIO
   ssize_t res;
   TRACE_BEG3 (ctx, ASSUAN_LOG_SYSIO, "_assuan_write", ctx,
 	      "fd=0x%x, buffer=%p, size=%i", fd, buffer, size);
@@ -440,7 +442,33 @@ int
 _assuan_recvmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg,
 		 int flags)
 {
+#if DEBUG_SYSIO
+  ssize_t res;
+  TRACE_BEG3 (ctx, ASSUAN_LOG_SYSIO, "_assuan_recvmsg", ctx,
+	      "fd=0x%x, msg=%p, flags=0x%x", fd, msg, flags);
+  res = (ctx->system.recvmsg) (ctx, fd, msg, flags);
+  if (res > 0)
+    {
+      struct cmsghdr *cmptr;
+
+      TRACE_LOG2 ("msg->msg_iov[0] = { iov_base=%p, iov_len=%i }",
+		  msg->msg_iov[0].iov_base, msg->msg_iov[0].iov_len);
+      TRACE_LOGBUF (msg->msg_iov[0].iov_base, res);
+
+      cmptr = CMSG_FIRSTHDR (msg);
+      if (cmptr)
+	{
+	  void *data = CMSG_DATA (cmptr);
+	  TRACE_LOG5 ("cmsg_len=0x%x (0x%x data), cmsg_level=0x%x, "
+		      "cmsg_type=0x%x, first data int=0x%x", cmptr->cmsg_len,
+		      cmptr->cmsg_len - (((char *)data) - ((char *)cmptr)),
+		      cmptr->cmsg_level, cmptr->cmsg_type, *(int *)data);
+	}
+    }    
+  return TRACE_SYSRES (res);
+#else
   return (ctx->system.recvmsg) (ctx, fd, msg, flags);
+#endif
 }
 
 

@@ -466,7 +494,32 @@ int
 _assuan_sendmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg,
 		 int flags)
 {
+#if DEBUG_SYSIO
+  ssize_t res;
+  TRACE_BEG3 (ctx, ASSUAN_LOG_SYSIO, "_assuan_sendmsg", ctx,
+	      "fd=0x%x, msg=%p, flags=0x%x", fd, msg, flags);
+  {
+    struct cmsghdr *cmptr;
+
+    TRACE_LOG2 ("msg->iov[0] = { iov_base=%p, iov_len=%i }",
+		msg->msg_iov[0].iov_base, msg->msg_iov[0].iov_len);
+    TRACE_LOGBUF (msg->msg_iov[0].iov_base, msg->msg_iov[0].iov_len);
+    
+    cmptr = CMSG_FIRSTHDR (msg);
+    if (cmptr)
+      {
+	void *data = CMSG_DATA (cmptr);
+	TRACE_LOG5 ("cmsg_len=0x%x (0x%x data), cmsg_level=0x%x, "
+		    "cmsg_type=0x%x, first data int=0x%x", cmptr->cmsg_len,
+		    cmptr->cmsg_len - (((char *)data) - ((char *)cmptr)),
+		    cmptr->cmsg_level, cmptr->cmsg_type, *(int *)data);
+      }
+  }
+  res = (ctx->system.sendmsg) (ctx, fd, msg, flags);
+  return TRACE_SYSRES (res);
+#else
   return (ctx->system.sendmsg) (ctx, fd, msg, flags);
+#endif
 }
 
 

@@ -877,7 +930,16 @@ pid_t
 _assuan_waitpid (assuan_context_t ctx, pid_t pid, int action,
 		 int *status, int options)
 {
+#if DEBUG_SYSIO
+  ssize_t res;
+  TRACE_BEG4 (ctx, ASSUAN_LOG_SYSIO, "_assuan_waitpid", ctx,
+	      "pid=%i, action=%i, status=%p, options=%i",
+	      pid, action, status, options);
+  res = (ctx->system.waitpid) (ctx, pid, action, status, options);
+  return TRACE_SYSRES (res);
+#else
   return (ctx->system.waitpid) (ctx, pid, action, status, options);
+#endif
 }
 
 


-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libassuan.git



More information about the Pkg-gnupg-commit mailing list