Browse code

io_wait.c: logging: convert LOG to LM_*

Ovidiu Sas authored on 03/10/2014 20:07:26
Showing 1 changed files
... ...
@@ -118,8 +118,8 @@ static int init_sigio(io_wait_h* h, int rsig)
118 118
 		n=SIGRTMAX-SIGRTMIN;
119 119
 	}else{
120 120
 		if ((rsig < SIGRTMIN) || (rsig >SIGRTMAX)){
121
-			LOG(L_CRIT, "ERROR: init_sigio: real time signal %d out of"
122
-					          " range  [%d, %d]\n", rsig, SIGRTMIN, SIGRTMAX);
121
+			LM_CRIT("real time signal %d out of range  [%d, %d]\n",
122
+					rsig, SIGRTMIN, SIGRTMAX);
123 123
 			goto error;
124 124
 		}
125 125
 		start_sig=rsig;
... ...
@@ -132,8 +132,7 @@ retry1:
132 132
 	/* get current block mask */
133 133
 	if (sigprocmask(SIG_BLOCK, &h->sset, &oldset )==-1){
134 134
 		if (errno==EINTR) goto retry1;
135
-		LOG(L_ERR, "ERROR: init_sigio: 1st sigprocmask failed: %s [%d]\n",
136
-				strerror(errno), errno);
135
+		LM_ERR("1st sigprocmask failed: %s [%d]\n", strerror(errno), errno);
137 136
 		/* try to continue */
138 137
 	}
139 138
 	
... ...
@@ -149,8 +148,7 @@ retry1:
149 149
 	}
150 150
 	
