Re: Add errdetail() with PID and UID about source of termination signal
Chao Li <li.evan.chao@gmail.com>
From: Chao Li <li.evan.chao@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Jim Jones <jim.jones@uni-muenster.de>,
Andrew Dunstan <andrew@dunslane.net>,
Jakub Wartak <jakub.wartak@enterprisedb.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-10T06:18:10Z
Lists: pgsql-hackers
> On Apr 9, 2026, at 22:47, Andres Freund <andres@anarazel.de> wrote: > > Hi, > > On 2026-04-09 14:14:23 +0800, Chao Li wrote: >>> For uid, 0 is usually a valid value for root. So using 0 as the “unknown” value seems a bit awkward. Maybe we should instead document something like "uid is only meaningful when pid is not 0". >>> >> >> Forgot to mention, I got a lot of compile warnings, for example: >> ``` >> parallel.c:1052:20: warning: cast from 'void (*)(int)' to 'pqsigfunc' (aka 'void (*)(int, struct pg_signal_info *)') converts to incompatible function type [-Wcast-function-type-mismatch] >> 1052 | pqsignal(SIGPIPE, PG_SIG_IGN); >> | ^~~~~~~~~~ >> ../../../src/include/port.h:551:20: note: expanded from macro 'PG_SIG_IGN' >> 551 | #define PG_SIG_IGN (pqsigfunc) SIG_IGN >> | ^~~~~~~~~~~~~~~~~~~ >> 4 warnings generated. >> ``` > > That's an annoying warning, GAH. Can't imagine this is the only thing it > complains about. Yes, compiler, I put a cast there, because I did actually > want to cast, thanks. > > I guess we'll have to define PG_SIG_IGN to 1 and PG_SIG_DFL to 0 ourselves. > > Greetings, > > Andres Freund I think PG already has pg_funcptr_t to treat this case, this change eliminates the warnings for me: ``` chaol@ChaodeMacBook-Air postgresql % git diff diff --git a/src/include/port.h b/src/include/port.h index 7db476d7b01..c029878c6be 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -547,8 +547,8 @@ extern int pg_mkdir_p(char *path, int omode); #define pqsignal pqsignal_be #endif -#define PG_SIG_DFL (pqsigfunc) SIG_DFL -#define PG_SIG_IGN (pqsigfunc) SIG_IGN +#define PG_SIG_DFL (pqsigfunc) (pg_funcptr_t) SIG_DFL +#define PG_SIG_IGN (pqsigfunc) (pg_funcptr_t) SIG_IGN typedef void (*pqsigfunc) (SIGNAL_ARGS); extern void pqsignal(int signo, pqsigfunc func); ``` Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Only show signal-sender PID/UID detail in server log
- b772f3fcad18 19 (unreleased) landed
-
Make psql DETAIL line test unconditionally optional.
- 446c400fd89b 19 (unreleased) landed
-
Rework signal handler infrastructure to pass sender info as argument.
- 3e2a1496bae6 19 (unreleased) landed
-
Add errdetail() with PID and UID about source of termination signal.
- 55890a919454 19 (unreleased) landed