mirror of
https://github.com/postgres/postgres.git
synced 2025-10-13 18:28:01 +03:00
Replace use of sys_siglist[] with strsignal().
This commit back-patches the v12-era commitsa73d08319
,cc92cca43
, and7570df0f3
into supported pre-v12 branches. The net effect is to eliminate our former dependency on the never-standard sys_siglist[] array, instead using POSIX-standard strsignal(3). What motivates doing this now is that glibc just removed sys_siglist[] from the set of symbols available to newly-built programs. While our code can survive without sys_siglist[], it then fails to print any description of the signal that killed a child process, which is a non-negligible loss of friendliness. We can expect that people will be wanting to build the back branches on platforms that include this change, so we need to do something. Since strsignal(3) has existed for quite a long time, and we've not had any trouble with these patches so far in v12, it seems safe to back-patch into older branches. Discussion: https://postgr.es/m/3179114.1594853308@sss.pgh.pa.us
This commit is contained in:
@@ -596,17 +596,10 @@ pgarch_archiveXlog(char *xlog)
|
||||
errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."),
|
||||
errdetail("The failed archive command was: %s",
|
||||
xlogarchcmd)));
|
||||
#elif defined(HAVE_DECL_SYS_SIGLIST) && HAVE_DECL_SYS_SIGLIST
|
||||
ereport(lev,
|
||||
(errmsg("archive command was terminated by signal %d: %s",
|
||||
WTERMSIG(rc),
|
||||
WTERMSIG(rc) < NSIG ? sys_siglist[WTERMSIG(rc)] : "(unknown)"),
|
||||
errdetail("The failed archive command was: %s",
|
||||
xlogarchcmd)));
|
||||
#else
|
||||
ereport(lev,
|
||||
(errmsg("archive command was terminated by signal %d",
|
||||
WTERMSIG(rc)),
|
||||
(errmsg("archive command was terminated by signal %d: %s",
|
||||
WTERMSIG(rc), pg_strsignal(WTERMSIG(rc))),
|
||||
errdetail("The failed archive command was: %s",
|
||||
xlogarchcmd)));
|
||||
#endif
|
||||
|
@@ -3563,6 +3563,7 @@ LogChildExit(int lev, const char *procname, int pid, int exitstatus)
|
||||
procname, pid, WEXITSTATUS(exitstatus)),
|
||||
activity ? errdetail("Failed process was running: %s", activity) : 0));
|
||||
else if (WIFSIGNALED(exitstatus))
|
||||
{
|
||||
#if defined(WIN32)
|
||||
ereport(lev,
|
||||
|
||||
@@ -3573,7 +3574,7 @@ LogChildExit(int lev, const char *procname, int pid, int exitstatus)
|
||||
procname, pid, WTERMSIG(exitstatus)),
|
||||
errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."),
|
||||
activity ? errdetail("Failed process was running: %s", activity) : 0));
|
||||
#elif defined(HAVE_DECL_SYS_SIGLIST) && HAVE_DECL_SYS_SIGLIST
|
||||
#else
|
||||
ereport(lev,
|
||||
|
||||
/*------
|
||||
@@ -3581,19 +3582,10 @@ LogChildExit(int lev, const char *procname, int pid, int exitstatus)
|
||||
"server process" */
|
||||
(errmsg("%s (PID %d) was terminated by signal %d: %s",
|
||||
procname, pid, WTERMSIG(exitstatus),
|
||||
WTERMSIG(exitstatus) < NSIG ?
|
||||
sys_siglist[WTERMSIG(exitstatus)] : "(unknown)"),
|
||||
activity ? errdetail("Failed process was running: %s", activity) : 0));
|
||||
#else
|
||||
ereport(lev,
|
||||
|
||||
/*------
|
||||
translator: %s is a noun phrase describing a child process, such as
|
||||
"server process" */
|
||||
(errmsg("%s (PID %d) was terminated by signal %d",
|
||||
procname, pid, WTERMSIG(exitstatus)),
|
||||
pg_strsignal(WTERMSIG(exitstatus))),
|
||||
activity ? errdetail("Failed process was running: %s", activity) : 0));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
ereport(lev,
|
||||
|
||||
|
Reference in New Issue
Block a user