Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd383c23

Browse files
committed
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 bothmakes the code clumsy.
1 parentc317a3a commitd383c23

File tree

7 files changed

+2
-268
lines changed

7 files changed

+2
-268
lines changed

‎configure

Lines changed: 0 additions & 209 deletions
Original file line numberDiff line numberDiff line change
@@ -22536,215 +22536,6 @@ fi
2253622536
done
2253722537

2253822538

22539-
# Check for one of atexit() or on_exit()
22540-
22541-
for ac_func in atexit
22542-
do
22543-
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
22544-
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
22545-
$as_echo_n "checking for $ac_func... " >&6; }
22546-
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
22547-
$as_echo_n "(cached) " >&6
22548-
else
22549-
cat >conftest.$ac_ext <<_ACEOF
22550-
/* confdefs.h. */
22551-
_ACEOF
22552-
cat confdefs.h >>conftest.$ac_ext
22553-
cat >>conftest.$ac_ext <<_ACEOF
22554-
/* end confdefs.h. */
22555-
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
22556-
For example, HP-UX 11i <limits.h> declares gettimeofday. */
22557-
#define $ac_func innocuous_$ac_func
22558-
22559-
/* System header to define __stub macros and hopefully few prototypes,
22560-
which can conflict with char $ac_func (); below.
22561-
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
22562-
<limits.h> exists even on freestanding compilers. */
22563-
22564-
#ifdef __STDC__
22565-
# include <limits.h>
22566-
#else
22567-
# include <assert.h>
22568-
#endif
22569-
22570-
#undef $ac_func
22571-
22572-
/* Override any GCC internal prototype to avoid an error.
22573-
Use char because int might match the return type of a GCC
22574-
builtin and then its argument prototype would still apply. */
22575-
#ifdef __cplusplus
22576-
extern "C"
22577-
#endif
22578-
char $ac_func ();
22579-
/* The GNU C library defines this for functions which it implements
22580-
to always fail with ENOSYS. Some functions are actually named
22581-
something starting with __ and the normal name is an alias. */
22582-
#if defined __stub_$ac_func || defined __stub___$ac_func
22583-
choke me
22584-
#endif
22585-
22586-
int
22587-
main ()
22588-
{
22589-
return $ac_func ();
22590-
;
22591-
return 0;
22592-
}
22593-
_ACEOF
22594-
rm -f conftest.$ac_objext conftest$ac_exeext
22595-
if { (ac_try="$ac_link"
22596-
case "(($ac_try" in
22597-
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22598-
*) ac_try_echo=$ac_try;;
22599-
esac
22600-
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
22601-
$as_echo "$ac_try_echo") >&5
22602-
(eval "$ac_link") 2>conftest.er1
22603-
ac_status=$?
22604-
grep -v '^ *+' conftest.er1 >conftest.err
22605-
rm -f conftest.er1
22606-
cat conftest.err >&5
22607-
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
22608-
(exit $ac_status); } && {
22609-
test -z "$ac_c_werror_flag" ||
22610-
test ! -s conftest.err
22611-
} && test -s conftest$ac_exeext && {
22612-
test "$cross_compiling" = yes ||
22613-
$as_test_x conftest$ac_exeext
22614-
}; then
22615-
eval "$as_ac_var=yes"
22616-
else
22617-
$as_echo "$as_me: failed program was:" >&5
22618-
sed 's/^/| /' conftest.$ac_ext >&5
22619-
22620-
eval "$as_ac_var=no"
22621-
fi
22622-
22623-
rm -rf conftest.dSYM
22624-
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22625-
conftest$ac_exeext conftest.$ac_ext
22626-
fi
22627-
ac_res=`eval 'as_val=${'$as_ac_var'}
22628-
$as_echo "$as_val"'`
22629-
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
22630-
$as_echo "$ac_res" >&6; }
22631-
as_val=`eval 'as_val=${'$as_ac_var'}
22632-
$as_echo "$as_val"'`
22633-
if test "x$as_val" = x""yes; then
22634-
cat >>confdefs.h <<_ACEOF
22635-
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
22636-
_ACEOF
22637-
22638-
else
22639-
22640-
for ac_func in on_exit
22641-
do
22642-
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
22643-
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
22644-
$as_echo_n "checking for $ac_func... " >&6; }
22645-
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
22646-
$as_echo_n "(cached) " >&6
22647-
else
22648-
cat >conftest.$ac_ext <<_ACEOF
22649-
/* confdefs.h. */
22650-
_ACEOF
22651-
cat confdefs.h >>conftest.$ac_ext
22652-
cat >>conftest.$ac_ext <<_ACEOF
22653-
/* end confdefs.h. */
22654-
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
22655-
For example, HP-UX 11i <limits.h> declares gettimeofday. */
22656-
#define $ac_func innocuous_$ac_func
22657-
22658-
/* System header to define __stub macros and hopefully few prototypes,
22659-
which can conflict with char $ac_func (); below.
22660-
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
22661-
<limits.h> exists even on freestanding compilers. */
22662-
22663-
#ifdef __STDC__
22664-
# include <limits.h>
22665-
#else
22666-
# include <assert.h>
22667-
#endif
22668-
22669-
#undef $ac_func
22670-
22671-
/* Override any GCC internal prototype to avoid an error.
22672-
Use char because int might match the return type of a GCC
22673-
builtin and then its argument prototype would still apply. */
22674-
#ifdef __cplusplus
22675-
extern "C"
22676-
#endif
22677-
char $ac_func ();
22678-
/* The GNU C library defines this for functions which it implements
22679-
to always fail with ENOSYS. Some functions are actually named
22680-
something starting with __ and the normal name is an alias. */
22681-
#if defined __stub_$ac_func || defined __stub___$ac_func
22682-
choke me
22683-
#endif
22684-
22685-
int
22686-
main ()
22687-
{
22688-
return $ac_func ();
22689-
;
22690-
return 0;
22691-
}
22692-
_ACEOF
22693-
rm -f conftest.$ac_objext conftest$ac_exeext
22694-
if { (ac_try="$ac_link"
22695-
case "(($ac_try" in
22696-
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
22697-
*) ac_try_echo=$ac_try;;
22698-
esac
22699-
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
22700-
$as_echo "$ac_try_echo") >&5
22701-
(eval "$ac_link") 2>conftest.er1
22702-
ac_status=$?
22703-
grep -v '^ *+' conftest.er1 >conftest.err
22704-
rm -f conftest.er1
22705-
cat conftest.err >&5
22706-
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
22707-
(exit $ac_status); } && {
22708-
test -z "$ac_c_werror_flag" ||
22709-
test ! -s conftest.err
22710-
} && test -s conftest$ac_exeext && {
22711-
test "$cross_compiling" = yes ||
22712-
$as_test_x conftest$ac_exeext
22713-
}; then
22714-
eval "$as_ac_var=yes"
22715-
else
22716-
$as_echo "$as_me: failed program was:" >&5
22717-
sed 's/^/| /' conftest.$ac_ext >&5
22718-
22719-
eval "$as_ac_var=no"
22720-
fi
22721-
22722-
rm -rf conftest.dSYM
22723-
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
22724-
conftest$ac_exeext conftest.$ac_ext
22725-
fi
22726-
ac_res=`eval 'as_val=${'$as_ac_var'}
22727-
$as_echo "$as_val"'`
22728-
{ $as_echo "$as_me:$LINENO: result: $ac_res" >&5
22729-
$as_echo "$ac_res" >&6; }
22730-
as_val=`eval 'as_val=${'$as_ac_var'}
22731-
$as_echo "$as_val"'`
22732-
if test "x$as_val" = x""yes; then
22733-
cat >>confdefs.h <<_ACEOF
22734-
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
22735-
_ACEOF
22736-
22737-
else
22738-
{ { $as_echo "$as_me:$LINENO: error: neither atexit() nor on_exit() found" >&5
22739-
$as_echo "$as_me: error: neither atexit() nor on_exit() found" >&2;}
22740-
{ (exit 1); exit 1; }; }
22741-
fi
22742-
done
22743-
22744-
fi
22745-
done
22746-
22747-
2274822539

