]> git.eshelyaron.com Git - emacs.git/commitdiff
merge from trunk
authorTom Tromey <tromey@redhat.com>
Mon, 17 Dec 2012 14:56:22 +0000 (07:56 -0700)
committerTom Tromey <tromey@redhat.com>
Mon, 17 Dec 2012 14:56:22 +0000 (07:56 -0700)
20 files changed:
1  2 
configure.ac
doc/lispref/elisp.texi
doc/lispref/objects.texi
doc/lispref/processes.texi
lisp/subr.el
src/Makefile.in
src/alloc.c
src/buffer.c
src/buffer.h
src/bytecode.c
src/data.c
src/emacs.c
src/eval.c
src/lisp.h
src/print.c
src/process.c
src/process.h
src/regex.c
src/search.c
src/window.c

diff --cc configure.ac
index d4b0fc256b41e24149cecb5fb9cbc8a9245eb949,3c8be79e24c612941ad091a3a3e8a1c4d59cf70f..6ca44c224a341b8b2ae4309c41b1613967705b84
  dnl checks for header files
  AC_CHECK_HEADERS_ONCE(
    linux/version.h sys/systeminfo.h
-   stdio_ext.h fcntl.h coff.h pty.h
+   coff.h pty.h
    sys/vlimit.h sys/resource.h
-   sys/utsname.h pwd.h utmp.h dirent.h util.h sys/prctl.h)
 -  sys/utsname.h pwd.h utmp.h util.h)
++  sys/utsname.h pwd.h utmp.h util.h sys/prctl.h)
  
  AC_MSG_CHECKING(if personality LINUX32 can be set)
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/personality.h>]], [[personality (PER_LINUX32)]])],
@@@ -2790,16 -2946,8 +2946,8 @@@ gai_strerror mkstemp getline getdelim f
  difftime posix_memalign \
  getpwent endpwent getgrent endgrent \
  touchlock \
 -cfmakeraw cfsetspeed copysign __executable_start)
 +cfmakeraw cfsetspeed copysign __executable_start prctl)
  
- dnl getwd appears to be buggy on SVR4.2, so we don't use it.
- if test $opsys = unixware; then
-   dnl In case some other test ends up checking for getwd.
-   AC_DEFINE(BROKEN_GETWD, 1, [Define if getwd should not be used.])
- else
-   AC_CHECK_FUNCS(getwd)
- fi
  ## Eric Backus <ericb@lsid.hp.com> says, HP-UX 9.x on HP 700 machines
  ## has a broken `rint' in some library versions including math library
  ## version number A.09.05.
Simple merge
Simple merge
Simple merge
diff --cc lisp/subr.el
Simple merge
diff --cc src/Makefile.in
index 24c8b94b5905c7cf80e6a5fb9989b4a41a229ed1,0e91eaecb17801872ce37f79bd5346aaabddac56..b920600c4c056bbf72e073c3271c5d357b88e718
@@@ -340,10 -353,11 +353,12 @@@ base_obj = dispnew.o frame.o scroll.o x
        eval.o floatfns.o fns.o font.o print.o lread.o \
        syntax.o $(UNEXEC_OBJ) bytecode.o \
        process.o gnutls.o callproc.o \
-       region-cache.o sound.o atimer.o thread.o systhread.o \
-       doprnt.o intervals.o textprop.o composite.o xml.o \
+       region-cache.o sound.o atimer.o \
+       doprnt.o intervals.o textprop.o composite.o xml.o inotify.o \
+       profiler.o \
++      thread.o systhread.o \
        $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \
-       $(WINDOW_SYSTEM_OBJ)
+       $(W32_OBJ) $(WINDOW_SYSTEM_OBJ)
  obj = $(base_obj) $(NS_OBJC_OBJ)
  
  ## Object files used on some machine or other.
