Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cc92cca

Browse files
committed
Drop support for getting signal descriptions from sys_siglist[].
It appears that all platforms that have sys_siglist[] also have strsignal(), making that fallback case in pg_strsignal() dead code. Getting rid of it allows dropping a configure test, which seems worth more than providing textual signal descriptions on whatever platforms might still hypothetically have use for the fallback case. Discussion: https://postgr.es/m/25758.1544983503@sss.pgh.pa.us
1 parent ca41030 commit cc92cca

File tree

4 files changed

+9
-42
lines changed

4 files changed

+9
-42
lines changed

configure

-18
Original file line numberDiff line numberDiff line change
@@ -16064,24 +16064,6 @@ esac
1606416064

1606516065
fi
1606616066

16067-
ac_fn_c_check_decl "$LINENO" "sys_siglist" "ac_cv_have_decl_sys_siglist" "#include <signal.h>
16068-
/* NetBSD declares sys_siglist in unistd.h. */
16069-
#ifdef HAVE_UNISTD_H
16070-
# include <unistd.h>
16071-
#endif
16072-
16073-
"
16074-
if test "x$ac_cv_have_decl_sys_siglist" = xyes; then :
16075-
ac_have_decl=1
16076-
else
16077-
ac_have_decl=0
16078-
fi
16079-
16080-
cat >>confdefs.h <<_ACEOF
16081-
#define HAVE_DECL_SYS_SIGLIST $ac_have_decl
16082-
_ACEOF
16083-
16084-
1608516067
ac_fn_c_check_func "$LINENO" "syslog" "ac_cv_func_syslog"
1608616068
if test "x$ac_cv_func_syslog" = xyes; then :
1608716069
ac_fn_c_check_header_mongrel "$LINENO" "syslog.h" "ac_cv_header_syslog_h" "$ac_includes_default"

configure.in

-8
Original file line numberDiff line numberDiff line change
@@ -1787,14 +1787,6 @@ if test "$PORTNAME" = "cygwin"; then
17871787
AC_LIBOBJ(dirmod)
17881788
fi
17891789

1790-
AC_CHECK_DECLS([sys_siglist], [], [],
1791-
[#include <signal.h>
1792-
/* NetBSD declares sys_siglist in unistd.h. */
1793-
#ifdef HAVE_UNISTD_H
1794-
# include <unistd.h>
1795-
#endif
1796-
])
1797-
17981790
AC_CHECK_FUNC(syslog,
17991791
[AC_CHECK_HEADER(syslog.h,
18001792
[AC_DEFINE(HAVE_SYSLOG, 1, [Define to 1 if you have the syslog interface.])])])

src/include/pg_config.h.in

-4
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,6 @@
192192
don't. */
193193
#undef HAVE_DECL_STRTOULL
194194

195-
/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
196-
don't. */
197-
#undef HAVE_DECL_SYS_SIGLIST
198-
199195
/* Define to 1 if you have the `dlopen' function. */
200196
#undef HAVE_DLOPEN
201197

src/port/pgstrsignal.c

+9-12
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* the string will remain valid across later calls to strsignal().
3232
*
3333
* This version guarantees to return a non-NULL pointer, although
34-
* some platforms' versions of strsignal() do not.
34+
* some platforms' versions of strsignal() reputedly do not.
3535
*/
3636
const char *
3737
pg_strsignal(int signum)
@@ -40,21 +40,18 @@ pg_strsignal(int signum)
4040

4141
/*
4242
* If we have strsignal(3), use that --- but check its result for NULL.
43-
* Otherwise, if we have sys_siglist[], use that; just out of paranoia,
44-
* check for NULL there too. (We assume there is no point in trying both
45-
* APIs.)
4643
*/
47-
#if defined(HAVE_STRSIGNAL)
44+
#ifdef HAVE_STRSIGNAL
4845
result = strsignal(signum);
4946
if (result)
5047
return result;
51-
#elif defined(HAVE_DECL_SYS_SIGLIST) && HAVE_DECL_SYS_SIGLIST
52-
if (signum > 0 && signum < NSIG)
53-
{
54-
result = sys_siglist[signum];
55-
if (result)
56-
return result;
57-
}
48+
#else
49+
50+
/*
51+
* We used to have code here to try to use sys_siglist[] if available.
52+
* However, it seems that all platforms with sys_siglist[] have also had
53+
* strsignal() for many years now, so that was just a waste of code.
54+
*/
5855
#endif
5956

6057
/*

0 commit comments

Comments
 (0)