aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorPip Cet2024-08-20 18:31:05 +0000
committerStefan Kangas2024-12-12 22:48:11 +0100
commit15e2b14f03796467fab8e8086d293a5813afaa5b (patch)
treeb0e390cbc89b67c617799019694bf92e4bd78ccc /src/process.c
parent7ce34a3bcf5ed277ef37aa75e1ccbd858543b6cf (diff)
downloademacs-15e2b14f03796467fab8e8086d293a5813afaa5b.tar.gz
emacs-15e2b14f03796467fab8e8086d293a5813afaa5b.zip
Unexec removal: Main part
* configure.ac: Remove unexec-specific parts. (EMACS_CONFIG_FEATURES): Always report that we do not have the UNEXEC feature. (AC_ECHO): No longer display a line about the unexec feature. * lisp/loadup.el: * lisp/startup.el: Remove unexec-specific code. * src/Makefile.in (base_obj): Drop 'UNEXEC_OBJ'. * src/alloc.c (staticvec): Never initialize this variable. (BLOCK_ALIGN): Always allow large blocks. (mmap_lisp_allowed_p): Remove unexec-specific code. * src/buffer.c (init_buffer): * src/conf_post.h (ADDRESS_SANITIZER): * src/emacs.c (load_pdump, main): Remove unexec-specific code. (Fdump_emacs): Remove function. (syms_of_emacs): Remove 'Fdump_emacs'. * src/lastfile.c: Remove unexec-specific code. * src/lisp.h (gflags): Remove unexec-specific flags. (will_dump_p, will_bootstrap_p, will_dump_with_unexec_p) (dumped_with_unexec_p, definitely_will_not_unexec_p): Remove or adjust predicates. (SUBR_SECTION_ATTRIBUTE): Remove unexec-specific definition. * src/pdumper.c (Fdump_emacs_portable): Remove unexec-specific warning. * src/process.c (init_process_emacs): Remove !unexec condition * src/sysdep.c (maybe_disable_address_randomization): Adjust comment. (init_signals): * src/timefns.c (init_timefns): Remove unexec-specific code. * src/w32heap.c (report_temacs_memory_usage): Remove function. * src/w32heap.h: Adjust comment. * src/w32image.c (globals_of_w32image): Remove unexec-specific code.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c67
1 files changed, 28 insertions, 39 deletions
diff --git a/src/process.c b/src/process.c
index b71ba3daf2d..dcf08fd9b57 100644
--- a/src/process.c
+++ b/src/process.c
@@ -8620,50 +8620,39 @@ init_process_emacs (int sockfd)
8620 8620
8621 inhibit_sentinels = 0; 8621 inhibit_sentinels = 0;
8622 8622
8623#ifdef HAVE_UNEXEC 8623#if defined HAVE_GLIB && !defined WINDOWSNT
8624 /* Clear child_signal_read_fd and child_signal_write_fd after dumping, 8624 /* Tickle Glib's child-handling code. Ask Glib to install a
8625 lest wait_reading_process_output should select on nonexistent file 8625 watch source for Emacs itself which will initialize glib's
8626 descriptors which existed in the build process. */ 8626 private SIGCHLD handler, allowing catch_child_signal to copy
8627 child_signal_read_fd = -1; 8627 it into lib_child_handler. This is a hacky workaround to get
8628 child_signal_write_fd = -1; 8628 glib's g_unix_signal_handler into lib_child_handler.
8629#endif /* HAVE_UNEXEC */ 8629
8630 In Glib 2.37.5 (2013), commit 2e471acf changed Glib to
8631 always install a signal handler when g_child_watch_source_new
8632 is called and not just the first time it's called, and to
8633 reset signal handlers to SIG_DFL when it no longer has a
8634 watcher on that signal. Arrange for Emacs's signal handler
8635 to be reinstalled even if this happens.
8636
8637 In Glib 2.73.2 (2022), commit f615eef4 changed Glib again,
8638 to not install a signal handler if the system supports
8639 pidfd_open and waitid (as in Linux kernel 5.3+). The hacky
8640 workaround is not needed in this case. */
8641 GSource *source = g_child_watch_source_new (getpid ());
8642 catch_child_signal ();
8643 g_source_unref (source);
8630 8644
8631 if (!will_dump_with_unexec_p ()) 8645 if (lib_child_handler != dummy_handler)
8632 { 8646 {
8633#if defined HAVE_GLIB && !defined WINDOWSNT 8647 /* The hacky workaround is needed on this platform. */
8634 /* Tickle Glib's child-handling code. Ask Glib to install a 8648 signal_handler_t lib_child_handler_glib = lib_child_handler;
8635 watch source for Emacs itself which will initialize glib's
8636 private SIGCHLD handler, allowing catch_child_signal to copy
8637 it into lib_child_handler. This is a hacky workaround to get
8638 glib's g_unix_signal_handler into lib_child_handler.
8639
8640 In Glib 2.37.5 (2013), commit 2e471acf changed Glib to
8641 always install a signal handler when g_child_watch_source_new
8642 is called and not just the first time it's called, and to
8643 reset signal handlers to SIG_DFL when it no longer has a
8644 watcher on that signal. Arrange for Emacs's signal handler
8645 to be reinstalled even if this happens.
8646
8647 In Glib 2.73.2 (2022), commit f615eef4 changed Glib again,
8648 to not install a signal handler if the system supports
8649 pidfd_open and waitid (as in Linux kernel 5.3+). The hacky
8650 workaround is not needed in this case. */
8651 GSource *source = g_child_watch_source_new (getpid ());
8652 catch_child_signal (); 8649 catch_child_signal ();
8653 g_source_unref (source); 8650 eassert (lib_child_handler == dummy_handler);
8654 8651 lib_child_handler = lib_child_handler_glib;
8655 if (lib_child_handler != dummy_handler) 8652 }
8656 {
8657 /* The hacky workaround is needed on this platform. */
8658 signal_handler_t lib_child_handler_glib = lib_child_handler;
8659 catch_child_signal ();
8660 eassert (lib_child_handler == dummy_handler);
8661 lib_child_handler = lib_child_handler_glib;
8662 }
8663#else 8653#else
8664 catch_child_signal (); 8654 catch_child_signal ();
8665#endif 8655#endif
8666 }
8667 8656
8668#ifdef HAVE_SETRLIMIT 8657#ifdef HAVE_SETRLIMIT
8669 /* Don't allocate more than FD_SETSIZE file descriptors for Emacs itself. */ 8658 /* Don't allocate more than FD_SETSIZE file descriptors for Emacs itself. */