Greg Stark wrote:
> 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?

MyProcPid is an int, so %d is the natural choice.  the sys_types.h
manpage says:

        *  blksize_t, pid_t, and ssize_t shall be signed integer types.

and also:
       The implementation shall support one or more  programming  environments
       in  which  the  widths of blksize_t, pid_t, size_t, ssize_t, and susec‐
       onds_t are no greater than the width of type long.

I wonder if we could just adopt pid_t for PIDs.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to