diff --cc src/alloc.c
index 859961781e08907135340f01a4e10e9d355d2d12,5a3ba465d81d8be40bf5b4d55d3128fbc9107ba0..d091a9cdf55e28784d9217b2dad763dd314b0548
@@@ -3104,16 -2842,10 +2833,17 @@@ sweep_vectors (void
            }
          else
            {
-             ptrdiff_t nbytes = PSEUDOVECTOR_NBYTES (vector);
-             ptrdiff_t total_bytes = nbytes;
+             ptrdiff_t total_bytes;
  
 +            if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_THREAD))
 +              finalize_one_thread ((struct thread_state *) vector);
 +            else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_MUTEX))
 +              finalize_one_mutex ((struct Lisp_Mutex *) vector);
 +            else if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_CONDVAR))
 +              finalize_one_condvar ((struct Lisp_CondVar *) vector);
 +
+             nbytes = vector_nbytes (vector);
+             total_bytes = nbytes;
              next = ADVANCE (vector, nbytes);
  
              /* While NEXT is not marked, try to coalesce with VECTOR,
@@@ -4912,9 -4635,9 +4652,9 @@@ flush_stack_call_func (void (*func) (vo
    /* jmp_buf may not be aligned enough on darwin-ppc64 */
    union aligned_jmpbuf {
      Lisp_Object o;
-     jmp_buf j;
+     sys_jmp_buf j;
    } j;
 -  volatile bool stack_grows_down_p = (char *) &j > (char *) stack_base;
 +  volatile bool stack_grows_down_p = (char *) &j > (char *) stack_bottom;
  #endif
    /* This trick flushes the register windows so that all the state of
       the process is contained in the stack.  */
diff --cc src/buffer.c
Simple merge
diff --cc src/buffer.h
index e603486418be0d5347575a9d1b899391d1041ed6,d838d3767efaeb543221d1e2188db1d836649006..a65b769469ffe06f195fcf083246369dfb25a24e
@@@ -967,8 -1014,12 +1014,8 @@@ extern struct buffer *all_buffers
  /* Used to iterate over the chain above.  */
  
  #define FOR_EACH_BUFFER(b) \
-   for ((b) = all_buffers; (b); (b) = (b)->header.next.buffer)
+   for ((b) = all_buffers; (b); (b) = (b)->next)
  
 -/* This points to the current buffer.  */
 -
 -extern struct buffer *current_buffer;
 -
  /* This structure holds the default values of the buffer-local variables
     that have special slots in each buffer.
     The default value occupies the same slot in this structure
diff --cc src/bytecode.c
Simple merge
diff --cc src/data.c
index a93cd169bf59187e00e7843da9b76b6ceead35df,a72fa3e2b5faf7ac8428d51dcf5dc3825f941739..540c91bd4a5bc9be725a6a0dcbebb8448170cc86
@@@ -94,9 -79,9 +79,10 @@@ static Lisp_Object Qchar_table, Qbool_v
  static Lisp_Object Qsubrp, Qmany, Qunevalled;
  Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
  static Lisp_Object Qdefun;
 +Lisp_Object Qthread, Qmutex, Qcondition_variable;
  
  Lisp_Object Qinteractive_form;
+ static Lisp_Object Qdefalias_fset_function;
  
  static void swap_in_symval_forwarding (struct Lisp_Symbol *, struct Lisp_Buffer_Local_Value *);
  
@@@ -465,38 -444,8 +451,38 @@@ DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1
    return Qnil;
  }
  
 +DEFUN ("threadp", Fthreadp, Sthreadp, 1, 1, 0,
 +       doc: /* Return t if OBJECT is a thread.  */)
 +  (Lisp_Object object)
 +{
 +  if (THREADP (object))
 +    return Qt;
 +  else
 +    return Qnil;
 +}
 +
 +DEFUN ("mutexp", Fmutexp, Smutexp, 1, 1, 0,
 +       doc: /* Return t if OBJECT is a mutex.  */)
 +  (Lisp_Object object)
 +{
 +  if (MUTEXP (object))
 +    return Qt;
 +  else
 +    return Qnil;
 +}
 +
 +DEFUN ("condition-variable-p", Fcondition_variable_p, Scondition_variable_p,
 +       1, 1, 0,
 +       doc: /* Return t if OBJECT is a condition variable.  */)
 +  (Lisp_Object object)
 +{
 +  if (CONDVARP (object))
 +    return Qt;
 +  else
 +    return Qnil;
 +}
  \f
