Re: Have BackendXidGetPid return pid_t

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Have BackendXidGetPid return pid_t
Дата
Msg-id 3233362.1763153534@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Have BackendXidGetPid return pid_t  (Sami Imseih <samimseih@gmail.com>)
Список pgsql-hackers
Sami Imseih <samimseih@gmail.com> writes:
> While looking at something nearby, I noticed that BackendXidGetPid()
> uses an "int" for "pid", where it should be used "pid_t" like in other
> places in the code including in procarray.c.

I don't think this is an amazingly good idea, considering that the
value it's returning is from an "int" field in struct PGPROC.
You didn't change the function's "result" variable either, nor
is it clear what callers like

                        snprintf(buf, NCHARS, "%d",
                                 BackendXidGetPid(members[j].xid));

should be doing.

Perhaps at some point we should try to uniformly represent PIDs
as pid_t, but it'll require a far larger patch than this.

(I have a vague recollection also that some places expect PIDs in
shared memory to be atomically updatable, so machines where pid_t
is actually different from int might start to have issues.)

            regards, tom lane



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