View | Details | Raw Unified
Collapse All | Expand All

(-) emacs-21.4-orig/src/lastfile.c (-3 / +71 lines)
 Lines 1358-1363    Link Here 
AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
  linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
  linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
  termcap.h stdio_ext.h fcntl.h term.h strings.h)
  termcap.h stdio_ext.h fcntl.h term.h strings.h)
AC_MSG_CHECKING(if personality LINUX32 can be set)
AC_TRY_COMPILE([#include <sys/personality.h>], [personality (PER_LINUX32)],
	       emacs_cv_personality_linux32=yes,
	       emacs_cv_personality_linux32=no)
AC_MSG_RESULT($emacs_cv_personality_linux32)
if test $emacs_cv_personality_linux32 = yes; then
  AC_DEFINE(HAVE_PERSONALITY_LINUX32, 1,
	    [Define to 1 if personality LINUX32 can be set.])
fi
AC_HEADER_STDC
AC_HEADER_STDC
AC_HEADER_TIME
AC_HEADER_TIME
AC_DECL_SYS_SIGLIST
AC_DECL_SYS_SIGLIST
 Lines 183-188    Link Here 
#undef HAVE_UALARM
#undef HAVE_UALARM
#undef HAVE_SYS_WAIT_H
#undef HAVE_SYS_WAIT_H
#undef HAVE_STRINGS_H
#undef HAVE_STRINGS_H
#undef HAVE_PERSONALITY_LINUX32
#undef HAVE_LIBDNET
#undef HAVE_LIBDNET
#undef HAVE_LIBPTHREADS
#undef HAVE_LIBPTHREADS
 Lines 61-66    Link Here 
#include <sys/resource.h>
#include <sys/resource.h>
#endif
#endif
#ifdef HAVE_PERSONALITY_LINUX32
#include <sys/personality.h>
#endif
#ifndef O_RDWR
#ifndef O_RDWR
#define O_RDWR 2
#define O_RDWR 2
#endif
#endif
 Lines 181-186    Link Here 
   Tells GC how to save a copy of the stack.  */
   Tells GC how to save a copy of the stack.  */
char *stack_bottom;
char *stack_bottom;
/* The address where the heap starts (from the first sbrk (0) call).  */
static void *my_heap_start;
/* The gap between BSS end and heap start as far as we can tell.  */
static unsigned long heap_bss_diff;
/* If the gap between BSS end and heap start is larger than this we try to
   work around it, and if that fails, output a warning in dump-emacs.  */
#define MAX_HEAP_BSS_DIFF (1024*1024)
#ifdef HAVE_WINDOW_SYSTEM
#ifdef HAVE_WINDOW_SYSTEM
extern Lisp_Object Vwindow_system;
extern Lisp_Object Vwindow_system;
#endif /* HAVE_WINDOW_SYSTEM */
#endif /* HAVE_WINDOW_SYSTEM */
 Lines 692-698    Link Here 
      free (malloc_state_ptr);
      free (malloc_state_ptr);
    }
    }
  else
  else
    malloc_using_checking = getenv ("MALLOC_CHECK_") != NULL;
    {
      if (my_heap_start == 0)
	my_heap_start = sbrk (0);
      malloc_using_checking = getenv ("MALLOC_CHECK_") != NULL;
    }
}
}
void (*__malloc_initialize_hook) () = malloc_initialize_hook;
void (*__malloc_initialize_hook) () = malloc_initialize_hook;
 Lines 725-730    Link Here 
  stack_base = &dummy;
  stack_base = &dummy;
#endif
#endif
  if (!initialized)
    {
      extern char my_endbss[];
      extern char *my_endbss_static;
      if (my_heap_start == 0)
	my_heap_start = sbrk (0);
      heap_bss_diff = (char *)my_heap_start
	- (my_endbss > my_endbss_static ? my_endbss : my_endbss_static);
    }
#ifdef LINUX_SBRK_BUG
#ifdef LINUX_SBRK_BUG
  __sbrk (1);
  __sbrk (1);
#endif
#endif
 Lines 763-768    Link Here 
	}
	}
    }
    }
#ifdef HAVE_PERSONALITY_LINUX32
  /* See if there is a gap between the end of BSS and the heap.
     In that case, set personality and exec ourself again.  */
  if (!initialized
      && (strcmp (argv[argc-1], "dump") == 0
	  || strcmp (argv[argc-1], "bootstrap") == 0)
      && heap_bss_diff > MAX_HEAP_BSS_DIFF)
    {
      if (! getenv ("EMACS_HEAP_EXEC"))
	{
	  /* Set this so we only do this once.  */
	  putenv("EMACS_HEAP_EXEC=true");
	  /* A flag to turn off address randomization which is introduced
	   in linux kernel shipped with fedora core 4 */
#define ADD_NO_RANDOMIZE 0x0040000
	  personality (PER_LINUX32 | ADD_NO_RANDOMIZE);
#undef  ADD_NO_RANDOMIZE
	  execvp (argv[0], argv);
	  /* If the exec fails, try to dump anyway.  */
	  perror ("execvp");
	}
    }
#endif /* HAVE_PERSONALITY_LINUX32 */
/* Map in shared memory, if we are using that.  */
/* Map in shared memory, if we are using that.  */
#ifdef HAVE_SHM
#ifdef HAVE_SHM
  if (argmatch (argv, argc, "-nl", "--no-shared-memory", 6, NULL, &skip_args))
  if (argmatch (argv, argc, "-nl", "--no-shared-memory", 6, NULL, &skip_args))
 Lines 40-46    Link Here 
char my_edata[] = "End of Emacs initialized data";
char my_edata[] = "End of Emacs initialized data";
#ifdef WINDOWSNT
/* Help unexec locate the end of the .bss area used by Emacs (which
/* Help unexec locate the end of the .bss area used by Emacs (which
   isn't always a separate section in NT executables).  */
   isn't always a separate section in NT executables).  */
char my_endbss[1];
char my_endbss[1];
 Lines 50-53    Link Here 
   of the bss area used by Emacs.  */
   of the bss area used by Emacs.  */
static char _my_endbss[1];
static char _my_endbss[1];
char * my_endbss_static = _my_endbss;
char * my_endbss_static = _my_endbss;
#endif