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

Commit fb12bec

Browse files
committed
Remove dead handling for pre-POSIX sigwait().
sigwait() is in SUSv2 and all targeted Unix systems have it. An earlier pre-standard function prototype existed on some older systems, but we no longer need a workaround for that. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Greg Stark <stark@mit.edu> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com
1 parent 86e5eb4 commit fb12bec

File tree

6 files changed

+10
-104
lines changed

6 files changed

+10
-104
lines changed

configure

+3-61
Original file line numberDiff line numberDiff line change
@@ -16394,11 +16394,9 @@ $as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
1639416394
fi
1639516395

1639616396

16397-
# Make sure there's a declaration for sigwait(), then make sure
16398-
# that it conforms to the POSIX standard (there seem to still be
16399-
# some platforms out there with pre-POSIX sigwait()). On Solaris,
16400-
# _POSIX_PTHREAD_SEMANTICS affects the result, but we already
16401-
# added that to CPPFLAGS.
16397+
# posix_fadvise() is a no-op on Solaris, so don't incur function overhead
16398+
# by calling it, 2009-04-02
16399+
# http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/posix_fadvise.c
1640216400
# The Clang compiler raises a warning for an undeclared identifier that matches
1640316401
# a compiler builtin function. All extant Clang versions are affected, as of
1640416402
# Clang 3.6.0. Test a builtin known to every version. This problem affects the
@@ -16487,62 +16485,6 @@ case $ac_cv_c_decl_report in
1648716485
*) ac_c_decl_warn_flag= ;;
1648816486
esac
1648916487

16490-
ac_fn_c_check_decl "$LINENO" "sigwait" "ac_cv_have_decl_sigwait" "#include <signal.h>
16491-
"
16492-
if test "x$ac_cv_have_decl_sigwait" = xyes; then :
16493-
ac_have_decl=1
16494-
else
16495-
ac_have_decl=0
16496-
fi
16497-
16498-
cat >>confdefs.h <<_ACEOF
16499-
#define HAVE_DECL_SIGWAIT $ac_have_decl
16500-
_ACEOF
16501-
16502-
if test "x$ac_cv_have_decl_sigwait" = xyes; then
16503-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for POSIX-conforming sigwait declaration" >&5
16504-
$as_echo_n "checking for POSIX-conforming sigwait declaration... " >&6; }
16505-
if ${pgac_cv_have_posix_decl_sigwait+:} false; then :
16506-
$as_echo_n "(cached) " >&6
16507-
else
16508-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
16509-
/* end confdefs.h. */
16510-
16511-
#include <signal.h>
16512-
int sigwait(const sigset_t *set, int *sig);
16513-
16514-
int
16515-
main ()
16516-
{
16517-
16518-
;
16519-
return 0;
16520-
}
16521-
_ACEOF
16522-
if ac_fn_c_try_compile "$LINENO"; then :
16523-
pgac_cv_have_posix_decl_sigwait=yes
16524-
else
16525-
pgac_cv_have_posix_decl_sigwait=no
16526-
fi
16527-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
16528-
fi
16529-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_have_posix_decl_sigwait" >&5
16530-
$as_echo "$pgac_cv_have_posix_decl_sigwait" >&6; }
16531-
fi
16532-
if test "x$pgac_cv_have_posix_decl_sigwait" = xyes; then
16533-
16534-
$as_echo "#define HAVE_POSIX_DECL_SIGWAIT 1" >>confdefs.h
16535-
16536-
else
16537-
# On non-Windows, libpq requires POSIX sigwait() for thread safety.
16538-
if test "$enable_thread_safety" = yes -a "$PORTNAME" != "win32"; then
16539-
as_fn_error $? "POSIX-conforming sigwait is required to enable thread safety." "$LINENO" 5
16540-
fi
16541-
fi
16542-
16543-
# posix_fadvise() is a no-op on Solaris, so don't incur function overhead
16544-
# by calling it, 2009-04-02
16545-
# http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/posix_fadvise.c
1654616488
if test "$PORTNAME" != "solaris"; then :
1654716489

1654816490
for ac_func in posix_fadvise

configure.ac

-27
Original file line numberDiff line numberDiff line change
@@ -1838,33 +1838,6 @@ PGAC_CHECK_BUILTIN_FUNC_PTR([__builtin_frame_address], [0])
18381838
# in case it finds that _LARGEFILE_SOURCE has to be #define'd for that.
18391839
AC_FUNC_FSEEKO
18401840

1841-
# Make sure there's a declaration for sigwait(), then make sure
1842-
# that it conforms to the POSIX standard (there seem to still be
1843-
# some platforms out there with pre-POSIX sigwait()). On Solaris,
1844-
# _POSIX_PTHREAD_SEMANTICS affects the result, but we already
1845-
# added that to CPPFLAGS.
1846-
AC_CHECK_DECLS(sigwait, [], [], [#include <signal.h>])
1847-
if test "x$ac_cv_have_decl_sigwait" = xyes; then
1848-
AC_CACHE_CHECK([for POSIX-conforming sigwait declaration],
1849-
[pgac_cv_have_posix_decl_sigwait],
1850-
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1851-
#include <signal.h>
1852-
int sigwait(const sigset_t *set, int *sig);
1853-
],
1854-
[])],
1855-
[pgac_cv_have_posix_decl_sigwait=yes],
1856-
[pgac_cv_have_posix_decl_sigwait=no])])
1857-
fi
1858-
if test "x$pgac_cv_have_posix_decl_sigwait" = xyes; then
1859-
AC_DEFINE(HAVE_POSIX_DECL_SIGWAIT, 1,
1860-
[Define to 1 if you have a POSIX-conforming sigwait declaration.])
1861-
else
1862-
# On non-Windows, libpq requires POSIX sigwait() for thread safety.
1863-
if test "$enable_thread_safety" = yes -a "$PORTNAME" != "win32"; then
1864-
AC_MSG_ERROR([POSIX-conforming sigwait is required to enable thread safety.])
1865-
fi
1866-
fi
1867-
18681841
# posix_fadvise() is a no-op on Solaris, so don't incur function overhead
18691842
# by calling it, 2009-04-02
18701843
# http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/posix_fadvise.c