2274922540
#
2275022541
# Pthreads

‎configure.in

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,11 +1438,6 @@ fi
14381438
AC_CHECK_FUNCS([strtoll strtoq], [break])
14391439
AC_CHECK_FUNCS([strtoull strtouq], [break])
14401440

1441-
# Check for one of atexit() or on_exit()
1442-
AC_CHECK_FUNCS(atexit, [],
1443-
[AC_CHECK_FUNCS(on_exit, [],
1444-
[AC_MSG_ERROR([neither atexit() nor on_exit() found])])])
1445-
14461441

14471442
#
14481443
# Pthreads

‎contrib/pg_upgrade/server.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,7 @@ get_major_server_version(ClusterInfo *cluster)
130130

131131

132132
staticvoid
133-
#ifdefHAVE_ATEXIT
134133
stop_postmaster_atexit(void)
135-
#else
136-
stop_postmaster_on_exit(intexitstatus,void*arg)
137-
#endif
138134
{
139135
stop_postmaster(true);
140136

@@ -151,11 +147,7 @@ start_postmaster(ClusterInfo *cluster)
151147

152148
if (!exit_hook_registered)
153149
{
154-
#ifdefHAVE_ATEXIT
155150
atexit(stop_postmaster_atexit);
156-
#else
157-
on_exit(stop_postmaster_on_exit);
158-
#endif
159151
exit_hook_registered= true;
160152
}
161153

‎src/backend/storage/ipc/ipc.c

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
boolproc_exit_inprogress= false;
4040

4141
/*
42-
* This flag tracks whether we've called atexit(2) in the current process
42+
* This flag tracks whether we've called atexit() in the current process
4343
* (or in the parent postmaster).
4444
*/
4545
staticboolatexit_callback_setup= false;
@@ -51,7 +51,7 @@ static void proc_exit_prepare(int code);
5151
/* ----------------------------------------------------------------
5252
*exit() handling stuff
5353
*
54-
* These functions are in generally the same spirit as atexit(2),
54+
* These functions are in generally the same spirit as atexit(),
5555
* but provide some additional features we need --- in particular,
5656
* we want to register callbacks to invoke when we are disconnecting
5757
* from a broken shared-memory context but not exiting the postmaster.
@@ -234,24 +234,13 @@ shmem_exit(int code)
234234
* postmaster treat it as a crash --- see pmsignal.c.
235235
* ----------------------------------------------------------------
236236
*/
237-
#ifdefHAVE_ATEXIT
238-
239237
staticvoid
240238
atexit_callback(void)
241239
{
242240
/* Clean up everything that must be cleaned up */
243241
/* ... too bad we don't know the real exit code ... */
244242
proc_exit_prepare(-1);
245243
}
246-
#else/* assume we have on_exit instead */
247-
248-
staticvoid
249-
atexit_callback(intexitstatus,void*arg)
250-
{
251-
/* Clean up everything that must be cleaned up */
252-
proc_exit_prepare(exitstatus);
253-
}
254-
#endif/* HAVE_ATEXIT */
255244

256245
/* ----------------------------------------------------------------
257246
*on_proc_exit
@@ -275,11 +264,7 @@ on_proc_exit(pg_on_exit_callback function, Datum arg)
275264

276265
if (!atexit_callback_setup)
277266
{
278-
#ifdefHAVE_ATEXIT
279267
atexit(atexit_callback);
280-
#else
281-
on_exit(atexit_callback,NULL);
282-
#endif
283268
atexit_callback_setup= true;
284269
}
285270
}
@@ -306,11 +291,7 @@ on_shmem_exit(pg_on_exit_callback function, Datum arg)
306291

307292
if (!atexit_callback_setup)
308293
{
309-
#ifdefHAVE_ATEXIT
310294
atexit(atexit_callback);
311-
#else
312-
on_exit(atexit_callback,NULL);
313-
#endif
314295
atexit_callback_setup= true;
315296
}
316297
}

‎src/bin/psql/input.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,7 @@ static inthistory_lines_added;
4545
#defineNL_IN_HISTORY0x01
4646
#endif
4747

48-
#ifdefHAVE_ATEXIT
4948
staticvoidfinishInput(void);
50-
#else
51-
/* designed for use with on_exit() */
52-
staticvoidfinishInput(int,void*);
53-
#endif
5449

5550

5651
/*
@@ -313,11 +308,7 @@ initializeInput(int flags)
313308
}
314309
#endif
315310

316-
#ifdefHAVE_ATEXIT
317311
atexit(finishInput);
318-
#else
319-
on_exit(finishInput,NULL);
320-
#endif
321312
}
322313

323314

@@ -416,11 +407,7 @@ saveHistory(char *fname, int max_lines, bool appendFlag, bool encodeFlag)
416407

417408

418409
staticvoid
419-
#ifdefHAVE_ATEXIT
420410
finishInput(void)
421-
#else
422-
finishInput(intexitstatus,void*arg)
423-
#endif
424411
{
425412
#ifdefUSE_READLINE
426413
if (useHistory&&psql_history)

‎src/include/pg_config.h.in

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@
9090
/* Define to 1 if you have the `append_history' function. */
9191
#undef HAVE_APPEND_HISTORY
9292

93-
/* Define to 1 if you have the `atexit' function. */
94-
#undef HAVE_ATEXIT
95-
9693
/* Define to 1 if you have the `cbrt' function. */
9794
#undef HAVE_CBRT
9895

@@ -369,9 +366,6 @@
369366
/* Define to 1 if you have the <net/if.h> header file. */
370367
#undef HAVE_NET_IF_H
371368

372-
/* Define to 1 if you have the `on_exit' function. */
373-
#undef HAVE_ON_EXIT
374-
375369
/* Define to 1 if you have the <ossp/uuid.h> header file. */
376370
#undef HAVE_OSSP_UUID_H
377371

‎src/include/pg_config.h.win32

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@
7272
# define gettimeofday(a,b) gettimeofday(a)
7373
#endif
7474

75-
/* Define to 1 if you have the `atexit' function. */
76-
#define HAVE_ATEXIT 1
77-
7875
/* Define to 1 if you have the `cbrt' function. */
7976
//#define HAVE_CBRT 1
8077

@@ -279,9 +276,6 @@
279276
/* Define to 1 if you have the <netinet/tcp.h> header file. */
280277
/* #undef HAVE_NETINET_TCP_H */
281278

282-
/* Define to 1 if you have the `on_exit' function. */
283-
/* #undef HAVE_ON_EXIT */
284-
285279
/* Define to 1 if you have the <pam/pam_appl.h> header file. */
286280
/* #undef HAVE_PAM_PAM_APPL_H */
287281

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp