Consistently use "superuser" instead of "super user"
[pgsql.git] / src / port / pgstrsignal.c
blob0f3b5da04f0767ee10a538b7af7202b6a3fe82ee
1 /*-------------------------------------------------------------------------
3 * pgstrsignal.c
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
15 * IDENTIFICATION
16 * src/port/pgstrsignal.c
18 *-------------------------------------------------------------------------
21 #include "c.h"
25 * pg_strsignal
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.
41 const char *
42 pg_strsignal(int signum)
44 const char *result;
47 * If we have strsignal(3), use that --- but check its result for NULL.
49 #ifdef HAVE_STRSIGNAL
50 result = strsignal(signum);
51 if (result == NULL)
52 result = "unrecognized signal";
53 #else
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)";
61 #endif
63 return result;