- /* Extract and set components of lists */
+ /* Extract and set components of lists */
  
  DEFUN ("car", Fcar, Scar, 1, 1, 0,
         doc: /* Return the car of LIST.  If arg is nil, return nil.
diff --cc src/emacs.c
index 3c814a360431dbfc1b01de8a30855d0b71693e74,8da2f66e536d6109e05d22dfe242a569f3ead789..8787e4bca9f5b9e3e10ededa738993d70fee44a0
@@@ -667,8 -694,12 +690,9 @@@ close_output_streams (void
  int
  main (int argc, char **argv)
  {
 -#if GC_MARK_STACK
 -  Lisp_Object dummy;
 -#endif
    char stack_bottom_variable;
    bool do_initial_setlocale;
+   bool dumping;
    int skip_args = 0;
  #ifdef HAVE_SETRLIMIT
    struct rlimit rlim;
  #endif
    char *ch_to_dir;
  
 -#if GC_MARK_STACK
 -  stack_base = &dummy;
 -#endif
 +  /* Record (approximately) where the stack begins.  */
 +  stack_bottom = &stack_bottom_variable;
  
- #if defined (USE_GTK) && defined (G_SLICE_ALWAYS_MALLOC)
+ #ifdef G_SLICE_ALWAYS_MALLOC
    /* This is used by the Cygwin build.  */
-   setenv ("G_SLICE", "always-malloc", 1);
+   xputenv ("G_SLICE=always-malloc");
  #endif
  
  #ifdef GNU_LINUX
@@@ -1535,9 -1461,10 +1452,11 @@@ Using an Emacs configured with --with-x
  
  #ifdef WINDOWSNT
        syms_of_ntterm ();
+       syms_of_w32notify ();
  #endif /* WINDOWSNT */
  
 +      syms_of_threads ();
+       syms_of_profiler ();
  
        keys_of_casefiddle ();
        keys_of_cmds ();
diff --cc src/eval.c
index ecdbe960a8a72ac1e986d1724baa938a113a90cd,34b20f6fc8eac07a53aba051cecdd66784ad001e..0932564b36f4e7c5a847bd31df27717736ddfeb4
@@@ -32,22 -31,12 +31,12 @@@ along with GNU Emacs.  If not, see <htt
  #include "xterm.h"
  #endif
  
- struct backtrace
- {
-   struct backtrace *next;
-   Lisp_Object *function;
-   Lisp_Object *args;  /* Points to vector of args.  */
-   ptrdiff_t nargs;    /* Length of vector.  */
-   /* Nonzero means call value of debugger when done with this operation.  */
-   unsigned int debug_on_exit : 1;
- };
 -struct backtrace *backtrace_list;
 +/* static struct backtrace *backtrace_list; */
  
 -#if !BYTE_MARK_STACK
 -static
 -#endif
 -struct catchtag *catchlist;
 +/* #if !BYTE_MARK_STACK */
 +/* static */
 +/* #endif */
 +/* struct catchtag *catchlist; */
  
  /* Chain of condition handlers currently in effect.
     The elements of this chain are contained in the stack frames
@@@ -1157,9 -1014,9 +1033,9 @@@ unwind_to_catch (struct catchtag *catch
    gcpro_level = gcprolist ? gcprolist->level + 1 : 0;
  #endif
    backtrace_list = catch->backlist;
 -  lisp_eval_depth = catch->lisp_eval_depth;
 +  lisp_eval_depth = catch->f_lisp_eval_depth;
  
-   _longjmp (catch->jmp, 1);
+   sys_longjmp (catch->jmp, 1);
  }
  
  DEFUN ("throw", Fthrow, Sthrow, 2, 2, 0,
@@@ -3255,10 -3052,10 +3115,10 @@@ specbind (Lisp_Object symbol, Lisp_Obje
          set_specpdl_symbol (symbol);
  
        specpdl_ptr++;
 -      set_internal (symbol, value, Qnil, 1);
 +      do_specbind (sym, specpdl_ptr - 1, value);
        break;
        }
-     default: abort ();
+     default: emacs_abort ();
      }
  }
  
diff --cc src/lisp.h
index 07a3ae17469f95da8ddca89a08078917833cf38a,9af52c097829122c8094e260ed6823db8cfc2488..82bf621b62fc95fd1720c8d155e6e7a98163ea1a
@@@ -365,17 -408,11 +410,14 @@@ enum pvec_typ
    PVEC_WINDOW_CONFIGURATION,
    PVEC_SUBR,
    PVEC_OTHER,
-   /* These last 4 are special because we OR them in fns.c:internal_equal,
-      so they have to use a disjoint bit pattern:
-      if (!(size & (PVEC_COMPILED | PVEC_CHAR_TABLE
-                    | PVEC_SUB_CHAR_TABLE | PVEC_FONT))) */
-   PVEC_COMPILED                       = 0x10,
-   PVEC_CHAR_TABLE             = 0x20,
-   PVEC_SUB_CHAR_TABLE         = 0x30,
-   PVEC_FONT                   = 0x40
 +  PVEC_THREAD,
 +  PVEC_MUTEX,
 +  PVEC_CONDVAR,
+   /* These should be last, check internal_equal to see why.  */
+   PVEC_COMPILED,
+   PVEC_CHAR_TABLE,
+   PVEC_SUB_CHAR_TABLE,
+   PVEC_FONT /* Should be last because it's used for range checking.  */
  };
  
  /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
