Re: [HACKERS] signed logging format for pid in log_line_prefix?

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: [HACKERS] signed logging format for pid in log_line_prefix?
Дата
Msg-id 20170901151741.ivjm37ouy3zovkdz@alvherre.pgsql
обсуждение исходный текст
Ответ на [HACKERS] signed logging format for pid in log_line_prefix?  (Greg Stark <stark@mit.edu>)
Ответы Re: [HACKERS] signed logging format for pid in log_line_prefix?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] signed logging format for pid in log_line_prefix?
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] Speed up Clog Access by increasing CLOG buffers