r4562 - in trunk/varnish-cache: bin/varnishd lib/libvarnish

phk at projects.linpro.no phk at projects.linpro.no
Tue Feb 16 22:05:09 CET 2010


Author: phk
Date: 2010-02-16 22:05:08 +0100 (Tue, 16 Feb 2010)
New Revision: 4562

Modified:
   trunk/varnish-cache/bin/varnishd/mgt_child.c
   trunk/varnish-cache/bin/varnishd/varnishd.c
   trunk/varnish-cache/lib/libvarnish/vpf.c
Log:
Print pid_t's as uintmax_t for portability (solaris)



Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c	2010-02-13 20:24:55 UTC (rev 4561)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c	2010-02-16 21:05:08 UTC (rev 4562)
@@ -136,7 +136,7 @@
 {
 	(void)priv;
 
-	REPORT(LOG_NOTICE, "Child (%d) said %s", child_pid, p);
+	REPORT(LOG_NOTICE, "Child (%ju) said %s", (uintmax_t)child_pid, p);
 	return (0);
 }
 
@@ -173,8 +173,8 @@
 	if (!mgt_cli_askchild(NULL, NULL, "ping\n"))
 		return (0);
 	REPORT(LOG_ERR,
-	    "Child (%d) not responding to ping, killing it.",
-	    child_pid);
+	    "Child (%ju) not responding to ping, killing it.",
+	    (uintmax_t)child_pid);
 	if (params->diag_bitmap & 0x1000)
 		(void)kill(child_pid, SIGKILL);
 	else
@@ -237,6 +237,7 @@
 static inline void
 waive_privileges(void)
 {
+
 #ifdef HAVE_SETPPRIV
 	priv_set_t *empty;
 
@@ -356,7 +357,7 @@
 
 		exit(1);
 	}
-	REPORT(LOG_NOTICE, "child (%d) Started", pid);
+	REPORT(LOG_NOTICE, "child (%ju) Started", (uintmax_t)pid);
 
 	/* Close stuff the child got */
 	closex(&heritage.std_fd);
@@ -439,7 +440,7 @@
 	VSL_Panic(&l, &p);
 	if (*p == '\0')
 		return;
-	REPORT(LOG_ERR, "Child (%d) Panic message: %s", r, p);
+	REPORT(LOG_ERR, "Child (%ju) Panic message: %s", (uintmax_t)r, p);
 }
 
 /*--------------------------------------------------------------------*/

Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c	2010-02-13 20:24:55 UTC (rev 4561)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c	2010-02-16 21:05:08 UTC (rev 4562)
@@ -350,7 +350,7 @@
 	buf[i] = '\0';
 	d_child = strtoul(buf, &p, 0);
 	xxxassert(p != NULL);
-	printf("New Pid %d\n", d_child);
+	printf("New Pid %ju\n", (uintmax_t)d_child);
 	xxxassert(d_child != 0);
 	i = strlen(p);
 	j = write(pipes[1][1], p, i);
@@ -784,7 +784,7 @@
 	if (d_flag < 2 && !F_flag)
 		AZ(varnish_daemon(1, d_flag));
 	if (d_flag == 1)
-		printf("%d\n", getpid());
+		printf("%ju\n", (uintmax_t)getpid());
 
 	if (pfh != NULL && vpf_write(pfh))
 		fprintf(stderr, "NOTE: Could not write PID file\n");

Modified: trunk/varnish-cache/lib/libvarnish/vpf.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/vpf.c	2010-02-13 20:24:55 UTC (rev 4561)
+++ trunk/varnish-cache/lib/libvarnish/vpf.c	2010-02-16 21:05:08 UTC (rev 4562)
@@ -194,7 +194,7 @@
 		return (-1);
 	}
 
-	error = snprintf(pidstr, sizeof(pidstr), "%u", getpid());
+	error = snprintf(pidstr, sizeof(pidstr), "%ju", (uintmax_t)getpid());
 	assert(error < sizeof pidstr);
 	if (pwrite(fd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) {
 		error = errno;



More information about the varnish-commit mailing list