@@@ -2023,14 -2042,31 +2065,29 @@@ struct specbindin
    {
      Lisp_Object symbol, old_value;
      specbinding_func func;
 -    Lisp_Object unused;               /* Dividing by 16 is faster than by 12.  */
 +    /* Normally this is unused; but it is to the symbol's current
 +       value when a thread is swapped out.  */
 +    Lisp_Object saved_value;
    };
  
 -extern struct specbinding *specpdl;
 -extern struct specbinding *specpdl_ptr;
 -extern ptrdiff_t specpdl_size;
 -
  #define SPECPDL_INDEX()       (specpdl_ptr - specpdl)
  
- /* Everything needed to describe an active condition case.  */
+ struct backtrace
+ {
+   struct backtrace *next;
+   Lisp_Object function;
+   Lisp_Object *args;  /* Points to vector of args.  */
+   ptrdiff_t nargs;    /* Length of vector.  */
+   /* Nonzero means call value of debugger when done with this operation.  */
+   unsigned int debug_on_exit : 1;
+ };
+ extern struct backtrace *backtrace_list;
+ /* Everything needed to describe an active condition case.
+    Members are volatile if their values need to survive _longjmp when
+    a 'struct handler' is a local variable.  */
  struct handler
    {
      /* The handler clauses and variable from the condition-case form.  */
  struct catchtag
  {
    Lisp_Object tag;
-   Lisp_Object val;
-   struct catchtag *next;
+   Lisp_Object volatile val;
+   struct catchtag *volatile next;
    struct gcpro *gcpro;
-   jmp_buf jmp;
+   sys_jmp_buf jmp;
    struct backtrace *backlist;
 -  struct handler *handlerlist;
 -  EMACS_INT lisp_eval_depth;
 +  struct handler *f_handlerlist;
 +  EMACS_INT f_lisp_eval_depth;
-   ptrdiff_t pdlcount;
+   ptrdiff_t volatile pdlcount;
    int poll_suppress_count;
    int interrupt_input_blocked;
    struct byte_stack *byte_stack;
@@@ -3360,13 -3394,13 +3414,12 @@@ extern Lisp_Object get_doc_string (Lisp
  extern void syms_of_doc (void);
  extern int read_bytecode_char (bool);
  
- /* Defined in bytecode.c */
- extern Lisp_Object Qbytecode;
+ /* Defined in bytecode.c.  */
  extern void syms_of_bytecode (void);
 -extern struct byte_stack *byte_stack_list;
  #if BYTE_MARK_STACK
 -extern void mark_byte_stack (void);
 +extern void mark_byte_stack (struct byte_stack *);
  #endif
 -extern void unmark_byte_stack (void);
 +extern void unmark_byte_stack (struct byte_stack *);
  extern Lisp_Object exec_byte_code (Lisp_Object, Lisp_Object, Lisp_Object,
                                   Lisp_Object, ptrdiff_t, Lisp_Object *);
  
diff --cc src/print.c
Simple merge
diff --cc src/process.c
index dbbb23b86271a6e26299023802975c1f6062df9e,7b21d060cf877fab4d7bad689fb068fa2b73ec0e..7f647d44a93877d5ca725fbfdf82298a192982c9
@@@ -352,12 -375,7 +353,12 @@@ pset_mark (struct Lisp_Process *p, Lisp
  {
    p->mark = val;
  }
- static inline void
+ static void
 +pset_thread (struct Lisp_Process *p, Lisp_Object val)
 +{
 +  p->thread = val;
 +}
- static inline void
++static void
  pset_name (struct Lisp_Process *p, Lisp_Object val)
  {
    p->name = val;
@@@ -1894,103 -1665,64 +1856,61 @@@ create_process (Lisp_Object process, ch
    XPROCESS (process)->pty_flag = pty_flag;
    pset_status (XPROCESS (process), Qrun);
  
-   /* Delay interrupts until we have a chance to store
-      the new fork's pid in its process structure */
-   sigemptyset (&blocked);
- #ifdef SIGCHLD
-   sigaddset (&blocked, SIGCHLD);
- #endif
- #ifdef HAVE_WORKING_VFORK
-   /* On many hosts (e.g. Solaris 2.4), if a vforked child calls `signal',
-      this sets the parent's signal handlers as well as the child's.
-      So delay all interrupts whose handlers the child might munge,
-      and record the current handlers so they can be restored later.  */
-   sigaddset (&blocked, SIGINT );  sigaction (SIGINT , 0, &sigint_action );
-   sigaddset (&blocked, SIGQUIT);  sigaction (SIGQUIT, 0, &sigquit_action);
-   sigaddset (&blocked, SIGPIPE);  sigaction (SIGPIPE, 0, &sigpipe_action);
- #ifdef AIX
-   sigaddset (&blocked, SIGHUP );  sigaction (SIGHUP , 0, &sighup_action );
- #endif
- #endif /* HAVE_WORKING_VFORK */
-   pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
 -  FD_SET (inchannel, &input_wait_mask);
 -  FD_SET (inchannel, &non_keyboard_wait_mask);
 -  if (inchannel > max_process_desc)
 -    max_process_desc = inchannel;
 +  add_non_keyboard_read_fd (inchannel);
  
-   /* Until we store the proper pid, enable sigchld_handler
-      to recognize an unknown pid as standing for this process.
-      It is very important not to let this `marker' value stay
-      in the table after this function has returned; if it does
-      it might cause call-process to hang and subsequent asynchronous
-      processes to get their return values scrambled.  */
-   XPROCESS (process)->pid = -1;
-   /* This must be called after the above line because it may signal an
-      error. */
+   /* This may signal an error. */
    setup_process_coding_systems (process);
  
-   BLOCK_INPUT;
+   encoded_current_dir = ENCODE_FILE (current_dir);
  
-   {
-     /* child_setup must clobber environ on systems with true vfork.
-        Protect it from permanent change.  */
-     char **save_environ = environ;
-     volatile Lisp_Object encoded_current_dir = ENCODE_FILE (current_dir);
+   block_input ();
+   /* Block SIGCHLD until we have a chance to store the new fork's
+      pid in its process structure.  */
+   sigemptyset (&blocked);
+   sigaddset (&blocked, SIGCHLD);
+   pthread_sigmask (SIG_BLOCK, &blocked, 0);
  
  #ifndef WINDOWSNT
-     pid = vfork ();
-     if (pid == 0)
+   pid = vfork ();
+   if (pid == 0)
  #endif /* not WINDOWSNT */
-       {
-       int xforkin = forkin;
-       int xforkout = forkout;
- #if 0 /* This was probably a mistake--it duplicates code later on,
-        but fails to handle all the cases.  */
-       /* Make sure SIGCHLD is not blocked in the child.  */
-       sigsetmask (SIGEMPTYMASK);
- #endif
+     {
+       int xforkin = forkin;
+       int xforkout = forkout;
  
-       /* Make the pty be the controlling terminal of the process.  */
+       /* Make the pty be the controlling terminal of the process.  */
  #ifdef HAVE_PTYS
-       /* First, disconnect its current controlling terminal.  */
- #ifdef HAVE_SETSID
-       /* We tried doing setsid only if pty_flag, but it caused
-          process_set_signal to fail on SGI when using a pipe.  */
-       setsid ();
-       /* Make the pty's terminal the controlling terminal.  */
-       if (pty_flag && xforkin >= 0)
-         {
+       /* First, disconnect its current controlling terminal.  */
+       /* We tried doing setsid only if pty_flag, but it caused
+        process_set_signal to fail on SGI when using a pipe.  */
+       setsid ();
+       /* Make the pty's terminal the controlling terminal.  */
+       if (pty_flag && xforkin >= 0)
+       {
  #ifdef TIOCSCTTY
-           /* We ignore the return value
-              because faith@cs.unc.edu says that is necessary on Linux.  */
-           ioctl (xforkin, TIOCSCTTY, 0);
+         /* We ignore the return value
+            because faith@cs.unc.edu says that is necessary on Linux.  */
+         ioctl (xforkin, TIOCSCTTY, 0);
  #endif
-         }
- #else /* not HAVE_SETSID */
- #ifdef USG
-       /* It's very important to call setpgrp here and no time
-          afterwards.  Otherwise, we lose our controlling tty which
-          is set when we open the pty. */
-       setpgrp ();
- #endif /* USG */
- #endif /* not HAVE_SETSID */
+       }
  #if defined (LDISC1)
-       if (pty_flag && xforkin >= 0)
-         {
-           struct termios t;
-           tcgetattr (xforkin, &t);
-           t.c_lflag = LDISC1;
-           if (tcsetattr (xforkin, TCSANOW, &t) < 0)
-             emacs_write (1, "create_process/tcsetattr LDISC1 failed\n", 39);
-         }
+       if (pty_flag && xforkin >= 0)
+       {
+         struct termios t;
+         tcgetattr (xforkin, &t);
+         t.c_lflag = LDISC1;
+         if (tcsetattr (xforkin, TCSANOW, &t) < 0)
+           emacs_write (1, "create_process/tcsetattr LDISC1 failed\n", 39);
+       }
  #else
  #if defined (NTTYDISC) && defined (TIOCSETD)
-       if (pty_flag && xforkin >= 0)
-         {
-           /* Use new line discipline.  */
-           int ldisc = NTTYDISC;
-           ioctl (xforkin, TIOCSETD, &ldisc);
-         }
+       if (pty_flag && xforkin >= 0)
+       {
+         /* Use new line discipline.  */
+         int ldisc = NTTYDISC;
+         ioctl (xforkin, TIOCSETD, &ldisc);
+       }
  #endif
  #endif
  #ifdef TIOCNOTTY
@@@ -6642,55 -6169,29 +6327,30 @@@ handle_child_signal (int sig
          p->raw_status_new = 1;
  
          /* If process has terminated, stop waiting for its output.  */
-         if ((WIFSIGNALED (w) || WIFEXITED (w))
-             && p->infd >= 0)
-           clear_desc_flag = 1;
-         /* We use clear_desc_flag to avoid a compiler bug in Microsoft C.  */
-         if (clear_desc_flag)
-           delete_read_fd (p->infd);
-         /* Tell wait_reading_process_output that it needs to wake up and
-            look around.  */
-         if (input_available_clear_time)
-           *input_available_clear_time = make_emacs_time (0, 0);
-       }
-       /* There was no asynchronous process found for that pid: we have
-        a synchronous process.  */
-       else
-       {
-         synch_process_alive = 0;
-         /* Report the status of the synchronous process.  */
-         if (WIFEXITED (w))
-           synch_process_retcode = WEXITSTATUS (w);
-         else if (WIFSIGNALED (w))
-           synch_process_termsig = WTERMSIG (w);
-         /* Tell wait_reading_process_output that it needs to wake up and
-            look around.  */
-         if (input_available_clear_time)
-           *input_available_clear_time = make_emacs_time (0, 0);
+         if (WIFSIGNALED (status) || WIFEXITED (status))
+           {
+             int clear_desc_flag = 0;
+             p->alive = 0;
+             if (p->infd >= 0)
+               clear_desc_flag = 1;
+             /* clear_desc_flag avoids a compiler bug in Microsoft C.  */
+             if (clear_desc_flag)
++              delete_read_fd (p->infd);
+               {
+                 FD_CLR (p->infd, &input_wait_mask);
+                 FD_CLR (p->infd, &non_keyboard_wait_mask);
+               }
+           }
        }
-     sigchld_end_of_loop:
-       ;
-       /* On some systems, we must return right away.
-        If any more processes want to signal us, we will
-        get another signal.
-        Otherwise (on systems that have WNOHANG), loop around
-        to use up all the processes that have something to tell us.  */
- #if (defined WINDOWSNT \
-      || (defined USG && !defined GNU_LINUX \
-        && !(defined HPUX && defined WNOHANG)))
-       errno = old_errno;
-       return;
- #endif /* USG, but not HPUX with WNOHANG */
      }
  }
- #endif /* SIGCHLD */
+ static void
+ deliver_child_signal (int sig)
+ {
+   deliver_process_signal (sig, handle_child_signal);
+ }
  \f
  
  static Lisp_Object
@@@ -7548,10 -7043,16 +7208,12 @@@ init_process_emacs (void
  #ifndef CANNOT_DUMP
    if (! noninteractive || initialized)
  #endif
-     signal (SIGCHLD, sigchld_handler);
- #endif
+     {
+       struct sigaction action;
+       emacs_sigaction_init (&action, deliver_child_signal);
+       sigaction (SIGCHLD, &action, 0);
+     }
  
 -  FD_ZERO (&input_wait_mask);
 -  FD_ZERO (&non_keyboard_wait_mask);
 -  FD_ZERO (&non_process_wait_mask);
 -  FD_ZERO (&write_mask);
    max_process_desc = 0;
    memset (fd_callback_info, 0, sizeof (fd_callback_info));
  
diff --cc src/process.h
Simple merge
diff --cc src/regex.c
Simple merge
diff --cc src/search.c
Simple merge
diff --cc src/window.c
index 732d5060d299d6448ab6657f0a934595aee08aa8,28c3bf93553f02c46bfa2b8ea34a8d4452b6b3b4..7fa55df3c5e0c6e06260cc36534a6c71f2cf4c76
@@@ -5548,8 -5546,8 +5546,8 @@@ the return value is nil.  Otherwise th
    data = (struct save_window_data *) XVECTOR (configuration);
    saved_windows = XVECTOR (data->saved_windows);
  
 -  new_current_buffer = data->current_buffer;
 +  new_current_buffer = data->f_current_buffer;
-   if (NILP (BVAR (XBUFFER (new_current_buffer), name)))
+   if (!BUFFER_LIVE_P (XBUFFER (new_current_buffer)))
      new_current_buffer = Qnil;
    else
      {