[sr-dev] git:master: pass_fd.c: logging: convert LOG to LM_*

Ovidiu Sas osas at voipembedded.com
Fri Oct 3 21:12:34 CEST 2014


Module: sip-router
Branch: master
Commit: a7652a586b7dc03369b0824b08ac721c02b83dc4
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a7652a586b7dc03369b0824b08ac721c02b83dc4

Author: Ovidiu Sas <osas at voipembedded.com>
Committer: Ovidiu Sas <osas at voipembedded.com>
Date:   Fri Oct  3 15:12:27 2014 -0400

pass_fd.c: logging: convert LOG to LM_*

---

 pass_fd.c |   39 +++++++++++++++++++--------------------
 1 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/pass_fd.c b/pass_fd.c
index 05bbd2d..461bd7f 100644
--- a/pass_fd.c
+++ b/pass_fd.c
@@ -99,7 +99,7 @@ again:
 		if (errno==EINTR) goto again; /* signal, try again */
 		/* on EAGAIN just return (let the caller know) */
 		if ((errno==EAGAIN)||(errno==EWOULDBLOCK)) return n;
-			LOG(L_CRIT, "ERROR: recv_all: 1st recv on %d failed: %s\n",
+			LM_CRIT("1st recv on %d failed: %s\n",
 					socket, strerror(errno));
 			return n;
 	}
@@ -124,13 +124,13 @@ poll_retry:
 				n=poll(&pfd, 1, -1);
 				if (n<0){ 
 					if (errno==EINTR) goto poll_retry;
-					LOG(L_CRIT, "ERROR: recv_all: poll on %d failed: %s\n",
-								socket, strerror(errno));
+					LM_CRIT("poll on %d failed: %s\n",
+						socket, strerror(errno));
 					return n;
 				} else continue; /* try recv again */
 			}
 #endif /* NO_MSG_WAITALL */
-			LOG(L_CRIT, "ERROR: recv_all: 2nd recv on %d failed: %s\n",
+			LM_CRIT("2nd recv on %d failed: %s\n",
 					socket, strerror(errno));
 			return n;
 		}
@@ -153,7 +153,7 @@ again:
 			/* error */
 		if (errno==EINTR) goto again; /* signal, try again */
 		if ((errno!=EAGAIN) &&(errno!=EWOULDBLOCK))
-			LOG(L_CRIT, "ERROR: send_all: send on %d failed: %s\n",
+			LM_CRIT("send on %d failed: %s\n",
 					socket, strerror(errno));
 	}
 	return n;
@@ -205,8 +205,8 @@ again:
 	if (ret<0){
 		if (errno==EINTR) goto again;
 		if ((errno!=EAGAIN) && (errno!=EWOULDBLOCK))
-			LOG(L_CRIT, "ERROR: send_fd: sendmsg failed sending %d on %d:"
-						" %s (%d)\n", fd, unix_socket, strerror(errno), errno);
+			LM_CRIT("sendmsg failed sending %d on %d: %s (%d)\n",
+				fd, unix_socket, strerror(errno), errno);
 	}
 	
 	return ret;
@@ -278,24 +278,24 @@ poll_again:
 				ret=poll(&pfd, 1, -1);
 				if (ret>=0) goto again;
 				else if (errno==EINTR) goto poll_again;
-				LOG(L_CRIT, "ERROR: receive_fd: poll on %d failed: %s\n",
-							unix_socket, strerror(errno));
+				LM_CRIT("poll on %d failed: %s\n",
+					unix_socket, strerror(errno));
 			}
 #endif /* NO_MSG_WAITALL */
 			goto error;
 		}
-		LOG(L_CRIT, "ERROR: receive_fd: recvmsg on %d failed: %s\n",
+		LM_CRIT("recvmsg on %d failed: %s\n",
 				unix_socket, strerror(errno));
 		goto error;
 	}
 	if (ret==0){
 		/* EOF */
-		LOG(L_CRIT, "ERROR: receive_fd: EOF on %d\n", unix_socket);
+		LM_CRIT("EOF on %d\n", unix_socket);
 		goto error;
 	}
 	if (ret<data_len){
-		LOG(L_WARN, "WARNING: receive_fd: too few bytes read (%d from %d)"
-				    "trying to fix...\n", ret, data_len);
+		LM_WARN("too few bytes read (%d from %d) trying to fix...\n",
+				ret, data_len);
 		/* blocking recv_all */
 		n=recv_all(unix_socket, (char*)data+ret, data_len-ret, MSG_WAITALL);
 		if (n>=0) ret+=n;
@@ -309,21 +309,20 @@ poll_again:
 	cmsg=CMSG_FIRSTHDR(&msg);
 	if ((cmsg!=0) && (cmsg->cmsg_len==CMSG_LEN(sizeof(new_fd)))){
 		if (cmsg->cmsg_type!= SCM_RIGHTS){
-			LOG(L_ERR, "ERROR: receive_fd: msg control type != SCM_RIGHTS\n");
+			LM_ERR("msg control type != SCM_RIGHTS\n");
 			ret=-1;
 			goto error;
 		}
 		if (cmsg->cmsg_level!= SOL_SOCKET){
-			LOG(L_ERR, "ERROR: receive_fd: msg level != SOL_SOCKET\n");
+			LM_ERR("msg level != SOL_SOCKET\n");
 			ret=-1;
 			goto error;
 		}
 		pi=(int*) CMSG_DATA(cmsg);
 		*fd=*pi;
 	}else{
-		/*
-		LOG(L_ERR, "ERROR: receive_fd: no descriptor passed, cmsg=%p,"
-				"len=%d\n", cmsg, (unsigned)cmsg->cmsg_len); */
+		/*LM_ERR("no descriptor passed, cmsg=%p, len=%d\n",
+			cmsg, (unsigned)cmsg->cmsg_len); */
 		*fd=-1;
 		/* it's not really an error */
 	}
@@ -331,8 +330,8 @@ poll_again:
 	if (msg.msg_accrightslen==sizeof(int)){
 		*fd=new_fd;
 	}else{
-		/*LOG(L_ERR, "ERROR: receive_fd: no descriptor passed,"
-				" accrightslen=%d\n", msg.msg_accrightslen); */
+		/*LM_ERR("no descriptor passed, accrightslen=%d\n",
+			msg.msg_accrightslen); */
 		*fd=-1;
 	}
 #endif




More information about the sr-dev mailing list