#ifdef DOUG_LEA_MALLOC
/* Preserves a pointer to the memory allocated that copies that
static data inside glibc's malloc. */
#ifdef DOUG_LEA_MALLOC
/* Preserves a pointer to the memory allocated that copies that
static data inside glibc's malloc. */
/* From glibc, a routine that returns a copy of the malloc internal state. */
extern void *malloc_get_state (void);
/* From glibc, a routine that overwrites the malloc internal state. */
extern int malloc_set_state (void*);
/* Non-zero if the MALLOC_CHECK_ environment variable was set while
dumping. Used to work around a bug in glibc's malloc. */
/* From glibc, a routine that returns a copy of the malloc internal state. */
extern void *malloc_get_state (void);
/* From glibc, a routine that overwrites the malloc internal state. */
extern int malloc_set_state (void*);
/* Non-zero if the MALLOC_CHECK_ environment variable was set while
dumping. Used to work around a bug in glibc's malloc. */
but instead should use the virtual terminal under which it was started. */
int inhibit_window_system;
but instead should use the virtual terminal under which it was started. */
int inhibit_window_system;
/* The gap between BSS end and heap start as far as we can tell. */
static unsigned long heap_bss_diff;
/* The gap between BSS end and heap start as far as we can tell. */
static unsigned long heap_bss_diff;
/* MSVC needs each string be shorter than 2048 bytes, so the usage
strings below are split to not overflow this limit. */
/* MSVC needs each string be shorter than 2048 bytes, so the usage
strings below are split to not overflow this limit. */
--border-color, -bd COLOR main border color\n\
--border-width, -bw WIDTH width of main border\n\
--color, --color=MODE override color mode for character terminals;\n\
--border-color, -bd COLOR main border color\n\
--border-width, -bw WIDTH width of main border\n\
--color, --color=MODE override color mode for character terminals;\n\
- MODE defaults to `auto', and can also\n\
- be `never', `auto', `always',\n\
+ MODE defaults to `auto', and\n\
+ can also be `never', `always',\n\
or a mode name like `ansi8'\n\
--cursor-color, -cr COLOR color of the Emacs cursor indicating point\n\
--font, -fn FONT default font; must be fixed-width\n\
--foreground-color, -fg COLOR window foreground color\n\
--fullheight, -fh make the first frame high as the screen\n\
or a mode name like `ansi8'\n\
--cursor-color, -cr COLOR color of the Emacs cursor indicating point\n\
--font, -fn FONT default font; must be fixed-width\n\
--foreground-color, -fg COLOR window foreground color\n\
--fullheight, -fh make the first frame high as the screen\n\
--fullwidth, -fw make the first frame wide as the screen\n\
--maximized, -mm make the first frame maximized\n\
--geometry, -g GEOMETRY window geometry\n\
--fullwidth, -fw make the first frame wide as the screen\n\
--maximized, -mm make the first frame maximized\n\
--geometry, -g GEOMETRY window geometry\n\
#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
/* When compiled with GTK and running under Gnome,
#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
/* When compiled with GTK and running under Gnome,
raw_name = concat2 (build_string ("/:"), raw_name);
Vinvocation_name = Ffile_name_nondirectory (raw_name);
raw_name = concat2 (build_string ("/:"), raw_name);
Vinvocation_name = Ffile_name_nondirectory (raw_name);
found = concat2 (build_string ("/:"), found);
Vinvocation_directory = Ffile_name_directory (found);
}
found = concat2 (build_string ("/:"), found);
Vinvocation_directory = Ffile_name_directory (found);
}
+
+/* Define a dummy function F. Declare F too, to pacify gcc
+ -Wmissing-prototypes. */
+#define DEFINE_DUMMY_FUNCTION(f) \
+ void f (void) EXTERNALLY_VISIBLE; void f (void) {}
+
-void __do_global_ctors (void)
-{}
-void __do_global_ctors_aux (void)
-{}
-void __do_global_dtors (void)
-{}
+DEFINE_DUMMY_FUNCTION (__do_global_ctors)
+DEFINE_DUMMY_FUNCTION (__do_global_ctors_aux)
+DEFINE_DUMMY_FUNCTION (__do_global_dtors)
-argmatch (char **argv, int argc, const char *sstr, const char *lstr, int minlen, char **valptr, int *skipptr)
+argmatch (char **argv, int argc, const char *sstr, const char *lstr,
+ int minlen, char **valptr, int *skipptr)
/* Convert --script to -scriptload, un-skip it, and sort again
so that it will be handled in proper sequence. */
/* FIXME broken for --script=FILE - is that supposed to work? */
/* Convert --script to -scriptload, un-skip it, and sort again
so that it will be handled in proper sequence. */
/* FIXME broken for --script=FILE - is that supposed to work? */
/* Change --display to -d, when its arg is separate. */
else if (displayname != 0 && skip_args > count_before
&& argv[count_before + 1][1] == '-')
/* Change --display to -d, when its arg is separate. */
else if (displayname != 0 && skip_args > count_before
&& argv[count_before + 1][1] == '-')
syms_of_callproc ();
/* egetenv is a pretty low-level facility, which may get called in
many circumstances; it seems flimsy to put off initializing it
syms_of_callproc ();
/* egetenv is a pretty low-level facility, which may get called in
many circumstances; it seems flimsy to put off initializing it
- until calling init_callproc. */
- set_initial_environment ();
+ until calling init_callproc. Do not do it when dumping. */
+ if (initialized || ((strcmp (argv[argc-1], "dump") != 0
+ && strcmp (argv[argc-1], "bootstrap") != 0)))
+ set_initial_environment ();
+
/* AIX crashes are reported in system versions 3.2.3 and 3.2.4
if this is not done. Do it after set_global_environment so that we
don't pollute Vglobal_environment. */
/* AIX crashes are reported in system versions 3.2.3 and 3.2.4
if this is not done. Do it after set_global_environment so that we
don't pollute Vglobal_environment. */
{
{ "-version", "--version", 150, 0 },
{ "-chdir", "--chdir", 130, 1 },
{
{ "-version", "--version", 150, 0 },
{ "-chdir", "--chdir", 130, 1 },
shut_down_emacs (0, 0, STRINGP (arg) ? arg : Qnil);
/* If we have an auto-save list file,
shut_down_emacs (0, 0, STRINGP (arg) ? arg : Qnil);
/* If we have an auto-save list file,
DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0,
doc: /* Dump current state of Emacs into executable file FILENAME.
DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0,
doc: /* Dump current state of Emacs into executable file FILENAME.
You must run Emacs in batch mode in order to dump it. */)
(Lisp_Object filename, Lisp_Object symfile)
{
You must run Emacs in batch mode in order to dump it. */)
(Lisp_Object filename, Lisp_Object symfile)
{
if (heap_bss_diff > MAX_HEAP_BSS_DIFF)
{
fprintf (stderr, "**************************************************\n");
if (heap_bss_diff > MAX_HEAP_BSS_DIFF)
{
fprintf (stderr, "**************************************************\n");
#ifndef WINDOWSNT
/* On Windows, this was done before dumping, and that once suffices.
Meanwhile, my_edata is not valid on Windows. */
#ifndef WINDOWSNT
/* On Windows, this was done before dumping, and that once suffices.
Meanwhile, my_edata is not valid on Windows. */
#endif /* not WINDOWSNT */
#if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT
/* Pthread may call malloc before main, and then we will get an endless
#endif /* not WINDOWSNT */
#if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT
/* Pthread may call malloc before main, and then we will get an endless
/* Get rid of stdin, stdout and stderr. */
nfd = open ("/dev/null", O_RDWR);
/* Get rid of stdin, stdout and stderr. */
nfd = open ("/dev/null", O_RDWR);
- dup2 (nfd, 0);
- dup2 (nfd, 1);
- dup2 (nfd, 2);
- close (nfd);
+ err |= nfd < 0;
+ err |= dup2 (nfd, 0) < 0;
+ err |= dup2 (nfd, 1) < 0;
+ err |= dup2 (nfd, 2) < 0;
+ err |= close (nfd) != 0;
/* Closing the pipe will notify the parent that it can exit.
FIXME: In case some other process inherited the pipe, closing it here
/* Closing the pipe will notify the parent that it can exit.
FIXME: In case some other process inherited the pipe, closing it here
Instead, we should probably close the pipe in start-process and
call-process to make sure the pipe is never inherited by
subprocesses. */
Instead, we should probably close the pipe in start-process and
call-process to make sure the pipe is never inherited by
subprocesses. */
- write (daemon_pipe[1], "\n", 1);
- close (daemon_pipe[1]);
+ err |= write (daemon_pipe[1], "\n", 1) < 0;
+ err |= close (daemon_pipe[1]) != 0;
Anything else (in Emacs 24.1, the possibilities are: aix, berkeley-unix,
hpux, irix, usg-unix-v) indicates some sort of Unix system. */);
Vsystem_type = intern_c_string (SYSTEM_TYPE);
Anything else (in Emacs 24.1, the possibilities are: aix, berkeley-unix,
hpux, irix, usg-unix-v) indicates some sort of Unix system. */);
Vsystem_type = intern_c_string (SYSTEM_TYPE);
DEFVAR_LISP ("system-configuration", Vsystem_configuration,
doc: /* Value is string indicating configuration Emacs was built for.
DEFVAR_LISP ("system-configuration", Vsystem_configuration,
doc: /* Value is string indicating configuration Emacs was built for.