Commit a5bfd5f1 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Print pid_t's as uintmax_t for portability (solaris)



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4562 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 6c71aa40
...@@ -136,7 +136,7 @@ child_line(void *priv, const char *p) ...@@ -136,7 +136,7 @@ child_line(void *priv, const char *p)
{ {
(void)priv; (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); return (0);
} }
...@@ -173,8 +173,8 @@ child_poker(const struct vev *e, int what) ...@@ -173,8 +173,8 @@ child_poker(const struct vev *e, int what)
if (!mgt_cli_askchild(NULL, NULL, "ping\n")) if (!mgt_cli_askchild(NULL, NULL, "ping\n"))
return (0); return (0);
REPORT(LOG_ERR, REPORT(LOG_ERR,
"Child (%d) not responding to ping, killing it.", "Child (%ju) not responding to ping, killing it.",
child_pid); (uintmax_t)child_pid);
if (params->diag_bitmap & 0x1000) if (params->diag_bitmap & 0x1000)
(void)kill(child_pid, SIGKILL); (void)kill(child_pid, SIGKILL);
else else
...@@ -237,6 +237,7 @@ close_sockets(void) ...@@ -237,6 +237,7 @@ close_sockets(void)
static inline void static inline void
waive_privileges(void) waive_privileges(void)
{ {
#ifdef HAVE_SETPPRIV #ifdef HAVE_SETPPRIV
priv_set_t *empty; priv_set_t *empty;
...@@ -356,7 +357,7 @@ start_child(struct cli *cli) ...@@ -356,7 +357,7 @@ start_child(struct cli *cli)
exit(1); exit(1);
} }
REPORT(LOG_NOTICE, "child (%d) Started", pid); REPORT(LOG_NOTICE, "child (%ju) Started", (uintmax_t)pid);
/* Close stuff the child got */ /* Close stuff the child got */
closex(&heritage.std_fd); closex(&heritage.std_fd);
...@@ -439,7 +440,7 @@ mgt_report_panic(pid_t r) ...@@ -439,7 +440,7 @@ mgt_report_panic(pid_t r)
VSL_Panic(&l, &p); VSL_Panic(&l, &p);
if (*p == '\0') if (*p == '\0')
return; return;
REPORT(LOG_ERR, "Child (%d) Panic message: %s", r, p); REPORT(LOG_ERR, "Child (%ju) Panic message: %s", (uintmax_t)r, p);
} }
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
......
...@@ -350,7 +350,7 @@ DebugStunt(void) ...@@ -350,7 +350,7 @@ DebugStunt(void)
buf[i] = '\0'; buf[i] = '\0';
d_child = strtoul(buf, &p, 0); d_child = strtoul(buf, &p, 0);
xxxassert(p != NULL); xxxassert(p != NULL);
printf("New Pid %d\n", d_child); printf("New Pid %ju\n", (uintmax_t)d_child);
xxxassert(d_child != 0); xxxassert(d_child != 0);
i = strlen(p); i = strlen(p);
j = write(pipes[1][1], p, i); j = write(pipes[1][1], p, i);
...@@ -784,7 +784,7 @@ main(int argc, char * const *argv) ...@@ -784,7 +784,7 @@ main(int argc, char * const *argv)
if (d_flag < 2 && !F_flag) if (d_flag < 2 && !F_flag)
AZ(varnish_daemon(1, d_flag)); AZ(varnish_daemon(1, d_flag));
if (d_flag == 1) if (d_flag == 1)
printf("%d\n", getpid()); printf("%ju\n", (uintmax_t)getpid());
if (pfh != NULL && vpf_write(pfh)) if (pfh != NULL && vpf_write(pfh))
fprintf(stderr, "NOTE: Could not write PID file\n"); fprintf(stderr, "NOTE: Could not write PID file\n");
......
...@@ -194,7 +194,7 @@ vpf_write(struct pidfh *pfh) ...@@ -194,7 +194,7 @@ vpf_write(struct pidfh *pfh)
return (-1); return (-1);
} }
error = snprintf(pidstr, sizeof(pidstr), "%u", getpid()); error = snprintf(pidstr, sizeof(pidstr), "%ju", (uintmax_t)getpid());
assert(error < sizeof pidstr); assert(error < sizeof pidstr);
if (pwrite(fd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) { if (pwrite(fd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) {
error = errno; error = errno;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment