Browse code

pass_fd.c: logging: convert LOG to LM_*

Ovidiu Sas authored on 03/10/2014 19:12:27
Showing 1 changed files
... ...
@@ -99,7 +99,7 @@ again:
99 99
 		if (errno==EINTR) goto again; /* signal, try again */
100 100
 		/* on EAGAIN just return (let the caller know) */
101 101
 		if ((errno==EAGAIN)||(errno==EWOULDBLOCK)) return n;
102
-			LOG(L_CRIT, "ERROR: recv_all: 1st recv on %d failed: %s\n",
102
+			LM_CRIT("1st recv on %d failed: %s\n",
103 103
 					socket, strerror(errno));
104 104
 			return n;
105 105
 	}
... ...
@@ -124,13 +124,13 @@ poll_retry:
124 124
 				n=poll(&pfd, 1, -1);
125 125
 				if (n<0){ 
126 126
 					if (errno==EINTR) goto poll_retry;
127
-					LOG(L_CRIT, "ERROR: recv_all: poll on %d failed: %s\n",
128
-								socket, strerror(errno));
127
+					LM_CRIT("poll on %d failed: %s\n",
128
+						socket, strerror(errno));
129 129
 					return n;
130 130
 				} else continue; /* try recv again */
131 131
 			}
132 132
 #endif /* NO_MSG_WAITALL */
133
-			LOG(L_CRIT, "ERROR: recv_all: 2nd recv on %d failed: %s\n",
133
+			LM_CRIT("2nd recv on %d failed: %s\n",
134 134
 					socket, strerror(errno));
135 135
 			return n;
136 136
 		}
... ...
@@ -153,7 +153,7 @@ again:
153 153
 			/* error */
154 154
 		if (errno==EINTR) goto again; /* signal, try again */
155 155
 		if ((errno!=EAGAIN) &&(errno!=EWOULDBLOCK))
156
-			LOG(L_CRIT, "ERROR: send_all: send on %d failed: %s\n",
156
+			LM_CRIT("send on %d failed: %s\n",
157 157
 					socket, strerror(errno));
158 158
 	}
159 159
 	return n;
... ...
@@ -205,8 +205,8 @@ again:
205 205
 	if (ret<0){
206 206
 		if (errno==EINTR) goto again;
207 207
 		if ((errno!=EAGAIN) && (errno!=EWOULDBLOCK))
208
-			LOG(L_CRIT, "ERROR: send_fd: sendmsg failed sending %d on %d:"
209
-						" %s (%d)\n", fd, unix_socket, strerror(errno), errno);
208
+			LM_CRIT("sendmsg failed sending %d on %d: %s (%d)\n",
209
+				fd, unix_socket, strerror(errno), errno);
210 210
 	}
211 211
 	
212 212
 	return ret;
... ...
@@ -278,24 +278,24 @@ poll_again:
278 278
 				ret=poll(&pfd, 1, -1);
279 279
 				if (ret>=0) goto again;
280 280
 				else if (errno==EINTR) goto poll_again;
281
-				LOG(L_CRIT, "ERROR: receive_fd: poll on %d failed: %s\n",
282
-							unix_socket, strerror(errno));
281
+				LM_CRIT("poll on %d failed: %s\n",
282
+					unix_socket, strerror(errno));
283 283
 			}
284 284
 #endif /* NO_MSG_WAITALL */
285 285
 			goto error;
286 286
 		}
287
-		LOG(L_CRIT, "ERROR: receive_fd: recvmsg on %d failed: %s\n",
287
+		LM_CRIT("recvmsg on %d failed: %s\n",
288 288
 				unix_socket, strerror(errno));
289 289
 		goto error;
290 290
 	}
291 291
 	if (ret==0){
292 292
 		/* EOF */
293
-		LOG(L_CRIT, "ERROR: receive_fd: EOF on %d\n", unix_socket);
293
+		LM_CRIT("EOF on %d\n", unix_socket);
294 294
 		goto error;
295 295
 	}
296 296
 	if (ret<data_len){
297
-		LOG(L_WARN, "WARNING: receive_fd: too few bytes read (%d from %d)"
298
-				    "trying to fix...\n", ret, data_len);
297
+		LM_WARN("too few bytes read (%d from %d) trying to fix...\n",
298
+				ret, data_len);
299 299
 		/* blocking recv_all */
300 300
 		n=recv_all(unix_socket, (char*)data+ret, data_len-ret, MSG_WAITALL);
301 301
 		if (n>=0) ret+=n;
... ...
@@ -309,21 +309,20 @@ poll_again:
309 309
 	cmsg=CMSG_FIRSTHDR(&msg);
310 310
 	if ((cmsg!=0) && (cmsg->cmsg_len==CMSG_LEN(sizeof(new_fd)))){
311 311
 		if (cmsg->cmsg_type!= SCM_RIGHTS){
312
-			LOG(L_ERR, "ERROR: receive_fd: msg control type != SCM_RIGHTS\n");
312
+			LM_ERR("msg control type != SCM_RIGHTS\n");
313 313
 			ret=-1;
314 314
 			goto error;
315 315
 		}
316 316
 		if (cmsg->cmsg_level!= SOL_SOCKET){
317
-			LOG(L_ERR, "ERROR: receive_fd: msg level != SOL_SOCKET\n");
317
+			LM_ERR("msg level != SOL_SOCKET\n");
318 318
 			ret=-1;
319 319
 			goto error;
320 320
 		}
321 321
 		pi=(int*) CMSG_DATA(cmsg);
322 322
 		*fd=*pi;
323 323
 	}else{
324
-		/*
325
-		LOG(L_ERR, "ERROR: receive_fd: no descriptor passed, cmsg=%p,"
326
-				"len=%d\n", cmsg, (unsigned)cmsg->cmsg_len); */
324
+		/*LM_ERR("no descriptor passed, cmsg=%p, len=%d\n",
325
+			cmsg, (unsigned)cmsg->cmsg_len); */
327 326
 		*fd=-1;
328 327
 		/* it's not really an error */
329 328
 	}
... ...
@@ -331,8 +330,8 @@ poll_again:
331 331
 	if (msg.msg_accrightslen==sizeof(int)){
332 332
 		*fd=new_fd;
333 333
 	}else{
334
-		/*LOG(L_ERR, "ERROR: receive_fd: no descriptor passed,"
335
-				" accrightslen=%d\n", msg.msg_accrightslen); */
334
+		/*LM_ERR("no descriptor passed, accrightslen=%d\n",
335
+			msg.msg_accrightslen); */
336 336
 		*fd=-1;
337 337
 	}
338 338
 #endif