mirror of
https://github.com/postgres/postgres.git
synced 2025-07-18 17:42:25 +03:00
Remove support for on_exit()
All supported platforms support the C89 standard function atexit() (SunOS 4 probably being the last one not to), and supporting both makes the code clumsy.
This commit is contained in:
209
configure
vendored
209
configure
vendored
@ -22536,215 +22536,6 @@ fi
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# Check for one of atexit() or on_exit()
|
|
||||||
|
|
||||||
for ac_func in atexit
|
|
||||||
do
|
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
|
||||||
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
|
|
||||||
$as_echo_n "checking for $ac_func... " >&6; }
|
|
||||||
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
cat >conftest.$ac_ext <<_ACEOF
|
|
||||||
/* confdefs.h. */
|
|
||||||
_ACEOF
|
|
||||||
cat confdefs.h >>conftest.$ac_ext
|
|
||||||
cat >>conftest.$ac_ext <<_ACEOF
|
|
||||||
/* end confdefs.h. */
|
|
||||||
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
|
|
||||||
For example, HP-UX 11i <limits.h> declares gettimeofday. */
|
|
||||||
#define $ac_func innocuous_$ac_func
|
|
||||||
|
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
|
||||||
which can conflict with char $ac_func (); below.
|
|
||||||
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
|
||||||
<limits.h> exists even on freestanding compilers. */
|
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
# include <limits.h>
|
|
||||||
#else
|
|
||||||
# include <assert.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef $ac_func
|
|
||||||
|
|
||||||
/* Override any GCC internal prototype to avoid an error.
|
|
||||||
Use char because int might match the return type of a GCC
|
|
||||||
builtin and then its argument prototype would still apply. */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
#endif
|
|
||||||
char $ac_func ();
|
|
||||||
/* The GNU C library defines this for functions which it implements
|
|
||||||
to always fail with ENOSYS. Some functions are actually named
|
|
||||||
something starting with __ and the normal name is an alias. */
|
|
||||||
#if defined __stub_$ac_func || defined __stub___$ac_func
|
|
||||||
choke me
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
return $ac_func ();
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
|
||||||
if { (ac_try="$ac_link"
|
|
||||||
case "(($ac_try" in
|
|
||||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
|
||||||
*) ac_try_echo=$ac_try;;
|
|
||||||
esac
|
|
||||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
|
||||||
$as_echo "$ac_try_echo") >&5
|
|
||||||
(eval "$ac_link") 2>conftest.er1
|
|
||||||
ac_status=$?
|
|
||||||
grep -v '^ *+' conftest.er1 >conftest.err
|
|
||||||
rm -f conftest.er1
|
|
||||||
cat conftest.err >&5
|
|
||||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
|
||||||
(exit $ac_status); } && {
|
|
||||||
test -z "$ac_c_werror_flag" ||
|
|
||||||
test ! -s conftest.err
|
|
||||||
} && test -s conftest$ac_exeext && {
|
|
||||||
test "$cross_compiling" = yes ||
|
|
||||||
$as_test_x conftest$ac_exeext
|
|
||||||
}; then
|
|
||||||
eval "$as_ac_var=yes"
|
|
||||||
else
|
|
||||||
$as_echo "$as_me: failed program was:" >&5
|
|
||||||
sed 's/^/| /' conftest.$ac_ext >&5
|
|
||||||
|
|
||||||
eval "$as_ac_var=no"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf conftest.dSYM
|
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
|
||||||
fi
|
|
||||||
ac_res=`eval 'as_val=${'$as_ac_var'}
|
|
||||||
$as_echo "$as_val"'`
|
|
||||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
|
||||||
$as_echo "$ac_res" >&6; }
|
|
||||||
as_val=`eval 'as_val=${'$as_ac_var'}
|
|
||||||
$as_echo "$as_val"'`
|
|
||||||
if test "x$as_val" = x""yes; then
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
for ac_func in on_exit
|
|
||||||
do
|
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
|
||||||
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
|
|
||||||
$as_echo_n "checking for $ac_func... " >&6; }
|
|
||||||
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
|
||||||
cat >conftest.$ac_ext <<_ACEOF
|
|
||||||
/* confdefs.h. */
|
|
||||||
_ACEOF
|
|
||||||
cat confdefs.h >>conftest.$ac_ext
|
|
||||||
cat >>conftest.$ac_ext <<_ACEOF
|
|
||||||
/* end confdefs.h. */
|
|
||||||
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
|
|
||||||
For example, HP-UX 11i <limits.h> declares gettimeofday. */
|
|
||||||
#define $ac_func innocuous_$ac_func
|
|
||||||
|
|
||||||
/* System header to define __stub macros and hopefully few prototypes,
|
|
||||||
which can conflict with char $ac_func (); below.
|
|
||||||
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
|
||||||
<limits.h> exists even on freestanding compilers. */
|
|
||||||
|
|
||||||
#ifdef __STDC__
|
|
||||||
# include <limits.h>
|
|
||||||
#else
|
|
||||||
# include <assert.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef $ac_func
|
|
||||||
|
|
||||||
/* Override any GCC internal prototype to avoid an error.
|
|
||||||
Use char because int might match the return type of a GCC
|
|
||||||
builtin and then its argument prototype would still apply. */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
#endif
|
|
||||||
char $ac_func ();
|
|
||||||
/* The GNU C library defines this for functions which it implements
|
|
||||||
to always fail with ENOSYS. Some functions are actually named
|
|
||||||
something starting with __ and the normal name is an alias. */
|
|
||||||
#if defined __stub_$ac_func || defined __stub___$ac_func
|
|
||||||
choke me
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
return $ac_func ();
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
|
||||||
if { (ac_try="$ac_link"
|
|
||||||
case "(($ac_try" in
|
|
||||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
|
||||||
*) ac_try_echo=$ac_try;;
|
|
||||||
esac
|
|
||||||
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
|
|
||||||
$as_echo "$ac_try_echo") >&5
|
|
||||||
(eval "$ac_link") 2>conftest.er1
|
|
||||||
ac_status=$?
|
|
||||||
grep -v '^ *+' conftest.er1 >conftest.err
|
|
||||||
rm -f conftest.er1
|
|
||||||
cat conftest.err >&5
|
|
||||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
|
||||||
(exit $ac_status); } && {
|
|
||||||
test -z "$ac_c_werror_flag" ||
|
|
||||||
test ! -s conftest.err
|
|
||||||
} && test -s conftest$ac_exeext && {
|
|
||||||
test "$cross_compiling" = yes ||
|
|
||||||
$as_test_x conftest$ac_exeext
|
|
||||||
}; then
|
|
||||||
eval "$as_ac_var=yes"
|
|
||||||
else
|
|
||||||
$as_echo "$as_me: failed program was:" >&5
|
|
||||||
sed 's/^/| /' conftest.$ac_ext >&5
|
|
||||||
|
|
||||||
eval "$as_ac_var=no"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf conftest.dSYM
|
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
|
||||||
fi
|
|
||||||
ac_res=`eval 'as_val=${'$as_ac_var'}
|
|
||||||
$as_echo "$as_val"'`
|
|
||||||
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
|
|
||||||
$as_echo "$ac_res" >&6; }
|
|
||||||
as_val=`eval 'as_val=${'$as_ac_var'}
|
|
||||||
$as_echo "$as_val"'`
|
|
||||||
if test "x$as_val" = x""yes; then
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
else
|
|
||||||
{ { $as_echo "$as_me:$LINENO: error: neither atexit() nor on_exit() found" >&5
|
|
||||||
$as_echo "$as_me: error: neither atexit() nor on_exit() found" >&2;}
|
|
||||||
{ (exit 1); exit 1; }; }
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Pthreads
|
# Pthreads
|
||||||
|
@ -1438,11 +1438,6 @@ fi
|
|||||||
AC_CHECK_FUNCS([strtoll strtoq], [break])
|
AC_CHECK_FUNCS([strtoll strtoq], [break])
|
||||||
AC_CHECK_FUNCS([strtoull strtouq], [break])
|
AC_CHECK_FUNCS([strtoull strtouq], [break])
|
||||||
|
|
||||||
# Check for one of atexit() or on_exit()
|
|
||||||
AC_CHECK_FUNCS(atexit, [],
|
|
||||||
[AC_CHECK_FUNCS(on_exit, [],
|
|
||||||
[AC_MSG_ERROR([neither atexit() nor on_exit() found])])])
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Pthreads
|
# Pthreads
|
||||||
|
@ -130,11 +130,7 @@ get_major_server_version(ClusterInfo *cluster)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
#ifdef HAVE_ATEXIT
|
|
||||||
stop_postmaster_atexit(void)
|
stop_postmaster_atexit(void)
|
||||||
#else
|
|
||||||
stop_postmaster_on_exit(int exitstatus, void *arg)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
stop_postmaster(true);
|
stop_postmaster(true);
|
||||||
|
|
||||||
@ -151,11 +147,7 @@ start_postmaster(ClusterInfo *cluster)
|
|||||||
|
|
||||||
if (!exit_hook_registered)
|
if (!exit_hook_registered)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ATEXIT
|
|
||||||
atexit(stop_postmaster_atexit);
|
atexit(stop_postmaster_atexit);
|
||||||
#else
|
|
||||||
on_exit(stop_postmaster_on_exit);
|
|
||||||
#endif
|
|
||||||
exit_hook_registered = true;
|
exit_hook_registered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
bool proc_exit_inprogress = false;
|
bool proc_exit_inprogress = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This flag tracks whether we've called atexit(2) in the current process
|
* This flag tracks whether we've called atexit() in the current process
|
||||||
* (or in the parent postmaster).
|
* (or in the parent postmaster).
|
||||||
*/
|
*/
|
||||||
static bool atexit_callback_setup = false;
|
static bool atexit_callback_setup = false;
|
||||||
@ -51,7 +51,7 @@ static void proc_exit_prepare(int code);
|
|||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
* exit() handling stuff
|
* exit() handling stuff
|
||||||
*
|
*
|
||||||
* These functions are in generally the same spirit as atexit(2),
|
* These functions are in generally the same spirit as atexit(),
|
||||||
* but provide some additional features we need --- in particular,
|
* but provide some additional features we need --- in particular,
|
||||||
* we want to register callbacks to invoke when we are disconnecting
|
* we want to register callbacks to invoke when we are disconnecting
|
||||||
* from a broken shared-memory context but not exiting the postmaster.
|
* from a broken shared-memory context but not exiting the postmaster.
|
||||||
@ -234,8 +234,6 @@ shmem_exit(int code)
|
|||||||
* postmaster treat it as a crash --- see pmsignal.c.
|
* postmaster treat it as a crash --- see pmsignal.c.
|
||||||
* ----------------------------------------------------------------
|
* ----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_ATEXIT
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
atexit_callback(void)
|
atexit_callback(void)
|
||||||
{
|
{
|
||||||
@ -243,15 +241,6 @@ atexit_callback(void)
|
|||||||
/* ... too bad we don't know the real exit code ... */
|
/* ... too bad we don't know the real exit code ... */
|
||||||
proc_exit_prepare(-1);
|
proc_exit_prepare(-1);
|
||||||
}
|
}
|
||||||
#else /* assume we have on_exit instead */
|
|
||||||
|
|
||||||
static void
|
|
||||||
atexit_callback(int exitstatus, void *arg)
|
|
||||||
{
|
|
||||||
/* Clean up everything that must be cleaned up */
|
|
||||||
proc_exit_prepare(exitstatus);
|
|
||||||
}
|
|
||||||
#endif /* HAVE_ATEXIT */
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
* on_proc_exit
|
* on_proc_exit
|
||||||
@ -275,11 +264,7 @@ on_proc_exit(pg_on_exit_callback function, Datum arg)
|
|||||||
|
|
||||||
if (!atexit_callback_setup)
|
if (!atexit_callback_setup)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ATEXIT
|
|
||||||
atexit(atexit_callback);
|
atexit(atexit_callback);
|
||||||
#else
|
|
||||||
on_exit(atexit_callback, NULL);
|
|
||||||
#endif
|
|
||||||
atexit_callback_setup = true;
|
atexit_callback_setup = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -306,11 +291,7 @@ on_shmem_exit(pg_on_exit_callback function, Datum arg)
|
|||||||
|
|
||||||
if (!atexit_callback_setup)
|
if (!atexit_callback_setup)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_ATEXIT
|
|
||||||
atexit(atexit_callback);
|
atexit(atexit_callback);
|
||||||
#else
|
|
||||||
on_exit(atexit_callback, NULL);
|
|
||||||
#endif
|
|
||||||
atexit_callback_setup = true;
|
atexit_callback_setup = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,12 +45,7 @@ static int history_lines_added;
|
|||||||
#define NL_IN_HISTORY 0x01
|
#define NL_IN_HISTORY 0x01
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ATEXIT
|
|
||||||
static void finishInput(void);
|
static void finishInput(void);
|
||||||
#else
|
|
||||||
/* designed for use with on_exit() */
|
|
||||||
static void finishInput(int, void *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -313,11 +308,7 @@ initializeInput(int flags)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ATEXIT
|
|
||||||
atexit(finishInput);
|
atexit(finishInput);
|
||||||
#else
|
|
||||||
on_exit(finishInput, NULL);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -416,11 +407,7 @@ saveHistory(char *fname, int max_lines, bool appendFlag, bool encodeFlag)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
#ifdef HAVE_ATEXIT
|
|
||||||
finishInput(void)
|
finishInput(void)
|
||||||
#else
|
|
||||||
finishInput(int exitstatus, void *arg)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef USE_READLINE
|
#ifdef USE_READLINE
|
||||||
if (useHistory && psql_history)
|
if (useHistory && psql_history)
|
||||||
|
@ -90,9 +90,6 @@
|
|||||||
/* Define to 1 if you have the `append_history' function. */
|
/* Define to 1 if you have the `append_history' function. */
|
||||||
#undef HAVE_APPEND_HISTORY
|
#undef HAVE_APPEND_HISTORY
|
||||||
|
|
||||||
/* Define to 1 if you have the `atexit' function. */
|
|
||||||
#undef HAVE_ATEXIT
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `cbrt' function. */
|
/* Define to 1 if you have the `cbrt' function. */
|
||||||
#undef HAVE_CBRT
|
#undef HAVE_CBRT
|
||||||
|
|
||||||
@ -369,9 +366,6 @@
|
|||||||
/* Define to 1 if you have the <net/if.h> header file. */
|
/* Define to 1 if you have the <net/if.h> header file. */
|
||||||
#undef HAVE_NET_IF_H
|
#undef HAVE_NET_IF_H
|
||||||
|
|
||||||
/* Define to 1 if you have the `on_exit' function. */
|
|
||||||
#undef HAVE_ON_EXIT
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <ossp/uuid.h> header file. */
|
/* Define to 1 if you have the <ossp/uuid.h> header file. */
|
||||||
#undef HAVE_OSSP_UUID_H
|
#undef HAVE_OSSP_UUID_H
|
||||||
|
|
||||||
|
@ -72,9 +72,6 @@
|
|||||||
# define gettimeofday(a,b) gettimeofday(a)
|
# define gettimeofday(a,b) gettimeofday(a)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define to 1 if you have the `atexit' function. */
|
|
||||||
#define HAVE_ATEXIT 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `cbrt' function. */
|
/* Define to 1 if you have the `cbrt' function. */
|
||||||
//#define HAVE_CBRT 1
|
//#define HAVE_CBRT 1
|
||||||
|
|
||||||
@ -279,9 +276,6 @@
|
|||||||
/* Define to 1 if you have the <netinet/tcp.h> header file. */
|
/* Define to 1 if you have the <netinet/tcp.h> header file. */
|
||||||
/* #undef HAVE_NETINET_TCP_H */
|
/* #undef HAVE_NETINET_TCP_H */
|
||||||
|
|
||||||
/* Define to 1 if you have the `on_exit' function. */
|
|
||||||
/* #undef HAVE_ON_EXIT */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <pam/pam_appl.h> header file. */
|
/* Define to 1 if you have the <pam/pam_appl.h> header file. */
|
||||||
/* #undef HAVE_PAM_PAM_APPL_H */
|
/* #undef HAVE_PAM_PAM_APPL_H */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user