From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Greg Stark <stark(at)mit(dot)edu> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: signed logging format for pid in log_line_prefix? |
Date: | 2017-09-01 15:15:30 |
Message-ID: | 16119.1504278930@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Greg Stark <stark(at)mit(dot)edu> writes:
> Both the text and csv logging seem to use %d on for logging the server pid:
> appendStringInfo(buf, "%d", MyProcPid);
> Am I missing something or wouldn't this mean we print pids with large
> values as negative numbers? Isn't that strange? Wouldn't we rather use
> %u here?
pid_t is a signed type; see for example waitpid(2):
The value of pid can be:
< -1 meaning wait for any child process whose process group ID is
equal to the absolute value of pid.
-1 meaning wait for any child process.
0 meaning wait for any child process whose process group ID is
equal to that of the calling process.
> 0 meaning wait for the child whose process ID is equal to the
value of pid.
So I think using %d is fine. Someday we might wish that we were using
a wider type than int to hold PIDs, but I don't think it'll ever be
unsigned.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2017-09-01 15:17:41 | Re: signed logging format for pid in log_line_prefix? |
Previous Message | Tom Lane | 2017-09-01 15:09:55 | Missing SIZE_MAX |