151 151
 	if (h->signo==0){
152
-			LOG(L_CRIT, "ERROR: init_sigio: %s\n",
153
-					rsig?"could not assign requested real-time signal":
152
+			LM_CRIT("%s\n", rsig?"could not assign requested real-time signal":
154 153
 						 "out of real-time signals");
155 154
 			goto error;
156 155
 	}
... ...
@@ -158,19 +156,19 @@ retry1:
158 158
 	DBG("init_sigio: trying signal %d... \n", h->signo);
159 159
 	
160 160
 	if (sigaddset(&h->sset, h->signo)==-1){
161
-		LOG(L_ERR, "ERROR: init_sigio: sigaddset failed for %d: %s [%d]\n",
161
+		LM_ERR("sigaddset failed for %d: %s [%d]\n",
162 162
 				h->signo, strerror(errno), errno);
163 163
 		goto error;
164 164
 	}
165 165
 	if (sigaddset(&h->sset, SIGIO)==-1){
166
-		LOG(L_ERR, "ERROR: init_sigio: sigaddset failed for %d: %s [%d]\n",
166
+		LM_ERR("sigaddset failed for %d: %s [%d]\n",
167 167
 				SIGIO, strerror(errno), errno);
168 168
 		goto error;
169 169
 	}
170 170
 retry:
171 171
 	if (sigprocmask(SIG_BLOCK, &h->sset, 0)==-1){
172 172
 		if (errno==EINTR) goto retry;
173
-		LOG(L_ERR, "ERROR: init_sigio: sigprocmask failed: %s [%d]\n",
173
+		LM_ERR("sigprocmask failed: %s [%d]\n",
174 174
 				strerror(errno), errno);
175 175
 		goto error;
176 176
 	}
... ...
@@ -206,8 +204,7 @@ again:
206 206
 	h->epfd=epoll_create(h->max_fd_no);
207 207
 	if (h->epfd==-1){
208 208
 		if (errno==EINTR) goto again;
209
-		LOG(L_ERR, "ERROR: init_epoll: epoll_create: %s [%d]\n",
210
-				strerror(errno), errno);
209
+		LM_ERR("epoll_create: %s [%d]\n", strerror(errno), errno);
211 210
 		return -1;
212 211
 	}
213 212
 	return 0;
... ...
@@ -235,8 +232,7 @@ again:
235 235
 	h->kq_fd=kqueue();
236 236
 	if (h->kq_fd==-1){
237 237
 		if (errno==EINTR) goto again;
238
-		LOG(L_ERR, "ERROR: init_kqueue: kqueue: %s [%d]\n",
239
-				strerror(errno), errno);
238
+		LM_ERR("kqueue: %s [%d]\n", strerror(errno), errno);
240 239
 		return -1;
241 240
 	}
242 241
 	return 0;
... ...
@@ -264,8 +260,7 @@ again:
264 264
 	h->dpoll_fd=open("/dev/poll", O_RDWR);
265 265
 	if (h->dpoll_fd==-1){
266 266
 		if (errno==EINTR) goto again;
267
-		LOG(L_ERR, "ERROR: init_/dev/poll: open: %s [%d]\n",
268
-				strerror(errno), errno);
267
+		LM_ERR("open: %s [%d]\n", strerror(errno), errno);
269 268
 		return -1;
270 269
 	}
271 270
 	return 0;
... ...
@@ -478,11 +473,11 @@ int init_io_wait(io_wait_h* h, int max_fd, enum poll_types poll_method)
478 478
 	if (poll_err || (poll_method==0)){
479 479
 		poll_method=choose_poll_method();
480 480
 		if (poll_err){
481
-			LOG(L_ERR, "ERROR: init_io_wait: %s, using %s instead\n",
481
+			LM_ERR("%s, using %s instead\n",
482 482
 					poll_err, poll_method_str[poll_method]);
483 483
 		}else{
484
-			LOG(L_INFO, "init_io_wait: using %s as the io watch method"
485
-					" (auto detected)\n", poll_method_str[poll_method]);
484
+			LM_INFO("using %s as the io watch method (auto detected)\n",
485
+					poll_method_str[poll_method]);
486 486
 		}
487 487
 	}
488 488
 	
... ...
@@ -491,8 +486,7 @@ int init_io_wait(io_wait_h* h, int max_fd, enum poll_types poll_method)
491 491
 	/* common stuff, everybody has fd_hash */
492 492
 	h->fd_hash=local_malloc(sizeof(*(h->fd_hash))*h->max_fd_no);
493 493
 	if (h->fd_hash==0){
494
-		LOG(L_CRIT, "ERROR: init_io_wait: could not alloc"
495
-					" fd hashtable (%ld bytes)\n",
494
+		LM_CRIT("could not alloc fd hashtable (%ld bytes)\n",
496 495
 					(long)sizeof(*(h->fd_hash))*h->max_fd_no );
497 496
 		goto error;
498 497
 	}
... ...
@@ -511,27 +505,26 @@ int init_io_wait(io_wait_h* h, int max_fd, enum poll_types poll_method)
511 511
 #endif
512 512
 			h->fd_array=local_malloc(sizeof(*(h->fd_array))*h->max_fd_no);
513 513
 			if (h->fd_array==0){
514
-				LOG(L_CRIT, "ERROR: init_io_wait: could not"
515
-							" alloc fd array (%ld bytes)\n",
516
-							(long)sizeof(*(h->fd_hash))*h->max_fd_no);
514
+				LM_CRIT("could not alloc fd array (%ld bytes)\n",
515
+						(long)sizeof(*(h->fd_hash))*h->max_fd_no);
517 516
 				goto error;
518 517
 			}
519 518
 			memset((void*)h->fd_array, 0, sizeof(*(h->fd_array))*h->max_fd_no);
520 519
 #ifdef HAVE_SIGIO_RT
521 520
 			if ((poll_method==POLL_SIGIO_RT) && (init_sigio(h, 0)<0)){
522
-				LOG(L_CRIT, "ERROR: init_io_wait: sigio init failed\n");
521
+				LM_CRIT("sigio init failed\n");
523 522
 				goto error;
524 523
 			}
525 524
 #endif
526 525
 #ifdef HAVE_DEVPOLL
527 526
 			if ((poll_method==POLL_DEVPOLL) && (init_devpoll(h)<0)){
528
-				LOG(L_CRIT, "ERROR: init_io_wait: /dev/poll init failed\n");
527
+				LM_CRIT("/dev/poll init failed\n");
529 528
 				goto error;
530 529
 			}
531 530
 #endif
532 531
 #ifdef HAVE_SELECT
533 532
 			if ((poll_method==POLL_SELECT) && (init_select(h)<0)){
534
-				LOG(L_CRIT, "ERROR: init_io_wait: select init failed\n");
533
+				LM_CRIT("select init failed\n");
535 534
 				goto error;
536 535
 			}
537 536
 #endif
... ...
@@ -542,13 +535,12 @@ int init_io_wait(io_wait_h* h, int max_fd, enum poll_types poll_method)
542 542
 		case POLL_EPOLL_ET:
543 543
 			h->ep_array=local_malloc(sizeof(*(h->ep_array))*h->max_fd_no);
544 544
 			if (h->ep_array==0){
545
-				LOG(L_CRIT, "ERROR: init_io_wait: could not alloc"
546
-							" epoll array\n");
545
+				LM_CRIT("could not alloc epoll array\n");
547 546
 				goto error;
548 547
 			}
549 548
 			memset((void*)h->ep_array, 0, sizeof(*(h->ep_array))*h->max_fd_no);
550 549
 			if (init_epoll(h)<0){
551
-				LOG(L_CRIT, "ERROR: init_io_wait: epoll init failed\n");
550
+				LM_CRIT("epoll init failed\n");
552 551
 				goto error;
553 552
 			}
554 553
 			break;
... ...
@@ -566,15 +558,13 @@ int init_io_wait(io_wait_h* h, int max_fd, enum poll_types poll_method)
566 566
 			h->kq_array_size=2 * h->max_fd_no + h->kq_changes_size;
567 567
 			h->kq_array=local_malloc(sizeof(*(h->kq_array))*h->kq_array_size);
568 568
 			if (h->kq_array==0){
569
-				LOG(L_CRIT, "ERROR: init_io_wait: could not alloc"
570
-							" kqueue event array\n");
569
+				LM_CRIT("could not alloc kqueue event array\n");
571 570
 				goto error;
572 571
 			}
573 572
 			h->kq_changes=local_malloc(sizeof(*(h->kq_changes))*
574 573
 										h->kq_changes_size);
575 574
 			if (h->kq_changes==0){
576
-				LOG(L_CRIT, "ERROR: init_io_wait: could not alloc"
577
-							" kqueue changes array\n");
575
+				LM_CRIT("could not alloc kqueue changes array\n");
578 576
 				goto error;
579 577
 			}
580 578
 			h->kq_nchanges=0;
... ...
@@ -583,14 +573,13 @@ int init_io_wait(io_wait_h* h, int max_fd, enum poll_types poll_method)
583 583
 			memset((void*)h->kq_changes, 0,
584 584
 						sizeof(*(h->kq_changes))* h->kq_changes_size);
585 585
 			if (init_kqueue(h)<0){
586
-				LOG(L_CRIT, "ERROR: init_io_wait: kqueue init failed\n");
586
+				LM_CRIT("kqueue init failed\n");
587 587
 				goto error;
588 588
 			}
589 589
 			break;
590 590
 #endif
591 591
 		default:
592
-			LOG(L_CRIT, "BUG: init_io_wait: unknown/unsupported poll"
593
-						" method %s (%d)\n",
592
+			LM_CRIT("unknown/unsupported poll method %s (%d)\n",
594 593
 						poll_method_str[poll_method], poll_method);
595 594
 			goto error;
596 595
 	}