Browse code

core: pid_t warning fixes for solaris

Andrei Pelinescu-Onciul authored on 03/12/2009 01:15:36
Showing 2 changed files
... ...
@@ -713,19 +713,19 @@ void handle_sigs()
713 713
 		case SIGCHLD:
714 714
 			while ((chld=waitpid( -1, &chld_status, WNOHANG ))>0) {
715 715
 				if (WIFEXITED(chld_status))
716
-					LOG(L_ALERT, "child process %d exited normally,"
717
-							" status=%d\n", chld,
716
+					LOG(L_ALERT, "child process %ld exited normally,"
717
+							" status=%d\n", (long)chld,
718 718
 							WEXITSTATUS(chld_status));
719 719
 				else if (WIFSIGNALED(chld_status)) {
720
-					LOG(L_ALERT, "child process %d exited by a signal"
721
-							" %d\n", chld, WTERMSIG(chld_status));
720
+					LOG(L_ALERT, "child process %ld exited by a signal"
721
+							" %d\n", (long)chld, WTERMSIG(chld_status));
722 722
 #ifdef WCOREDUMP
723 723
 					LOG(L_ALERT, "core was %sgenerated\n",
724 724
 							 WCOREDUMP(chld_status) ?  "" : "not " );
725 725
 #endif
726 726
 				}else if (WIFSTOPPED(chld_status))
727
-					LOG(L_ALERT, "child process %d stopped by a"
728
-								" signal %d\n", chld,
727
+					LOG(L_ALERT, "child process %ld stopped by a"
728
+								" signal %d\n", (long)chld,
729 729
 								 WSTOPSIG(chld_status));
730 730
 			}
731 731
 #ifndef STOP_JIRIS_CHANGES
... ...
@@ -2810,8 +2810,9 @@ inline static int handle_tcp_child(struct tcp_child* tcp_c, int fd_i)
2810 2810
 	if (unlikely(tcp_c->unix_sock<=0)){
2811 2811
 		/* (we can't have a fd==0, 0 is never closed )*/
2812 2812
 		LOG(L_CRIT, "BUG: handle_tcp_child: fd %d for %d "
2813
-				"(pid %d, ser no %d)\n", tcp_c->unix_sock,
2814
-				(int)(tcp_c-&tcp_children[0]), tcp_c->pid, tcp_c->proc_no);
2813
+				"(pid %ld, ser no %d)\n", tcp_c->unix_sock,
2814
+				(int)(tcp_c-&tcp_children[0]), (long)tcp_c->pid,
2815
+				 tcp_c->proc_no);
2815 2816
 		goto error;
2816 2817
 	}
2817 2818
 	/* read until sizeof(response)
... ...
@@ -2820,9 +2821,9 @@ inline static int handle_tcp_child(struct tcp_child* tcp_c, int fd_i)
2820 2820
 	if (unlikely(bytes<(int)sizeof(response))){
2821 2821
 		if (bytes==0){
2822 2822
 			/* EOF -> bad, child has died */
2823
-			DBG("DBG: handle_tcp_child: dead tcp child %d (pid %d, no %d)"
2823
+			DBG("DBG: handle_tcp_child: dead tcp child %d (pid %ld, no %d)"
2824 2824
 					" (shutting down?)\n", (int)(tcp_c-&tcp_children[0]), 
2825
-					tcp_c->pid, tcp_c->proc_no );
2825
+					(long)tcp_c->pid, tcp_c->proc_no );
2826 2826
 			/* don't listen on it any more */
2827 2827
 			io_watch_del(&io_h, tcp_c->unix_sock, fd_i, 0); 
2828 2828
 			goto error; /* eof. so no more io here, it's ok to return error */
... ...
@@ -2831,8 +2832,8 @@ inline static int handle_tcp_child(struct tcp_child* tcp_c, int fd_i)
2831 2831
 			 * e.g.: SIGIO_RT overflow mode or EPOLL ET */
2832 2832
 			if ((errno!=EAGAIN) && (errno!=EWOULDBLOCK)){
2833 2833
 				LOG(L_CRIT, "ERROR: handle_tcp_child: read from tcp child %ld "
2834
-						" (pid %d, no %d) %s [%d]\n",
2835
-						(long)(tcp_c-&tcp_children[0]), tcp_c->pid,
2834
+						" (pid %ld, no %d) %s [%d]\n",
2835
+						(long)(tcp_c-&tcp_children[0]), (long)tcp_c->pid,
2836 2836
 						tcp_c->proc_no, strerror(errno), errno );
2837 2837
 			}else{
2838 2838
 				bytes=0;
... ...
@@ -2857,8 +2858,8 @@ inline static int handle_tcp_child(struct tcp_child* tcp_c, int fd_i)
2857 2857
 	if (unlikely(tcpconn==0)){
2858 2858
 		/* should never happen */
2859 2859
 		LOG(L_CRIT, "BUG: handle_tcp_child: null tcpconn pointer received"
2860
-				 " from tcp child %d (pid %d): %lx, %lx\n",
2861
-				 	(int)(tcp_c-&tcp_children[0]), tcp_c->pid,
2860
+				 " from tcp child %d (pid %ld): %lx, %lx\n",
2861
+				 	(int)(tcp_c-&tcp_children[0]), (long)tcp_c->pid,
2862 2862
 					response[0], response[1]) ;
2863 2863
 		goto end;
2864 2864
 	}
... ...
@@ -3330,9 +3331,9 @@ inline static int send2child(struct tcp_connection* tcpconn)
3330 3330
 				" connection passed to the least busy one (%d)\n",
3331 3331
 				min_busy);
3332 3332
 	}
3333
-	DBG("send2child: to tcp child %d %d(%d), %p\n", idx, 
3333
+	DBG("send2child: to tcp child %d %d(%ld), %p\n", idx, 
3334 3334
 					tcp_children[idx].proc_no,
3335
-					tcp_children[idx].pid, tcpconn);
3335
+					(long)tcp_children[idx].pid, tcpconn);
3336 3336
 	/* first make sure this child doesn't have pending request for
3337 3337
 	 * tcp_main (to avoid a possible deadlock: e.g. child wants to
3338 3338
 	 * send a release command, but the master fills its socket buffer