]> git.eshelyaron.com Git - emacs.git/commitdiff
Revert "use memory mapped file for loading elns"
authorAndrea Corallo <akrl@sdf.org>
Tue, 24 Dec 2019 07:17:40 +0000 (08:17 +0100)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:38:15 +0000 (11:38 +0100)
This reverts commit 5e07231151ef60a5066617ef6cec7c0077825b1c.

src/comp.c

index 75b41e2af8fbd42d1d73a6cb211f5f2e8cc1fb8c..68b1cdf7449b75cf32beab7989303ede50bc34d7 100644 (file)
@@ -27,13 +27,6 @@ along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
 #include <signal.h>
 #include <libgccjit.h>
 
-#include <sys/types.h> /* For getpid.  */
-#include <unistd.h>
-#include <sys/stat.h> /* For O_RDONLY.  */
-#include <fcntl.h>
-/* FIXME non portable.  */
-#include <sys/mman.h> /* For memfd_create.  */
-
 #include "lisp.h"
 #include "puresize.h"
 #include "window.h"
@@ -3305,22 +3298,8 @@ DEFUN ("native-elisp-load", Fnative_elisp_load, Snative_elisp_load, 1, 1, 0,
     xsignal2 (Qnative_lisp_load_failed, file,
              build_string ("Empty relocation table"));
 
-  /* FIXME non portable.  */
-  /* We copy the content of the file to be loaded in a memory mapped
-     file.  We then keep track of this in the struct
-     Lisp_Native_Comp_Unit.  In case this will be overwritten
-     or delete we'll dump the right data.  */
-  int fd_in = emacs_open (SSDATA (file), O_RDONLY, 0);
-  int fd_out = memfd_create (SSDATA (file), 0);
-  if (fd_in < 0 || fd_out < 0)
-    xsignal2 (Qnative_lisp_load_failed, file,
-             build_string ("Failing to get file descriptor"));
-  struct stat st;
-  if (fstat (fd_in, &st) != 0)
-    report_file_error ("Input file status", file);
-  copy_file_fd (fd_out, fd_in, &st, Qnil, file);
-  dynlib_handle_ptr handle =
-    dynlib_open (format_string ("/proc/%d/fd/%d", getpid (), fd_out));
+  dynlib_handle_ptr handle = dynlib_open (SSDATA (file));
+  load_handle_stack = Fcons (make_mint_ptr (handle), load_handle_stack);
   if (!handle)
     xsignal2 (Qnative_lisp_load_failed, file, build_string (dynlib_error ()));
   struct Lisp_Native_Comp_Unit *comp_u = allocate_native_comp_unit();