1 /*-------------------------------------------------------------------------
4 * Identify a Unix signal number
6 * On platforms compliant with modern POSIX, this just wraps strsignal(3).
7 * Elsewhere, we do the best we can.
9 * This file is not currently built in MSVC builds, since it's useless
10 * on non-Unix platforms.
12 * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
13 * Portions Copyright (c) 1994, Regents of the University of California
16 * src/port/pgstrsignal.c
18 *-------------------------------------------------------------------------
27 * Return a string identifying the given Unix signal number.
29 * The result is declared "const char *" because callers should not
30 * modify the string. Note, however, that POSIX does not promise that
31 * the string will remain valid across later calls to strsignal().
33 * This version guarantees to return a non-NULL pointer, although
34 * some platforms' versions of strsignal() reputedly do not.
36 * Note that the fallback cases just return constant strings such as
37 * "unrecognized signal". Project style is for callers to print the
38 * numeric signal value along with the result of this function, so
39 * there's no need to work harder than that.
42 pg_strsignal(int signum
)
47 * If we have strsignal(3), use that --- but check its result for NULL.
50 result
= strsignal(signum
);
52 result
= "unrecognized signal";
56 * We used to have code here to try to use sys_siglist[] if available.
57 * However, it seems that all platforms with sys_siglist[] have also had
58 * strsignal() for many years now, so that was just a waste of code.
60 result
= "(signal names not available on this platform)";