[sr-dev] git:sr_3.0: core: pid_t warning fixes for solaris

Andrei Pelinescu-Onciul andrei at iptel.org
Wed Dec 2 22:19:10 CET 2009


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

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Wed Dec  2 20:15:36 2009 -0500

core: pid_t warning fixes for solaris

---

 main.c     |   12 ++++++------
 tcp_main.c |   21 +++++++++++----------
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/main.c b/main.c
index fc25588..fd4b642 100644
--- a/main.c
+++ b/main.c
@@ -713,19 +713,19 @@ void handle_sigs()
 		case SIGCHLD:
 			while ((chld=waitpid( -1, &chld_status, WNOHANG ))>0) {
 				if (WIFEXITED(chld_status))
-					LOG(L_ALERT, "child process %d exited normally,"
-							" status=%d\n", chld,
+					LOG(L_ALERT, "child process %ld exited normally,"
+							" status=%d\n", (long)chld,
 							WEXITSTATUS(chld_status));
 				else if (WIFSIGNALED(chld_status)) {
-					LOG(L_ALERT, "child process %d exited by a signal"
-							" %d\n", chld, WTERMSIG(chld_status));
+					LOG(L_ALERT, "child process %ld exited by a signal"
+							" %d\n", (long)chld, WTERMSIG(chld_status));
 #ifdef WCOREDUMP
 					LOG(L_ALERT, "core was %sgenerated\n",
 							 WCOREDUMP(chld_status) ?  "" : "not " );
 #endif
 				}else if (WIFSTOPPED(chld_status))
-					LOG(L_ALERT, "child process %d stopped by a"
-								" signal %d\n", chld,
+					LOG(L_ALERT, "child process %ld stopped by a"
+								" signal %d\n", (long)chld,
 								 WSTOPSIG(chld_status));
 			}
 #ifndef STOP_JIRIS_CHANGES
diff --git a/tcp_main.c b/tcp_main.c
index 77ecdf5..4840ddc 100644
--- a/tcp_main.c
+++ b/tcp_main.c
@@ -2810,8 +2810,9 @@ inline static int handle_tcp_child(struct tcp_child* tcp_c, int fd_i)
 	if (unlikely(tcp_c->unix_sock<=0)){
 		/* (we can't have a fd==0, 0 is never closed )*/
 		LOG(L_CRIT, "BUG: handle_tcp_child: fd %d for %d "
-				"(pid %d, ser no %d)\n", tcp_c->unix_sock,
-				(int)(tcp_c-&tcp_children[0]), tcp_c->pid, tcp_c->proc_no);
+				"(pid %ld, ser no %d)\n", tcp_c->unix_sock,
+				(int)(tcp_c-&tcp_children[0]), (long)tcp_c->pid,
+				 tcp_c->proc_no);
 		goto error;
 	}
 	/* read until sizeof(response)
@@ -2820,9 +2821,9 @@ inline static int handle_tcp_child(struct tcp_child* tcp_c, int fd_i)
 	if (unlikely(bytes<(int)sizeof(response))){
 		if (bytes==0){
 			/* EOF -> bad, child has died */
-			DBG("DBG: handle_tcp_child: dead tcp child %d (pid %d, no %d)"
+			DBG("DBG: handle_tcp_child: dead tcp child %d (pid %ld, no %d)"
 					" (shutting down?)\n", (int)(tcp_c-&tcp_children[0]), 
-					tcp_c->pid, tcp_c->proc_no );
+					(long)tcp_c->pid, tcp_c->proc_no );
 			/* don't listen on it any more */
 			io_watch_del(&io_h, tcp_c->unix_sock, fd_i, 0); 
 			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)
 			 * e.g.: SIGIO_RT overflow mode or EPOLL ET */
 			if ((errno!=EAGAIN) && (errno!=EWOULDBLOCK)){
 				LOG(L_CRIT, "ERROR: handle_tcp_child: read from tcp child %ld "
-						" (pid %d, no %d) %s [%d]\n",
-						(long)(tcp_c-&tcp_children[0]), tcp_c->pid,
+						" (pid %ld, no %d) %s [%d]\n",
+						(long)(tcp_c-&tcp_children[0]), (long)tcp_c->pid,
 						tcp_c->proc_no, strerror(errno), errno );
 			}else{
 				bytes=0;
@@ -2857,8 +2858,8 @@ inline static int handle_tcp_child(struct tcp_child* tcp_c, int fd_i)
 	if (unlikely(tcpconn==0)){
 		/* should never happen */
 		LOG(L_CRIT, "BUG: handle_tcp_child: null tcpconn pointer received"
-				 " from tcp child %d (pid %d): %lx, %lx\n",
-				 	(int)(tcp_c-&tcp_children[0]), tcp_c->pid,
+				 " from tcp child %d (pid %ld): %lx, %lx\n",
+				 	(int)(tcp_c-&tcp_children[0]), (long)tcp_c->pid,
 					response[0], response[1]) ;
 		goto end;
 	}
@@ -3330,9 +3331,9 @@ inline static int send2child(struct tcp_connection* tcpconn)
 				" connection passed to the least busy one (%d)\n",
 				min_busy);
 	}
-	DBG("send2child: to tcp child %d %d(%d), %p\n", idx, 
+	DBG("send2child: to tcp child %d %d(%ld), %p\n", idx, 
 					tcp_children[idx].proc_no,
-					tcp_children[idx].pid, tcpconn);
+					(long)tcp_children[idx].pid, tcpconn);
 	/* first make sure this child doesn't have pending request for
 	 * tcp_main (to avoid a possible deadlock: e.g. child wants to
 	 * send a release command, but the master fills its socket buffer




More information about the sr-dev mailing list