src/bin/psql/command.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -4953,7 +4953,7 @@ do_watch(PQExpBuffer query_buf, double sleep)
49534953
FILE *pagerpipe = NULL;
49544954
int title_len;
49554955
int res = 0;
4956-
#ifdef HAVE_POSIX_DECL_SIGWAIT
4956+
#ifndef WIN32
49574957
sigset_t sigalrm_sigchld_sigint;
49584958
sigset_t sigalrm_sigchld;
49594959
sigset_t sigint;
@@ -4967,7 +4967,7 @@ do_watch(PQExpBuffer query_buf, double sleep)
49674967
return false;
49684968
}
49694969

4970-
#ifdef HAVE_POSIX_DECL_SIGWAIT
4970+
#ifndef WIN32
49714971
sigemptyset(&sigalrm_sigchld_sigint);
49724972
sigaddset(&sigalrm_sigchld_sigint, SIGCHLD);
49734973
sigaddset(&sigalrm_sigchld_sigint, SIGALRM);
@@ -5006,7 +5006,7 @@ do_watch(PQExpBuffer query_buf, double sleep)
50065006
* PAGER environment variables, because traditional pagers probably won't
50075007
* be very useful for showing a stream of results.
50085008
*/
5009-
#ifdef HAVE_POSIX_DECL_SIGWAIT
5009+
#ifndef WIN32
50105010
pagerprog = getenv("PSQL_WATCH_PAGER");
50115011
#endif
50125012
if (pagerprog && myopt.topt.pager)
@@ -5077,7 +5077,7 @@ do_watch(PQExpBuffer query_buf, double sleep)
50775077
if (pagerpipe && ferror(pagerpipe))
50785078
break;
50795079

5080-
#ifndef HAVE_POSIX_DECL_SIGWAIT
5080+
#ifdef WIN32
50815081

50825082
/*
50835083
* Set up cancellation of 'watch' via SIGINT. We redo this each time
@@ -5158,7 +5158,7 @@ do_watch(PQExpBuffer query_buf, double sleep)
51585158
fflush(stdout);
51595159
}
51605160

5161-
#ifdef HAVE_POSIX_DECL_SIGWAIT
5161+
#ifndef WIN32
51625162
/* Disable the interval timer. */
51635163
memset(&interval, 0, sizeof(interval));
51645164
setitimer(ITIMER_REAL, &interval, NULL);

src/bin/psql/startup.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ log_locus_callback(const char **filename, uint64 *lineno)
110110
}
111111
}
112112

113-
#ifdef HAVE_POSIX_DECL_SIGWAIT
113+
#ifndef WIN32
114114
static void
115115
empty_signal_handler(SIGNAL_ARGS)
116116
{
@@ -308,7 +308,7 @@ main(int argc, char *argv[])
308308

309309
psql_setup_cancel_handler();
310310

311-
#ifdef HAVE_POSIX_DECL_SIGWAIT
311+
#ifndef WIN32
312312

313313
/*
314314
* do_watch() needs signal handlers installed (otherwise sigwait() will

src/include/pg_config.h.in

-7
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,6 @@
149149
don't. */
150150
#undef HAVE_DECL_RTLD_NOW
151151

152-
/* Define to 1 if you have the declaration of `sigwait', and to 0 if you
153-
don't. */
154-
#undef HAVE_DECL_SIGWAIT
155-
156152
/* Define to 1 if you have the declaration of `strlcat', and to 0 if you
157153
don't. */
158154
#undef HAVE_DECL_STRLCAT
@@ -406,9 +402,6 @@
406402
/* Define to 1 if you have the <poll.h> header file. */
407403
#undef HAVE_POLL_H
408404

409-
/* Define to 1 if you have a POSIX-conforming sigwait declaration. */
410-
#undef HAVE_POSIX_DECL_SIGWAIT
411-
412405
/* Define to 1 if you have the `posix_fadvise' function. */
413406
#undef HAVE_POSIX_FADVISE
414407

src/tools/msvc/Solution.pm

-2
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ sub GenerateFiles
246246
HAVE_DECL_PWRITEV => 0,
247247
HAVE_DECL_RTLD_GLOBAL => 0,
248248
HAVE_DECL_RTLD_NOW => 0,
249-
HAVE_DECL_SIGWAIT => 0,
250249
HAVE_DECL_STRLCAT => 0,
251250
HAVE_DECL_STRLCPY => 0,
252251
HAVE_DECL_STRNLEN => 1,
@@ -329,7 +328,6 @@ sub GenerateFiles
329328
HAVE_PAM_PAM_APPL_H => undef,
330329
HAVE_POLL => undef,
331330
HAVE_POLL_H => undef,
332-
HAVE_POSIX_DECL_SIGWAIT => undef,
333331
HAVE_POSIX_FADVISE => undef,
334332
HAVE_POSIX_FALLOCATE => undef,
335333
HAVE_PPC_LWARX_MUTEX_HINT => undef,

0 commit comments

Comments
 (0)